Skip to content

Scheduling infrastructure for absolutely everyone.

chore: app router - all sub-pages in `/apps` (#16976)

Benny Joobb40b2f6bf1f
diff --git a/.env.example b/.env.example
index c0e3a2bb309..cfb67a88df4 100644
--- a/.env.example
+++ b/.env.example
@@ -355,14 +355,6 @@ E2E_TEST_OIDC_USER_PASSWORD=
# provide a value between 0 and 100 to ensure the percentage of traffic
# redirected from the legacy to the future pages
AB_TEST_BUCKET_PROBABILITY=50
-APP_ROUTER_APPS_INSTALLED_CATEGORY_ENABLED=0
-APP_ROUTER_APPS_SLUG_ENABLED=0
-APP_ROUTER_APPS_SLUG_SETUP_ENABLED=0
-# whether we redirect to the future/apps/categories from /apps/categories or not
-APP_ROUTER_APPS_CATEGORIES_ENABLED=0
-# whether we redirect to the future/apps/categories/[category] from /apps/categories/[category] or not
-APP_ROUTER_APPS_CATEGORIES_CATEGORY_ENABLED=0
-APP_ROUTER_APPS_ENABLED=0
APP_ROUTER_TEAM_ENABLED=0
APP_ROUTER_AUTH_FORGOT_PASSWORD_ENABLED=0
APP_ROUTER_AUTH_LOGIN_ENABLED=0
diff --git a/apps/web/abTest/middlewareFactory.ts b/apps/web/abTest/middlewareFactory.ts
index 27938472378..c103de9fd62 100644
--- a/apps/web/abTest/middlewareFactory.ts
+++ b/apps/web/abTest/middlewareFactory.ts
@@ -5,11 +5,6 @@ import { NextResponse, URLPattern } from "next/server";
import { FUTURE_ROUTES_ENABLED_COOKIE_NAME, FUTURE_ROUTES_OVERRIDE_COOKIE_NAME } from "@calcom/lib/constants";
const ROUTES: [URLPattern, boolean][] = [
- ["/apps/installed/:category", process.env.APP_ROUTER_APPS_INSTALLED_CATEGORY_ENABLED === "1"] as const,
- ["/apps/:slug", process.env.APP_ROUTER_APPS_SLUG_ENABLED === "1"] as const,
- ["/apps/:slug/setup", process.env.APP_ROUTER_APPS_SLUG_SETUP_ENABLED === "1"] as const,
- ["/apps/categories", process.env.APP_ROUTER_APPS_CATEGORIES_ENABLED === "1"] as const,
- ["/apps/categories/:category", process.env.APP_ROUTER_APPS_CATEGORIES_CATEGORY_ENABLED === "1"] as const,
["/auth/forgot-password/:path*", process.env.APP_ROUTER_AUTH_FORGOT_PASSWORD_ENABLED === "1"] as const,
["/auth/login", process.env.APP_ROUTER_AUTH_LOGIN_ENABLED === "1"] as const,
["/auth/logout", process.env.APP_ROUTER_AUTH_LOGOUT_ENABLED === "1"] as const,
diff --git a/apps/web/app/_utils.tsx b/apps/web/app/_utils.tsx
index a487888800f..f5b13fe1ac2 100644
--- a/apps/web/app/_utils.tsx
+++ b/apps/web/app/_utils.tsx
@@ -3,7 +3,8 @@ import i18next from "i18next";
import { serverSideTranslations } from "next-i18next/serverSideTranslations";
import { headers } from "next/headers";
-import { constructGenericImage } from "@calcom/lib/OgImages";
+import type { AppImageProps } from "@calcom/lib/OgImages";
+import { constructGenericImage, constructAppImage } from "@calcom/lib/OgImages";
import { IS_CALCOM, WEBAPP_URL, APP_NAME, SEO_IMG_OGIMG, CAL_URL } from "@calcom/lib/constants";
import { buildCanonical } from "@calcom/lib/next-seo.config";
import { truncateOnWord } from "@calcom/lib/text";
@@ -61,17 +62,18 @@ const _generateMetadataWithoutImage = async (
const t = await getTranslationWithCache(locale);
const title = getTitle(t);
- const description = getDescription(t);
+
const titleSuffix = `| ${APP_NAME}`;
const displayedTitle = title.includes(titleSuffix) || hideBranding ? title : `${title} ${titleSuffix}`;
const metadataBase = new URL(IS_CALCOM ? "https://cal.com" : WEBAPP_URL);
+ const truncatedDescription = truncateOnWord(getDescription(t), 158);
return {
title: title.length === 0 ? APP_NAME : displayedTitle,
- description,
+ description: truncatedDescription,
alternates: { canonical },
openGraph: {
- description: truncateOnWord(description, 158),
+ description: truncatedDescription,
url: canonical,
type: "website",
siteName: APP_NAME,
@@ -103,3 +105,23 @@ export const _generateMetadata = async (
},
};
};
+
+export const generateAppMetadata = async (
+ app: AppImageProps,
+ getTitle: (t: TFunction<string, undefined>) => string,
+ getDescription: (t: TFunction<string, undefined>) => string,
+ hideBranding?: boolean,
+ origin?: string
+) => {
+ const metadata = await _generateMetadataWithoutImage(getTitle, getDescription, hideBranding, origin);
+
+ const image = SEO_IMG_OGIMG + constructAppImage({ ...app, description: metadata.description });
+
+ return {
+ ...metadata,
+ openGraph: {
+ ...metadata.openGraph,
+ images: [image],
+ },
+ };
+};
diff --git a/apps/web/app/future/apps/[slug]/[...pages]/page.tsx b/apps/web/app/apps/[slug]/[...pages]/page.tsx
similarity index 100%
rename from apps/web/app/future/apps/[slug]/[...pages]/page.tsx
rename to apps/web/app/apps/[slug]/[...pages]/page.tsx
diff --git a/apps/web/app/apps/[slug]/page.tsx b/apps/web/app/apps/[slug]/page.tsx
new file mode 100644
index 00000000000..7cd655d5d3e
--- /dev/null
+++ b/apps/web/app/apps/[slug]/page.tsx
@@ -0,0 +1,68 @@
+import type { PageProps as _PageProps } from "app/_types";
+import { generateAppMetadata } from "app/_utils";
+import { WithLayout } from "app/layoutHOC";
+import { notFound } from "next/navigation";
+import { z } from "zod";
+
+import { AppRepository } from "@calcom/lib/server/repository/app";
+import { isPrismaAvailableCheck } from "@calcom/prisma/is-prisma-available-check";
+
+import { getStaticProps } from "@lib/apps/[slug]/getStaticProps";
+
+import AppView from "~/apps/[slug]/slug-view";
+
+const paramsSchema = z.object({
+ slug: z.string(),
+});
+
+export const generateMetadata = async ({ params }: _PageProps) => {
+ const p = paramsSchema.safeParse(params);
+
+ if (!p.success) {
+ return notFound();
+ }
+
+ const props = await getStaticProps(p.data.slug);
+
+ if (!props) {
+ notFound();
+ }
+ const { name, logo, description } = props.data;
+
+ return await generateAppMetadata(
+ { slug: logo, name, description },
+ () => name,
+ () => description
+ );
+};
+
+export const generateStaticParams = async () => {
+ const isPrismaAvailable = await isPrismaAvailableCheck();
+
+ if (!isPrismaAvailable) {
+ // Database is not available at build time. Make sure we fall back to building these pages on demand
+ return [];
+ }
+ const appStore = await AppRepository.findAppStore();
+ return appStore.map(({ slug }) => ({ slug }));
+};
+
+async function Page({ params }: _PageProps) {
+ const p = paramsSchema.safeParse(params);
+
+ if (!p.success) {
+ return notFound();
+ }
+
+ const props = await getStaticProps(p.data.slug);
+
+ if (!props) {
+ notFound();
+ }
+
+ return <AppView {...props} />;
+}
+
+export default WithLayout({ getLayout: null, ServerPage: Page });
+
+export const dynamic = "force-static";
diff --git a/apps/web/app/future/apps/[slug]/setup/page.tsx b/apps/web/app/apps/[slug]/setup/page.tsx
similarity index 60%
rename from apps/web/app/future/apps/[slug]/setup/page.tsx
rename to apps/web/app/apps/[slug]/setup/page.tsx
index c10edd12a20..9689b19e064 100644
--- a/apps/web/app/future/apps/[slug]/setup/page.tsx
+++ b/apps/web/app/apps/[slug]/setup/page.tsx
@@ -2,16 +2,34 @@ import { withAppDirSsr } from "app/WithAppDirSsr";
import type { PageProps as _PageProps } from "app/_types";
import { _generateMetadata } from "app/_utils";
import { WithLayout } from "app/layoutHOC";
+import { notFound } from "next/navigation";
+import { z } from "zod";
import { getServerSideProps } from "@calcom/app-store/_pages/setup/_getServerSideProps";
import Page, { type PageProps } from "~/apps/[slug]/setup/setup-view";
+const paramsSchema = z.object({
+ slug: z.string(),
+});
+
export const generateMetadata = async ({ params }: _PageProps) => {
- return await _generateMetadata(
- () => `${params.slug}`,
+ const p = paramsSchema.safeParse(params);
+
+ if (!p.success) {
+ return notFound();
+ }
+ const metadata = await _generateMetadata(
+ () => `${p.data.slug}`,
() => ""
);
+ return {
+ ...metadata,
+ robots: {
+ follow: false,
+ index: false,
+ },
+ };
};
const getData = withAppDirSsr<PageProps>(getServerSideProps);
diff --git a/apps/web/app/apps/categories/[category]/page.tsx b/apps/web/app/apps/categories/[category]/page.tsx
new file mode 100644
index 00000000000..0b9b5089c6f
--- /dev/null
+++ b/apps/web/app/apps/categories/[category]/page.tsx
@@ -0,0 +1,40 @@
+import type { PageProps } from "app/_types";
+import { _generateMetadata } from "app/_utils";
+import { WithLayout } from "app/layoutHOC";
+import { redirect } from "next/navigation";
+import { z } from "zod";
+
+import { AppCategories } from "@calcom/prisma/enums";
+
+import { getStaticProps } from "@lib/apps/categories/[category]/getStaticProps";
+
+import CategoryPage from "~/apps/categories/[category]/category-view";
+
+const querySchema = z.object({
+ category: z.enum(Object.values(AppCategories) as [AppCategories, ...AppCategories[]]),
+});
+
+export const generateMetadata = async () => {
+ return await _generateMetadata(
+ (t) => t("app_store"),
+ (t) => t("app_store_description")
+ );
+};
+
+export const generateStaticParams = async () => {
+ const paths = Object.keys(AppCategories);
+ return paths.map((category) => ({ category }));
+};
+
+async function Page({ params, searchParams }: PageProps) {
+ const parsed = querySchema.safeParse({ ...params, ...searchParams });
+ if (!parsed.success) {
+ redirect("/apps/categories/calendar");
+ }
+
+ const props = await getStaticProps(parsed.data.category);
+
+ return <CategoryPage {...props} />;
+}
+
+export default WithLayout({ getLayout: null, ServerPage: Page });
diff --git a/apps/web/app/future/apps/categories/page.tsx b/apps/web/app/apps/categories/page.tsx
similarity index 100%
rename from apps/web/app/future/apps/categories/page.tsx
rename to apps/web/app/apps/categories/page.tsx
diff --git a/apps/web/app/future/apps/installation/[[...step]]/page.tsx b/apps/web/app/apps/installation/[[...step]]/page.tsx
similarity index 100%
rename from apps/web/app/future/apps/installation/[[...step]]/page.tsx
rename to apps/web/app/apps/installation/[[...step]]/page.tsx
index 650f732d9a3..6b536803b63 100644
--- a/apps/web/app/future/apps/installation/[[...step]]/page.tsx
+++ b/apps/web/app/apps/installation/[[...step]]/page.tsx
@@ -12,7 +12,6 @@ import Page from "~/apps/installation/[[...step]]/step-view";
export const generateMetadata = async ({ params, searchParams }: PageProps) => {
const legacyCtx = buildLegacyCtx(headers(), cookies(), params, searchParams);
-
const { appMetadata } = await getData(legacyCtx);
return await _generateMetadata(
(t) => `${t("install")} ${appMetadata?.name ?? ""}`,
@@ -23,3 +22,4 @@ export const generateMetadata = async ({ params, searchParams }: PageProps) => {
const getData = withAppDirSsr<OnboardingPageProps>(getServerSideProps);
export default WithLayout({ getLayout: null, getData, Page });
+
diff --git a/apps/web/app/apps/installed/[category]/page.tsx b/apps/web/app/apps/installed/[category]/page.tsx
new file mode 100644
index 00000000000..9eb1a77c8de
--- /dev/null
+++ b/apps/web/app/apps/installed/[category]/page.tsx
@@ -0,0 +1,32 @@
+import { PageProps } from "app/_types";
+import { _generateMetadata } from "app/_utils";
+import { WithLayout } from "app/layoutHOC";
+import { redirect } from "next/navigation";
+import { z } from "zod";
+
+import { AppCategories } from "@calcom/prisma/enums";
+
+import InstalledApps from "~/apps/installed/[category]/installed-category-view";
+
+const querySchema = z.object({
+ category: z.nativeEnum(AppCategories),
+});
+
+export const generateMetadata = async () => {
+ return await _generateMetadata(
+ (t) => t("installed_apps"),
+ (t) => t("manage_your_connected_apps")
+ );
+};
+
+const InstalledAppsWrapper = async ({ params }: PageProps) => {
+ const parsedParams = querySchema.safeParse(params);
+
+ if (!parsedParams.success) {
+ redirect("/apps/installed/calendar");
+ }
+
+ return <InstalledApps category={parsedParams.data.category} />;
+};
+
+export default WithLayout({ getLayout: null, ServerPage: InstalledAppsWrapper });
diff --git a/apps/web/app/future/apps/installed/page.tsx b/apps/web/app/apps/installed/page.tsx
similarity index 100%
rename from apps/web/app/future/apps/installed/page.tsx
rename to apps/web/app/apps/installed/page.tsx
diff --git a/apps/web/app/apps/routing-forms/[...pages]/page.tsx b/apps/web/app/apps/routing-forms/[...pages]/page.tsx
new file mode 100644
index 00000000000..a86b31568d3
--- /dev/null
+++ b/apps/web/app/apps/routing-forms/[...pages]/page.tsx
@@ -0,0 +1 @@
+export { default } from "app/routing-forms/[...pages]/page";
diff --git a/apps/web/app/apps/routing-forms/page.tsx b/apps/web/app/apps/routing-forms/page.tsx
new file mode 100644
index 00000000000..3abdb645758
--- /dev/null
+++ b/apps/web/app/apps/routing-forms/page.tsx
@@ -0,0 +1 @@
+export { default } from "app/routing-forms/page";
diff --git a/apps/web/app/future/apps/[slug]/page.tsx b/apps/web/app/future/apps/[slug]/page.tsx
deleted file mode 100644
index 3c7f717544a..00000000000
--- a/apps/web/app/future/apps/[slug]/page.tsx
+++ /dev/null
@@ -1,45 +0,0 @@
-import { Prisma } from "@prisma/client";
-import { withAppDirSsg } from "app/WithAppDirSsg";
-import type { PageProps as _PageProps } from "app/_types";
-import { _generateMetadata } from "app/_utils";
-import { WithLayout } from "app/layoutHOC";
-import { cookies, headers } from "next/headers";
-
-import { AppRepository } from "@calcom/lib/server/repository/app";
-
-import { getStaticProps } from "@lib/apps/[slug]/getStaticProps";
-import { buildLegacyCtx } from "@lib/buildLegacyCtx";
-
-import type { PageProps } from "~/apps/[slug]/slug-view";
-import Page from "~/apps/[slug]/slug-view";
-
-const getData = withAppDirSsg<PageProps>(getStaticProps, "future/apps/[slug]");
-
-export const generateMetadata = async ({ params, searchParams }: _PageProps) => {
- const legacyContext = buildLegacyCtx(headers(), cookies(), params, searchParams);
- const res = await getData(legacyContext);
-
- return await _generateMetadata(
- () => res?.data.name ?? "",
- () => res?.data.description ?? ""
- );
-};
-
-export const generateStaticParams = async () => {
- try {
- const appStore = await AppRepository.findAppStore();
- return appStore.map(({ slug }) => ({ slug }));
- } catch (e: unknown) {
- if (e instanceof Prisma.PrismaClientInitializationError) {
- // Database is not available at build time, but that's ok – we fall back to resolving paths on demand
- } else {
- throw e;
- }
- }
-
- return [];
-};
-
-export default WithLayout({ getLayout: null, Page, getData });
-
-export const dynamic = "force-static";
diff --git a/apps/web/app/future/apps/categories/[category]/page.tsx b/apps/web/app/future/apps/categories/[category]/page.tsx
deleted file mode 100644
index 4aae6cb8451..00000000000
--- a/apps/web/app/future/apps/categories/[category]/page.tsx
+++ /dev/null
@@ -1,34 +0,0 @@
-import { withAppDirSsg } from "app/WithAppDirSsg";
-import { _generateMetadata } from "app/_utils";
-import { WithLayout } from "app/layoutHOC";
-
-import { AppCategories } from "@calcom/prisma/enums";
-import { isPrismaAvailableCheck } from "@calcom/prisma/is-prisma-available-check";
-
-import { getStaticProps } from "@lib/apps/categories/[category]/getStaticProps";
-
-import CategoryPage, { type PageProps } from "~/apps/categories/[category]/category-view";
-
-export const generateMetadata = async () => {
- return await _generateMetadata(
- (t) => t("app_store"),
- (t) => t("app_store_description")
- );
-};
-
-export const generateStaticParams = async () => {
- const paths = Object.keys(AppCategories);
- const isPrismaAvailable = await isPrismaAvailableCheck();
-
- if (!isPrismaAvailable) {
- // Database is not available at build time. Make sure we fall back to building these pages on demand
- return [];
- }
-
- return paths.map((category) => ({ category }));
-};
-
-const getData = withAppDirSsg<PageProps>(getStaticProps, "future/apps/categories/[category]");
-
-export default WithLayout({ getData, Page: CategoryPage, getLayout: null })<"P">;
-export const dynamic = "force-static";
diff --git a/apps/web/app/future/apps/installed/[category]/page.tsx b/apps/web/app/future/apps/installed/[category]/page.tsx
deleted file mode 100644
index c20bbf0d32f..00000000000
--- a/apps/web/app/future/apps/installed/[category]/page.tsx
+++ /dev/null
@@ -1,18 +0,0 @@
-import { withAppDirSsr } from "app/WithAppDirSsr";
-import { _generateMetadata } from "app/_utils";
-import { WithLayout } from "app/layoutHOC";
-
-import { getServerSidePropsAppDir } from "@lib/apps/installed/[category]/getServerSideProps";
-
-import Page from "~/apps/installed/[category]/installed-category-view";
-
-export const generateMetadata = async () => {
- return await _generateMetadata(
- (t) => t("installed_apps"),
- (t) => t("manage_your_connected_apps")
- );
-};
-
-const getData = withAppDirSsr(getServerSidePropsAppDir);
-
-export default WithLayout({ getLayout: null, getData, Page });
diff --git a/apps/web/app/future/routing-forms/[...pages]/page.tsx b/apps/web/app/routing-forms/[...pages]/page.tsx
similarity index 54%
rename from apps/web/app/future/routing-forms/[...pages]/page.tsx
rename to apps/web/app/routing-forms/[...pages]/page.tsx
index 4ecc5a1aa08..8bdeb008801 100644
--- a/apps/web/app/future/routing-forms/[...pages]/page.tsx
+++ b/apps/web/app/routing-forms/[...pages]/page.tsx
@@ -10,10 +10,10 @@ const paramsSchema = z
pages: [],
});
-const Page = ({ params, searchParams }: PageProps) => {
- const { pages } = paramsSchema.parse({ ...params, ...searchParams });
+const Page = ({ params }: PageProps) => {
+ const { pages } = paramsSchema.parse(params);
- redirect(`/apps/routing-forms/${pages.length ? pages.join("/") : ""}`);
+ redirect(`/routing/${pages.length ? pages.join("/") : ""}`);
};
export default Page;
diff --git a/apps/web/app/future/routing-forms/page.tsx b/apps/web/app/routing-forms/page.tsx
similarity index 53%
rename from apps/web/app/future/routing-forms/page.tsx
rename to apps/web/app/routing-forms/page.tsx
index ba222ba4761..39c972a3856 100644
--- a/apps/web/app/future/routing-forms/page.tsx
+++ b/apps/web/app/routing-forms/page.tsx
@@ -1,7 +1,7 @@
import { redirect } from "next/navigation";
-const Page = () => {
- redirect("/apps/routing-forms/forms");
+const Page = async () => {
+ redirect("/routing/forms");
};
export default Page;
diff --git a/apps/web/app/routing/[...pages]/page.tsx b/apps/web/app/routing/[...pages]/page.tsx
new file mode 100644
index 00000000000..8f91cfddc58
--- /dev/null
+++ b/apps/web/app/routing/[...pages]/page.tsx
@@ -0,0 +1,70 @@
+import { withAppDirSsr } from "app/WithAppDirSsr";
+import type { PageProps } from "app/_types";
+import { _generateMetadata } from "app/_utils";
+import { WithLayout } from "app/layoutHOC";
+import type { GetServerSidePropsResult } from "next";
+import { cookies, headers } from "next/headers";
+import { notFound } from "next/navigation";
+import z from "zod";
+
+import { buildLegacyCtx } from "@lib/buildLegacyCtx";
+import { getServerSideProps } from "@lib/routing/[...pages]/getServerSideProps";
+
+import RoutingFormsPage, { getLayout } from "~/routing/[...pages]/pages-view";
+
+const paramsSchema = z.object({
+ pages: z.array(z.string()),
+});
+
+export const generateMetadata = async ({ params, searchParams }: PageProps) => {
+ const p = paramsSchema.safeParse(params);
+
+ if (!p.success) {
+ return notFound();
+ }
+ const ctx = buildLegacyCtx(headers(), cookies(), params, searchParams);
+ const data = await getData({
+ ...ctx,
+ params: {
+ slug: "routing-forms",
+ pages: params.pages,
+ },
+ });
+ const form = "form" in data ? (data.form as { name?: string; description?: string }) : null;
+ const formName = form?.name;
+ const formDescription = form?.description;
+
+ const { pages } = p.data;
+
+ if (pages.includes("routing-link")) {
+ return await _generateMetadata(
+ () => `${formName} | Cal.com Forms`,
+ () => "",
+ true
+ );
+ }
+
+ return await _generateMetadata(
+ (t) => formName ?? t("routing_forms"),
+ (t) => formDescription ?? t("routing_forms_description")
+ );
+};
+
+const getData = withAppDirSsr<GetServerSidePropsResult<any>>(getServerSideProps);
+
+const ServerPage = async ({ params, searchParams }: PageProps) => {
+ const ctx = buildLegacyCtx(headers(), cookies(), params, searchParams);
+ const props = await getData({
+ ...ctx,
+ params: {
+ slug: "routing-forms",
+ pages: params.pages,
+ },
+ });
+ return <RoutingFormsPage {...props} />;
+};
+
+export default WithLayout({
+ getLayout,
+ ServerPage,
+});
diff --git a/apps/web/app/routing/page.tsx b/apps/web/app/routing/page.tsx
new file mode 100644
index 00000000000..39c972a3856
--- /dev/null
+++ b/apps/web/app/routing/page.tsx
@@ -0,0 +1,7 @@
+import { redirect } from "next/navigation";
+
+const Page = async () => {
+ redirect("/routing/forms");
+};
+
+export default Page;
diff --git a/apps/web/components/apps/App.tsx b/apps/web/components/apps/App.tsx
index 6ad0c4b60b3..f0ef2ead985 100644
--- a/apps/web/components/apps/App.tsx
+++ b/apps/web/components/apps/App.tsx
@@ -1,7 +1,6 @@
import LicenseRequired from "@calcom/features/ee/common/components/LicenseRequired";
import Shell from "@calcom/features/shell/Shell";
import { useLocale } from "@calcom/lib/hooks/useLocale";
-import { HeadSeo } from "@calcom/ui";
import type { AppPageProps } from "./AppPage";
import { AppPage } from "./AppPage";
@@ -14,11 +13,6 @@ const ShellHeading = () => {
export default function WrappedApp(props: AppPageProps) {
return (
<Shell smallHeading isPublic hideHeadingOnMobile heading={<ShellHeading />} backPath="/apps" withoutSeo>
- <HeadSeo
- title={props.name}
- description={props.description}
- app={{ slug: props.logo, name: props.name, description: props.description }}
- />
{props.licenseRequired ? (
<LicenseRequired>
<AppPage {...props} />
diff --git a/apps/web/components/dialog/RerouteDialog.tsx b/apps/web/components/dialog/RerouteDialog.tsx
index ca72e40dc83..d39d8686822 100644
--- a/apps/web/components/dialog/RerouteDialog.tsx
+++ b/apps/web/components/dialog/RerouteDialog.tsx
@@ -807,7 +807,7 @@ const RerouteDialogContentAndFooterWithFormResponse = ({
<div>
<Link
className="text-emphasis text-semibold font-cal mb-4 flex underline"
- href={`/apps/routing-forms/form-edit/${form.id}`}
+ href={`/routing/form-edit/${form.id}`}
target="_blank">
{form.name}
</Link>
diff --git a/apps/web/lib/apps/[slug]/[...pages]/getServerSideProps.ts b/apps/web/lib/apps/[slug]/[...pages]/getServerSideProps.ts
index 5cd62aade0c..ced207cec26 100644
--- a/apps/web/lib/apps/[slug]/[...pages]/getServerSideProps.ts
+++ b/apps/web/lib/apps/[slug]/[...pages]/getServerSideProps.ts
@@ -2,7 +2,6 @@ import type { GetServerSidePropsContext, GetServerSidePropsResult } from "next";
import { z } from "zod";
import { getAppWithMetadata } from "@calcom/app-store/_appRegistry";
-import RoutingFormsRoutingConfig from "@calcom/app-store/routing-forms/pages/app-routing.config";
import TypeformRoutingConfig from "@calcom/app-store/typeform/pages/app-routing.config";
import { getServerSession } from "@calcom/features/auth/lib/getServerSession";
import prisma from "@calcom/prisma";
@@ -32,7 +31,6 @@ type NotFound = {
// TODO: It is a candidate for apps.*.generated.*
const AppsRouting = {
- "routing-forms": RoutingFormsRoutingConfig,
typeform: TypeformRoutingConfig,
};
diff --git a/apps/web/lib/apps/[slug]/getStaticProps.tsx b/apps/web/lib/apps/[slug]/getStaticProps.tsx
index 9113ba9c4e5..61079a28349 100644
--- a/apps/web/lib/apps/[slug]/getStaticProps.tsx
+++ b/apps/web/lib/apps/[slug]/getStaticProps.tsx
@@ -1,7 +1,5 @@
import fs from "fs";
import matter from "gray-matter";
-import MarkdownIt from "markdown-it";
-import type { GetStaticPropsContext } from "next";
import path from "path";
import { z } from "zod";
@@ -10,8 +8,6 @@ import { getAppAssetFullPath } from "@calcom/app-store/getAppAssetFullPath";
import { IS_PRODUCTION } from "@calcom/lib/constants";
import prisma from "@calcom/prisma";
-const md = new MarkdownIt("default", { html: true, breaks: true });
-
export const sourceSchema = z.object({
content: z.string(),
data: z.object({
@@ -29,15 +25,15 @@ export const sourceSchema = z.object({
}),
});
-export const getStaticProps = async (ctx: GetStaticPropsContext) => {
- if (typeof ctx.params?.slug !== "string") return { notFound: true } as const;
+export type AppDataProps = NonNullable<Awaited<ReturnType<typeof getStaticProps>>>;
+export const getStaticProps = async (slug: string) => {
const appMeta = await getAppWithMetadata({
- slug: ctx.params?.slug,
+ slug,
});
const appFromDb = await prisma.app.findUnique({
- where: { slug: ctx.params.slug.toLowerCase() },
+ where: { slug: slug.toLowerCase() },
});
const isAppAvailableInFileSystem = appMeta;
@@ -45,16 +41,14 @@ export const getStaticProps = async (ctx: GetStaticPropsContext) => {
if (!IS_PRODUCTION && isAppDisabled) {
return {
- props: {
- isAppDisabled: true as const,
- data: {
- ...appMeta,
- },
+ isAppDisabled: true as const,
+ data: {
+ ...appMeta,
},
};
}
- if (!appFromDb || !appMeta || isAppDisabled) return { notFound: true } as const;
+ if (!appFromDb || !appMeta || isAppDisabled) return null;
const isTemplate = appMeta.isTemplate;
const appDirname = path.join(isTemplate ? "templates" : "", appFromDb.dirName);
@@ -85,10 +79,8 @@ export const getStaticProps = async (ctx: GetStaticPropsContext) => {
});
}
return {
- props: {
- isAppDisabled: false as const,
- source: { content, data },
- data: appMeta,
- },
+ isAppDisabled: false as const,
+ source: { content, data },
+ data: appMeta,
};
};
diff --git a/apps/web/lib/apps/categories/[category]/getStaticProps.tsx b/apps/web/lib/apps/categories/[category]/getStaticProps.tsx
index 7afa898b1c9..29daa45a820 100644
--- a/apps/web/lib/apps/categories/[category]/getStaticProps.tsx
+++ b/apps/web/lib/apps/categories/[category]/getStaticProps.tsx
@@ -1,12 +1,10 @@
-import type { GetStaticPropsContext } from "next";
-
import { getAppRegistry } from "@calcom/app-store/_appRegistry";
import prisma from "@calcom/prisma";
import type { AppCategories } from "@calcom/prisma/enums";
-export const getStaticProps = async (context: GetStaticPropsContext) => {
- const category = context.params?.category as AppCategories;
+export type CategoryDataProps = NonNullable<Awaited<ReturnType<typeof getStaticProps>>>;
+export const getStaticProps = async (category: AppCategories) => {
const appQuery = await prisma.app.findMany({
where: {
categories: {
@@ -24,8 +22,7 @@ export const getStaticProps = async (context: GetStaticPropsContext) => {
const apps = appStore.filter((app) => dbAppsSlugs.includes(app.slug));
return {
- props: {
- apps,
- },
+ apps,
+ category,
};
};
diff --git a/apps/web/lib/apps/installed/[category]/getServerSideProps.tsx b/apps/web/lib/apps/installed/[category]/getServerSideProps.tsx
deleted file mode 100644
index 109032a2392..00000000000
--- a/apps/web/lib/apps/installed/[category]/getServerSideProps.tsx
+++ /dev/null
@@ -1,78 +0,0 @@
-import type { GetServerSidePropsContext } from "next";
-import { z } from "zod";
-
-import { AppCategories } from "@calcom/prisma/enums";
-
-export type querySchemaType = z.infer<typeof querySchema>;
-
-export const querySchema = z.object({
- category: z.nativeEnum(AppCategories),
-});
-
-export async function getServerSideProps(ctx: GetServerSidePropsContext) {
- // get return-to cookie and redirect if needed
- const { cookies } = ctx.req;
-
- const returnTo = cookies["return-to"];
-
- if (cookies && returnTo) {
- ctx.res.setHeader("Set-Cookie", "return-to=; path=/; expires=Thu, 01 Jan 1970 00:00:00 GMT");
- const redirect = {
- redirect: {
- destination: `${returnTo}`,
- permanent: false,
- },
- } as const;
-
- return redirect;
- }
-
- const params = querySchema.safeParse(ctx.params);
-
- if (!params.success) {
- const notFound = { notFound: true } as const;
-
- return notFound;
- }
-
- return {
- props: {
- category: params.data.category,
- },
- };
-}
-
-export async function getServerSidePropsAppDir(ctx: GetServerSidePropsContext) {
- // get return-to cookie and redirect if needed
- const { cookies } = ctx.req;
-
- const returnTo = cookies["return-to"];
-
- if (cookies && returnTo) {
- const NextResponse = await import("next/server").then((mod) => mod.NextResponse);
- const response = NextResponse.next();
- response.headers.set("Set-Cookie", "return-to=; path=/; expires=Thu, 01 Jan 1970 00:00:00 GMT");
- const redirect = {
- redirect: {
- destination: `${returnTo}`,
- permanent: false,
- },
- } as const;
-
- return redirect;
- }
-
- const params = querySchema.safeParse(ctx.params);
-
- if (!params.success) {
- const notFound = { notFound: true } as const;
-
- return notFound;
- }
-
- return {
- props: {
- category: params.data.category,
- },
- };
-}
diff --git a/apps/web/lib/apps/installed/getServerSideProps.tsx b/apps/web/lib/apps/installed/getServerSideProps.tsx
deleted file mode 100644
index a43490aea51..00000000000
--- a/apps/web/lib/apps/installed/getServerSideProps.tsx
+++ /dev/null
@@ -1,3 +0,0 @@
-export async function getServerSideProps() {
- return { redirect: { permanent: false, destination: "/apps/installed/calendar" } };
-}
diff --git a/apps/web/lib/routing/[...pages]/getServerSideProps.ts b/apps/web/lib/routing/[...pages]/getServerSideProps.ts
new file mode 100644
index 00000000000..681d51b251a
--- /dev/null
+++ b/apps/web/lib/routing/[...pages]/getServerSideProps.ts
@@ -0,0 +1,118 @@
+import type { GetServerSidePropsContext, GetServerSidePropsResult } from "next";
+import { z } from "zod";
+
+import { getAppWithMetadata } from "@calcom/app-store/_appRegistry";
+import { routingServerSidePropsConfig } from "@calcom/app-store/routing-forms/pages/app-routing-server.config";
+import { getServerSession } from "@calcom/features/auth/lib/getServerSession";
+import { prisma } from "@calcom/prisma";
+import type { AppGetServerSideProps } from "@calcom/types/AppGetServerSideProps";
+
+import type { AppProps } from "@lib/app-providers";
+
+import { ssrInit } from "@server/lib/ssr";
+
+type RoutingPageType = {
+ getServerSideProps?: AppGetServerSideProps;
+ // A component than can accept any properties
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
+ default: ((props: any) => JSX.Element) &
+ Pick<AppProps["Component"], "isBookingPage" | "getLayout" | "PageWrapper">;
+};
+
+type Found = {
+ notFound: false;
+ getServerSideProps: RoutingPageType["getServerSideProps"];
+};
+
+type NotFound = {
+ notFound: true;
+};
+
+function getRoute(pages: string[]) {
+ const mainPage = pages[0];
+ const getServerSideProps = routingServerSidePropsConfig[mainPage] as RoutingPageType["getServerSideProps"];
+
+ if (!getServerSideProps || typeof getServerSideProps !== "function") {
+ return {
+ notFound: true,
+ } as NotFound;
+ }
+ return { notFound: false, getServerSideProps } as Found;
+}
+
+const paramsSchema = z.object({
+ slug: z.string(),
+ pages: z.array(z.string()),
+});
+
+export async function getServerSideProps(
+ context: GetServerSidePropsContext
+): Promise<GetServerSidePropsResult<any>> {
+ const { params, req } = context;
+ if (!params) {
+ return {
+ notFound: true,
+ };
+ }
+
+ const parsedParams = paramsSchema.safeParse(params);
+ if (!parsedParams.success) {
+ return {
+ notFound: true,
+ };
+ }
+
+ const appName = parsedParams.data.slug;
+ const pages = parsedParams.data.pages;
+ const route = getRoute(pages);
+
+ if (route.notFound) {
+ return { notFound: true };
+ }
+
+ if (route.getServerSideProps) {
+ params.appPages = pages.slice(1);
+ const session = await getServerSession({ req });
+ const user = session?.user;
+ const app = await getAppWithMetadata({ slug: appName });
+
+ if (!app) {
+ return {
+ notFound: true,
+ };
+ }
+
+ const result = await route.getServerSideProps(
+ context as GetServerSidePropsContext<{
+ slug: string;
+ pages: string[];
+ appPages: string[];
+ }>,
+ prisma,
+ user,
+ ssrInit
+ );
+
+ if (result.notFound) {
+ return { notFound: true };
+ }
+
+ if (result.redirect) {
+ return { redirect: result.redirect };
+ }
+
+ return {
+ props: {
+ appName,
+ appUrl: app.simplePath,
+ ...result.props,
+ },
+ };
+ } else {
+ return {
+ props: {
+ appName,
+ },
+ };
+ }
+}
diff --git a/apps/web/middleware.ts b/apps/web/middleware.ts
index 192cb9b4268..3e27481444e 100644
--- a/apps/web/middleware.ts
+++ b/apps/web/middleware.ts
@@ -64,11 +64,9 @@ const middleware = async (req: NextRequest): Promise<NextResponse<unknown>> => {
requestHeaders.set("x-csp-enforce", "true");
}
- if (url.pathname.startsWith("/future/apps/installed")) {
+ if (url.pathname.startsWith("/apps/installed")) {
const returnTo = req.cookies.get("return-to")?.value;
if (returnTo !== undefined) {
- requestHeaders.set("Set-Cookie", "return-to=; path=/; expires=Thu, 01 Jan 1970 00:00:00 GMT");
-
let validPathname = returnTo;
try {
@@ -77,8 +75,14 @@ const middleware = async (req: NextRequest): Promise<NextResponse<unknown>> => {
const nextUrl = url.clone();
nextUrl.pathname = validPathname;
- // TODO: Consider using responseWithHeaders here
- return NextResponse.redirect(nextUrl, { headers: requestHeaders });
+
+ const response = NextResponse.redirect(nextUrl);
+ response.cookies.set("return-to", "", {
+ expires: new Date(0),
+ path: "/",
+ });
+
+ return response;
}
}
@@ -108,9 +112,10 @@ const routingForms = {
handleRewrite: (url: URL) => {
// Don't 404 old routing_forms links
if (url.pathname.startsWith("/apps/routing_forms")) {
- url.pathname = url.pathname.replace(/^\/apps\/routing_forms($|\/)/, "/apps/routing-forms/");
+ url.pathname = url.pathname.replace(/^\/apps\/routing_forms($|\/)/, "/routing/");
return NextResponse.rewrite(url);
}
+ return null;
},
};
@@ -168,25 +173,11 @@ export const config = {
"/login",
"/auth/login",
"/future/auth/login",
- /**
- * Paths required by routingForms.handle
- */
- "/apps/routing_forms/:path*",
-
- "/event-types/:path*",
- "/apps/installed/:category/",
- "/future/apps/installed/:category/",
- "/apps/:slug/",
- "/future/apps/:slug/",
- "/apps/:slug/setup/",
- "/future/apps/:slug/setup/",
- "/apps/categories/",
- "/future/apps/categories/",
- "/apps/categories/:category/",
- "/future/apps/categories/:category/",
"/workflows/:path*",
"/getting-started/:path*",
- "/apps",
+ "/event-types/:path*",
+ "/apps/:path*",
+ "/routing/:path*",
"/bookings/:status/",
"/video/:path*",
"/teams",
diff --git a/apps/web/modules/apps/[slug]/[...pages]/pages-view.tsx b/apps/web/modules/apps/[slug]/[...pages]/pages-view.tsx
index 1a1ca5d06fb..464cd901db2 100644
--- a/apps/web/modules/apps/[slug]/[...pages]/pages-view.tsx
+++ b/apps/web/modules/apps/[slug]/[...pages]/pages-view.tsx
@@ -1,6 +1,5 @@
"use client";
-import RoutingFormsRoutingConfig from "@calcom/app-store/routing-forms/pages/app-routing.config";
import TypeformRoutingConfig from "@calcom/app-store/typeform/pages/app-routing.config";
import { useParamsWithFallback } from "@calcom/lib/hooks/useParamsWithFallback";
import type { AppGetServerSideProps } from "@calcom/types/AppGetServerSideProps";
@@ -29,7 +28,6 @@ type NotFound = {
// TODO: It is a candidate for apps.*.generated.*
const AppsRouting = {
- "routing-forms": RoutingFormsRoutingConfig,
typeform: TypeformRoutingConfig,
};
diff --git a/apps/web/modules/apps/[slug]/setup/setup-view.tsx b/apps/web/modules/apps/[slug]/setup/setup-view.tsx
index 921423ce79b..da07c32b8ef 100644
--- a/apps/web/modules/apps/[slug]/setup/setup-view.tsx
+++ b/apps/web/modules/apps/[slug]/setup/setup-view.tsx
@@ -7,7 +7,6 @@ import { AppSetupPage } from "@calcom/app-store/_pages/setup";
import type { getServerSideProps } from "@calcom/app-store/_pages/setup/_getServerSideProps";
import { useCompatSearchParams } from "@calcom/lib/hooks/useCompatSearchParams";
import type { inferSSRProps } from "@calcom/types/inferSSRProps";
-import { HeadSeo } from "@calcom/ui";
export type PageProps = inferSSRProps<typeof getServerSideProps>;
@@ -28,11 +27,5 @@ export default function SetupInformation(props: PageProps) {
router.replace(`/auth/login?${urlSearchParams.toString()}`);
}
- return (
- <>
- {/* So that the set up page does not get indexed by search engines */}
- <HeadSeo nextSeoProps={{ noindex: true, nofollow: true }} title={`${slug} | Cal.com`} description="" />
- <AppSetupPage slug={slug} {...props} />
- </>
- );
+ return <AppSetupPage slug={slug} {...props} />;
}
diff --git a/apps/web/modules/apps/[slug]/slug-view.tsx b/apps/web/modules/apps/[slug]/slug-view.tsx
index 6331f81e401..b0faacc283b 100644
--- a/apps/web/modules/apps/[slug]/slug-view.tsx
+++ b/apps/web/modules/apps/[slug]/slug-view.tsx
@@ -1,7 +1,5 @@
"use client";
-import MarkdownIt from "markdown-it";
-import type { InferGetStaticPropsType } from "next";
import Link from "next/link";
import { IS_PRODUCTION } from "@calcom/lib/constants";
@@ -9,16 +7,12 @@ import { useLocale } from "@calcom/lib/hooks/useLocale";
import { markdownToSafeHTML } from "@calcom/lib/markdownToSafeHTML";
import { showToast } from "@calcom/ui";
-import type { getStaticProps } from "@lib/apps/[slug]/getStaticProps";
+import type { AppDataProps } from "@lib/apps/[slug]/getStaticProps";
import useRouterQuery from "@lib/hooks/useRouterQuery";
import App from "@components/apps/App";
-const md = new MarkdownIt("default", { html: true, breaks: true });
-
-export type PageProps = InferGetStaticPropsType<typeof getStaticProps>;
-
-function SingleAppPage(props: PageProps) {
+function SingleAppPage(props: AppDataProps) {
const { error, setQuery: setError } = useRouterQuery("error");
const { t } = useLocale();
if (error === "account_already_linked") {
diff --git a/apps/web/modules/apps/categories/[category]/category-view.tsx b/apps/web/modules/apps/categories/[category]/category-view.tsx
index 519dca26dc3..c3d1f7990b9 100644
--- a/apps/web/modules/apps/categories/[category]/category-view.tsx
+++ b/apps/web/modules/apps/categories/[category]/category-view.tsx
@@ -1,20 +1,15 @@
"use client";
-import type { InferGetStaticPropsType } from "next";
import Link from "next/link";
import Shell from "@calcom/features/shell/Shell";
-import { useCompatSearchParams } from "@calcom/lib/hooks/useCompatSearchParams";
import { useLocale } from "@calcom/lib/hooks/useLocale";
import { AppCard, SkeletonText } from "@calcom/ui";
-import type { getStaticProps } from "@lib/apps/categories/[category]/getStaticProps";
+import type { CategoryDataProps } from "@lib/apps/categories/[category]/getStaticProps";
-export type PageProps = InferGetStaticPropsType<typeof getStaticProps>;
-export default function Apps({ apps }: PageProps) {
- const searchParams = useCompatSearchParams();
+export default function Apps({ apps, category }: CategoryDataProps) {
const { t, isLocaleReady } = useLocale();
- const category = searchParams?.get("category");
return (
<>
diff --git a/apps/web/modules/apps/installation/[[...step]]/step-view.tsx b/apps/web/modules/apps/installation/[[...step]]/step-view.tsx
index d5937d32518..6245054a032 100644
--- a/apps/web/modules/apps/installation/[[...step]]/step-view.tsx
+++ b/apps/web/modules/apps/installation/[[...step]]/step-view.tsx
@@ -1,6 +1,5 @@
"use client";
-import Head from "next/head";
import { usePathname, useRouter } from "next/navigation";
import { useEffect, useMemo, useRef, useState } from "react";
import { useForm } from "react-hook-form";
@@ -226,12 +225,6 @@ const OnboardingPage = ({
key={pathname}
className="dark:bg-brand dark:text-brand-contrast text-emphasis min-h-screen px-4"
data-testid="onboarding">
- <Head>
- <title>
- {t("install")} {appMetadata?.name ?? ""}
- </title>
- <link rel="icon" href="/favicon.ico" />
- </Head>
<div className="mx-auto py-6 sm:px-4 md:py-24">
<div className="relative">
<div className="sm:mx-auto sm:w-full sm:max-w-[600px]" ref={formPortalRef}>
diff --git a/apps/web/modules/apps/installed/[category]/installed-category-view.tsx b/apps/web/modules/apps/installed/[category]/installed-category-view.tsx
index ba392420aa8..e59480a6dbb 100644
--- a/apps/web/modules/apps/installed/[category]/installed-category-view.tsx
+++ b/apps/web/modules/apps/installed/[category]/installed-category-view.tsx
@@ -8,11 +8,9 @@ import type { UpdateUsersDefaultConferencingAppParams } from "@calcom/features/a
import DisconnectIntegrationModal from "@calcom/features/apps/components/DisconnectIntegrationModal";
import type { RemoveAppParams } from "@calcom/features/apps/components/DisconnectIntegrationModal";
import type { BulkUpdatParams } from "@calcom/features/eventtypes/components/BulkEditDefaultForEventsModal";
-import { useCompatSearchParams } from "@calcom/lib/hooks/useCompatSearchParams";
import { useLocale } from "@calcom/lib/hooks/useLocale";
import { AppCategories } from "@calcom/prisma/enums";
import { trpc } from "@calcom/trpc/react";
-import type { inferSSRProps } from "@calcom/types/inferSSRProps";
import type { Icon } from "@calcom/ui";
import {
AppSkeletonLoader as SkeletonLoader,
@@ -23,7 +21,6 @@ import {
} from "@calcom/ui";
import { QueryCell } from "@lib/QueryCell";
-import type { querySchemaType, getServerSideProps } from "@lib/apps/installed/[category]/getServerSideProps";
import { CalendarListContainer } from "@components/apps/CalendarListContainer";
import InstalledAppsLayout from "@components/apps/layouts/InstalledAppsLayout";
@@ -183,13 +180,13 @@ type ModalState = {
teamId?: number;
};
-export type PageProps = inferSSRProps<typeof getServerSideProps>;
+type PageProps = {
+ category: AppCategories;
+};
-export default function InstalledApps(props: PageProps) {
- const searchParams = useCompatSearchParams();
+export default function InstalledApps({ category }: PageProps) {
const { t } = useLocale();
const utils = trpc.useUtils();
- const category = searchParams?.get("category") as querySchemaType["category"];
const categoryList: AppCategories[] = Object.values(AppCategories).filter((category) => {
// Exclude calendar and other from categoryList, we handle those slightly differently below
return !(category in { other: null, calendar: null });
diff --git a/apps/web/modules/routing/[...pages]/pages-view.tsx b/apps/web/modules/routing/[...pages]/pages-view.tsx
new file mode 100644
index 00000000000..fe95221a1b0
--- /dev/null
+++ b/apps/web/modules/routing/[...pages]/pages-view.tsx
@@ -0,0 +1,76 @@
+"use client";
+
+import { useParams } from "next/navigation";
+
+import RoutingFormsRoutingConfig from "@calcom/app-store/routing-forms/pages/app-routing.config";
+import type { AppGetServerSideProps } from "@calcom/types/AppGetServerSideProps";
+import type { inferSSRProps } from "@calcom/types/inferSSRProps";
+
+import type { AppProps } from "@lib/app-providers";
+import type { getServerSideProps } from "@lib/apps/[slug]/[...pages]/getServerSideProps";
+
+type RoutingPageType = {
+ getServerSideProps: AppGetServerSideProps;
+ // A component than can accept any properties
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
+ default: ((props: any) => JSX.Element) &
+ Pick<AppProps["Component"], "isBookingPage" | "getLayout" | "PageWrapper">;
+};
+
+type Found = {
+ notFound: false;
+ Component: RoutingPageType["default"];
+ getServerSideProps: RoutingPageType["getServerSideProps"];
+};
+
+type NotFound = {
+ notFound: true;
+};
+
+function getRoute(pages: string[]) {
+ const routingConfig = RoutingFormsRoutingConfig as unknown as Record<string, RoutingPageType>;
+ const mainPage = pages[0];
+ const appPage = routingConfig.layoutHandler || (routingConfig[mainPage] as RoutingPageType);
+ if (!appPage) {
+ return {
+ notFound: true,
+ } as NotFound;
+ }
+ return { notFound: false, Component: appPage.default, ...appPage } as Found;
+}
+export type PageProps = inferSSRProps<typeof getServerSideProps>;
+
+const RoutingFormsPage: RoutingPageType["default"] = function RoutingFormsPage(props: PageProps) {
+ const params = useParams();
+ const _pages = params?.pages ?? [];
+ const pages = Array.isArray(_pages) ? _pages : _pages.split("/");
+ const route = getRoute(pages);
+
+ const componentProps = {
+ ...props,
+ pages: pages.slice(1),
+ };
+
+ if (!route || route.notFound) {
+ throw new Error("Route can't be undefined");
+ }
+ return <route.Component {...componentProps} />;
+};
+
+export const getLayout: NonNullable<(typeof RoutingFormsPage)["getLayout"]> = (page) => {
+ // eslint-disable-next-line react-hooks/rules-of-hooks
+ const params = useParams();
+ const _pages = params?.pages ?? [];
+ const pages = Array.isArray(_pages) ? _pages : _pages.split("/");
+ const route = getRoute(pages as string[]);
+
+ if (route.notFound) {
+ return null;
+ }
+ if (!route.Component.getLayout) {
+ return page;
+ }
+ return route.Component.getLayout(page);
+};
+
+export default RoutingFormsPage;
diff --git a/apps/web/next.config.js b/apps/web/next.config.js
index f66a47cedf4..a5e69f50ef7 100644
--- a/apps/web/next.config.js
+++ b/apps/web/next.config.js
@@ -295,7 +295,7 @@ const nextConfig = {
const beforeFiles = [
{
source: "/forms/:formQuery*",
- destination: "/apps/routing-forms/routing-link/:formQuery*",
+ destination: "/routing/routing-link/:formQuery*",
},
{
source: "/success/:path*",
diff --git a/apps/web/pages/apps/[slug]/[...pages].tsx b/apps/web/pages/apps/[slug]/[...pages].tsx
deleted file mode 100644
index 6de4cdfd96f..00000000000
--- a/apps/web/pages/apps/[slug]/[...pages].tsx
+++ /dev/null
@@ -1,15 +0,0 @@
-import { getServerSideProps } from "@lib/apps/[slug]/[...pages]/getServerSideProps";
-
-import PageWrapper from "@components/PageWrapper";
-
-import type { PageProps } from "~/apps/[slug]/[...pages]/pages-view";
-import PagesView, { getLayout } from "~/apps/[slug]/[...pages]/pages-view";
-
-const Page = (props: PageProps) => <PagesView {...props} />;
-
-Page.PageWrapper = PageWrapper;
-Page.getLayout = getLayout;
-
-export { getServerSideProps };
-
-export default Page;
diff --git a/apps/web/pages/apps/[slug]/index.tsx b/apps/web/pages/apps/[slug]/index.tsx
deleted file mode 100644
index b3419ceb9b9..00000000000
--- a/apps/web/pages/apps/[slug]/index.tsx
+++ /dev/null
@@ -1,39 +0,0 @@
-import { Prisma } from "@prisma/client";
-import type { GetStaticPaths } from "next";
-
-import { AppRepository } from "@calcom/lib/server/repository/app";
-
-import { getStaticProps } from "@lib/apps/[slug]/getStaticProps";
-
-import PageWrapper from "@components/PageWrapper";
-
-import type { PageProps } from "~/apps/[slug]/slug-view";
-import SingleAppPage from "~/apps/[slug]/slug-view";
-
-const Page = (props: PageProps) => <SingleAppPage {...props} />;
-
-export const getStaticPaths: GetStaticPaths<{ slug: string }> = async () => {
- let paths: { params: { slug: string } }[] = [];
-
- try {
- const appStore = await AppRepository.findAppStore();
- paths = appStore.map(({ slug }) => ({ params: { slug } }));
- } catch (e: unknown) {
- if (e instanceof Prisma.PrismaClientInitializationError) {
- // Database is not available at build time, but that's ok – we fall back to resolving paths on demand
- } else {
- throw e;
- }
- }
-
- return {
- paths,
- fallback: "blocking",
- };
-};
-
-export { getStaticProps };
-
-Page.PageWrapper = PageWrapper;
-
-export default Page;
diff --git a/apps/web/pages/apps/[slug]/setup.tsx b/apps/web/pages/apps/[slug]/setup.tsx
deleted file mode 100644
index 625040aa7aa..00000000000
--- a/apps/web/pages/apps/[slug]/setup.tsx
+++ /dev/null
@@ -1,14 +0,0 @@
-import { getServerSideProps } from "@calcom/app-store/_pages/setup/_getServerSideProps";
-
-import PageWrapper from "@components/PageWrapper";
-
-import type { PageProps } from "~/apps/[slug]/setup/setup-view";
-import SetupView from "~/apps/[slug]/setup/setup-view";
-
-const Page = (props: PageProps) => <SetupView {...props} />;
-
-Page.PageWrapper = PageWrapper;
-
-export { getServerSideProps };
-
-export default Page;
diff --git a/apps/web/pages/apps/categories/[category].tsx b/apps/web/pages/apps/categories/[category].tsx
deleted file mode 100644
index 7c1a1a39d6c..00000000000
--- a/apps/web/pages/apps/categories/[category].tsx
+++ /dev/null
@@ -1,33 +0,0 @@
-import { AppCategories } from "@calcom/prisma/enums";
-import { isPrismaAvailableCheck } from "@calcom/prisma/is-prisma-available-check";
-
-import { getStaticProps } from "@lib/apps/categories/[category]/getStaticProps";
-
-import PageWrapper from "@components/PageWrapper";
-
-import type { PageProps } from "~/apps/categories/[category]/category-view";
-import CategoryView from "~/apps/categories/[category]/category-view";
-
-const Page = (props: PageProps) => <CategoryView {...props} />;
-Page.PageWrapper = PageWrapper;
-
-export const getStaticPaths = async () => {
- const paths = Object.keys(AppCategories);
- const isPrismaAvailable = await isPrismaAvailableCheck();
- if (!isPrismaAvailable) {
- // Database is not available at build time. Make sure we fall back to building these pages on demand
- return {
- paths: [],
- fallback: "blocking",
- };
- }
-
- return {
- paths: paths.map((category) => ({ params: { category } })),
- fallback: false,
- };
-};
-
-export default Page;
-
-export { getStaticProps };
diff --git a/apps/web/pages/apps/categories/index.tsx b/apps/web/pages/apps/categories/index.tsx
deleted file mode 100644
index 54c738a5c9c..00000000000
--- a/apps/web/pages/apps/categories/index.tsx
+++ /dev/null
@@ -1,12 +0,0 @@
-import { getServerSideProps } from "@lib/apps/categories/getServerSideProps";
-
-import PageWrapper from "@components/PageWrapper";
-
-import type { PageProps } from "~/apps/categories/categories-view";
-import Apps from "~/apps/categories/categories-view";
-
-const Page = (props: PageProps) => <Apps {...props} />;
-Page.PageWrapper = PageWrapper;
-
-export default Page;
-export { getServerSideProps };
diff --git a/apps/web/pages/apps/installation/[[...step]].tsx b/apps/web/pages/apps/installation/[[...step]].tsx
deleted file mode 100644
index d50152f1be9..00000000000
--- a/apps/web/pages/apps/installation/[[...step]].tsx
+++ /dev/null
@@ -1,12 +0,0 @@
-import PageWrapper from "@components/PageWrapper";
-
-import type { OnboardingPageProps } from "~/apps/installation/[[...step]]/step-view";
-import StepView from "~/apps/installation/[[...step]]/step-view";
-
-const Page = (props: OnboardingPageProps) => <StepView {...props} />;
-
-Page.PageWrapper = PageWrapper;
-
-export { getServerSideProps } from "@lib/apps/installation/[[...step]]/getServerSideProps";
-
-export default Page;
diff --git a/apps/web/pages/apps/installed/[category].tsx b/apps/web/pages/apps/installed/[category].tsx
deleted file mode 100644
index 7a8e670ce1e..00000000000
--- a/apps/web/pages/apps/installed/[category].tsx
+++ /dev/null
@@ -1,12 +0,0 @@
-import PageWrapper from "@components/PageWrapper";
-
-import type { PageProps } from "~/apps/installed/[category]/installed-category-view";
-import InstalledApps from "~/apps/installed/[category]/installed-category-view";
-
-const Page = (props: PageProps) => <InstalledApps {...props} />;
-
-Page.PageWrapper = PageWrapper;
-
-export { getServerSideProps } from "@lib/apps/installed/[category]/getServerSideProps";
-
-export default Page;
diff --git a/apps/web/pages/apps/installed/index.tsx b/apps/web/pages/apps/installed/index.tsx
deleted file mode 100644
index 02786d55a89..00000000000
--- a/apps/web/pages/apps/installed/index.tsx
+++ /dev/null
@@ -1,7 +0,0 @@
-export { getServerSideProps } from "@lib/apps/installed/getServerSideProps";
-
-function RedirectPage() {
- return;
-}
-
-export default RedirectPage;
diff --git a/apps/web/pages/routing-forms/[...pages].tsx b/apps/web/pages/routing-forms/[...pages].tsx
deleted file mode 100644
index 13576b185aa..00000000000
--- a/apps/web/pages/routing-forms/[...pages].tsx
+++ /dev/null
@@ -1,25 +0,0 @@
-import type { GetServerSidePropsContext } from "next";
-import z from "zod";
-
-const paramsSchema = z
- .object({
- pages: z.array(z.string()),
- })
- .catch({
- pages: [],
- });
-
-export default function RoutingForms() {
- return null;
-}
-
-export const getServerSideProps = (context: GetServerSidePropsContext) => {
- const { pages } = paramsSchema.parse(context.params);
-
- return {
- redirect: {
- destination: `/apps/routing-forms/${pages.length ? pages.join("/") : ""}`,
- permanent: false,
- },
- };
-};
diff --git a/apps/web/pages/routing-forms/index.tsx b/apps/web/pages/routing-forms/index.tsx
deleted file mode 100644
index c2032de1ddc..00000000000
--- a/apps/web/pages/routing-forms/index.tsx
+++ /dev/null
@@ -1,12 +0,0 @@
-export default function RoutingFormsIndex() {
- return null;
-}
-
-export const getServerSideProps = () => {
- return {
- redirect: {
- destination: `/apps/routing-forms/forms`,
- permanent: false,
- },
- };
-};
diff --git a/apps/web/public/icons/sprite.svg b/apps/web/public/icons/sprite.svg
index 36cf696c717..23e31196942 100644
--- a/apps/web/public/icons/sprite.svg
+++ b/apps/web/public/icons/sprite.svg
@@ -570,6 +570,12 @@
<path d="M4 17v2" ></path>
<path d="M5 18H3" ></path>
</symbol>
+<symbol class="lucide lucide-split" viewBox="0 0 24 24" fill="inherit" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" id="split">
+ <path d="M16 3h5v5" ></path>
+ <path d="M8 3H3v5" ></path>
+ <path d="M12 22v-8.3a4 4 0 0 0-1.172-2.872L3 3" ></path>
+ <path d="m15 9 6-6" ></path>
+</symbol>
<symbol class="lucide lucide-square-check" viewBox="0 0 24 24" fill="inherit" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" id="square-check">
<rect width="18" height="18" x="3" y="3" rx="2" ></rect>
<path d="m9 12 2 2 4-4" ></path>
diff --git a/apps/web/scripts/vercel-app-router-deploy.sh b/apps/web/scripts/vercel-app-router-deploy.sh
index ec1256da7fa..8f1a6ab423e 100755
--- a/apps/web/scripts/vercel-app-router-deploy.sh
+++ b/apps/web/scripts/vercel-app-router-deploy.sh
@@ -6,11 +6,6 @@ checkRoute () {
# These conditionals are used to remove directories from the build that are not needed in production
# This is to reduce the size of the build and prevent OOM errors
-checkRoute "$APP_ROUTER_APPS_INSTALLED_CATEGORY_ENABLED" app/future/apps/installed
-checkRoute "$APP_ROUTER_APPS_SLUG_ENABLED" app/future/apps/\[slug\]
-checkRoute "$APP_ROUTER_APPS_SLUG_SETUP_ENABLED" app/future/apps/\[slug\]/setup
-checkRoute "$APP_ROUTER_APPS_CATEGORIES_ENABLED" app/future/apps/categories
-checkRoute "$APP_ROUTER_APPS_CATEGORIES_CATEGORY_ENABLED" app/future/apps/categories/\[category\]
checkRoute "$APP_ROUTER_AUTH_FORGOT_PASSWORD_ENABLED" app/future/auth/forgot-password
checkRoute "$APP_ROUTER_AUTH_LOGIN_ENABLED" app/future/auth/login
checkRoute "$APP_ROUTER_AUTH_LOGOUT_ENABLED" app/future/auth/logout
diff --git a/packages/app-store/routing-forms/api/add.ts b/packages/app-store/routing-forms/api/add.ts
index 5037d705716..2b9eac638f0 100644
--- a/packages/app-store/routing-forms/api/add.ts
+++ b/packages/app-store/routing-forms/api/add.ts
@@ -20,7 +20,7 @@ const handler: AppDeclarativeHandler = {
});
},
redirect: {
- url: "/apps/routing-forms/forms",
+ url: "/routing/forms",
},
};
diff --git a/packages/app-store/routing-forms/config.json b/packages/app-store/routing-forms/config.json
index 22eacf80976..60e420affe1 100644
--- a/packages/app-store/routing-forms/config.json
+++ b/packages/app-store/routing-forms/config.json
@@ -10,7 +10,7 @@
"variant": "other",
"categories": ["automation"],
"publisher": "Cal.com, Inc.",
- "simplePath": "/apps/routing-forms",
+ "simplePath": "/routing",
"email": "[email protected]",
"licenseRequired": true,
"teamsPlanRequired": {
diff --git a/packages/app-store/routing-forms/pages/app-routing-server.config.ts b/packages/app-store/routing-forms/pages/app-routing-server.config.ts
new file mode 100644
index 00000000000..e0a85fdb751
--- /dev/null
+++ b/packages/app-store/routing-forms/pages/app-routing-server.config.ts
@@ -0,0 +1,13 @@
+import type { AppGetServerSideProps } from "@calcom/types/AppGetServerSideProps";
+
+import { getServerSidePropsForSingleFormView as getServerSidePropsSingleForm } from "../components/getServerSidePropsSingleForm";
+import { getServerSideProps as getServerSidePropsForms } from "./forms/getServerSideProps";
+import { getServerSideProps as getServerSidePropsRoutingLink } from "./routing-link/getServerSideProps";
+
+export const routingServerSidePropsConfig: Record<string, AppGetServerSideProps> = {
+ forms: getServerSidePropsForms,
+ "form-edit": getServerSidePropsSingleForm,
+ "route-builder": getServerSidePropsSingleForm,
+ "routing-link": getServerSidePropsRoutingLink,
+ reporting: getServerSidePropsSingleForm,
+};
diff --git a/packages/app-store/routing-forms/pages/app-routing.config.tsx b/packages/app-store/routing-forms/pages/app-routing.config.tsx
index 0c4d5817461..65749ef1936 100644
--- a/packages/app-store/routing-forms/pages/app-routing.config.tsx
+++ b/packages/app-store/routing-forms/pages/app-routing.config.tsx
@@ -1,16 +1,10 @@
//TODO: Generate this file automatically so that like in Next.js file based routing can work automatically
-import type { AppGetServerSideProps } from "@calcom/types/AppGetServerSideProps";
-
-import { getServerSidePropsForSingleFormView as getServerSidePropsSingleForm } from "../components/getServerSidePropsSingleForm";
import * as formEdit from "./form-edit/[...appPages]";
import * as forms from "./forms/[...appPages]";
-// extracts getServerSideProps function from the client component
-import { getServerSideProps as getServerSidePropsForms } from "./forms/getServerSideProps";
import * as LayoutHandler from "./layout-handler/[...appPages]";
import * as Reporting from "./reporting/[...appPages]";
import * as RouteBuilder from "./route-builder/[...appPages]";
import * as RoutingLink from "./routing-link/[...appPages]";
-import { getServerSideProps as getServerSidePropsRoutingLink } from "./routing-link/getServerSideProps";
const routingConfig = {
"form-edit": formEdit,
@@ -21,12 +15,4 @@ const routingConfig = {
layoutHandler: LayoutHandler,
};
-export const serverSidePropsConfig: Record<string, AppGetServerSideProps> = {
- forms: getServerSidePropsForms,
- "form-edit": getServerSidePropsSingleForm,
- "route-builder": getServerSidePropsSingleForm,
- "routing-link": getServerSidePropsRoutingLink,
- reporting: getServerSidePropsSingleForm,
-};
-
export default routingConfig;
diff --git a/packages/app-store/routing-forms/pages/form-edit/[...appPages].tsx b/packages/app-store/routing-forms/pages/form-edit/[...appPages].tsx
index 2aa2e63f431..b164fcd0710 100644
--- a/packages/app-store/routing-forms/pages/form-edit/[...appPages].tsx
+++ b/packages/app-store/routing-forms/pages/form-edit/[...appPages].tsx
@@ -481,9 +481,5 @@ export default function FormEditPage({
}
FormEditPage.getLayout = (page: React.ReactElement) => {
- return (
- <Shell backPath="/apps/routing-forms/forms" withoutMain={true}>
- {page}
- </Shell>
- );
+ return <Shell withoutMain={true}>{page}</Shell>;
};
diff --git a/packages/app-store/routing-forms/pages/reporting/[...appPages].tsx b/packages/app-store/routing-forms/pages/reporting/[...appPages].tsx
index 855cdeef798..4838b4a1674 100644
--- a/packages/app-store/routing-forms/pages/reporting/[...appPages].tsx
+++ b/packages/app-store/routing-forms/pages/reporting/[...appPages].tsx
@@ -293,9 +293,5 @@ export default function ReporterWrapper({
}
ReporterWrapper.getLayout = (page: React.ReactElement) => {
- return (
- <Shell backPath="/apps/routing-forms/forms" withoutMain={true}>
- {page}
- </Shell>
- );
+ return <Shell withoutMain={true}>{page}</Shell>;
};
diff --git a/packages/app-store/routing-forms/pages/route-builder/[...appPages].tsx b/packages/app-store/routing-forms/pages/route-builder/[...appPages].tsx
index d3f6935295d..068fb20522e 100644
--- a/packages/app-store/routing-forms/pages/route-builder/[...appPages].tsx
+++ b/packages/app-store/routing-forms/pages/route-builder/[...appPages].tsx
@@ -1092,11 +1092,7 @@ export default function RouteBuilder({
}
RouteBuilder.getLayout = (page: React.ReactElement) => {
- return (
- <Shell backPath="/apps/routing-forms/forms" withoutMain={true}>
- {page}
- </Shell>
- );
+ return <Shell withoutMain={true}>{page}</Shell>;
};
export { getServerSideProps };
diff --git a/packages/app-store/routing-forms/pages/routing-link/[...appPages].tsx b/packages/app-store/routing-forms/pages/routing-link/[...appPages].tsx
index 17b5a572dd2..2a6661a77e5 100644
--- a/packages/app-store/routing-forms/pages/routing-link/[...appPages].tsx
+++ b/packages/app-store/routing-forms/pages/routing-link/[...appPages].tsx
@@ -1,6 +1,5 @@
"use client";
-import Head from "next/head";
import { useRouter } from "next/navigation";
import type { FormEvent } from "react";
import { useEffect, useRef, useState } from "react";
@@ -160,9 +159,6 @@ function RoutingForm({ form, profile, ...restProps }: Props) {
<div>
{!customPageMessage ? (
<>
- <Head>
- <title>{`${form.name} | Cal.com Forms`}</title>
- </Head>
<div className={classNames("mx-auto my-0 max-w-3xl", isEmbed ? "" : "md:my-24")}>
<div className="w-full max-w-4xl ltr:mr-2 rtl:ml-2">
<div className="main border-booker md:border-booker-width dark:bg-muted bg-default mx-0 rounded-md p-4 py-6 sm:-mx-4 sm:px-8 ">
diff --git a/packages/app-store/routing-forms/pages/routing-link/getServerSideProps.ts b/packages/app-store/routing-forms/pages/routing-link/getServerSideProps.ts
index a0671d861e1..f17ef544de1 100644
--- a/packages/app-store/routing-forms/pages/routing-link/getServerSideProps.ts
+++ b/packages/app-store/routing-forms/pages/routing-link/getServerSideProps.ts
@@ -24,9 +24,6 @@ export const getServerSideProps = async function getServerSideProps(
const { currentOrgDomain } = orgDomainConfig(context.req);
const isEmbed = params.appPages[1] === "embed";
- if (context.query["flag.coep"] === "true") {
- context.res.setHeader("Cross-Origin-Embedder-Policy", "require-corp");
- }
const form = await prisma.app_RoutingForms_Form.findFirst({
where: {
diff --git a/packages/app-store/routing-forms/playwright/tests/basic.e2e.ts b/packages/app-store/routing-forms/playwright/tests/basic.e2e.ts
index ce421eee545..0599c12bb4f 100644
--- a/packages/app-store/routing-forms/playwright/tests/basic.e2e.ts
+++ b/packages/app-store/routing-forms/playwright/tests/basic.e2e.ts
@@ -93,7 +93,7 @@ test.describe("Routing Forms", () => {
await gotoRoutingLink({ page, formId });
await expect(page.locator("text=Test Form Name")).toBeVisible();
- await page.goto(`apps/routing-forms/route-builder/${formId}`);
+ await page.goto(`routing/route-builder/${formId}`);
await disableForm(page);
await gotoRoutingLink({ page, formId });
await expect(page.getByTestId(`404-page`)).toBeVisible();
@@ -101,12 +101,12 @@ test.describe("Routing Forms", () => {
test("recently added form appears first in the list", async ({ page }) => {
await addForm(page, { name: "Test Form 1" });
- await page.goto(`apps/routing-forms/forms`);
+ await page.goto(`routing/forms`);
await page.waitForSelector('[data-testid="routing-forms-list"]');
await expect(page.locator('[data-testid="routing-forms-list"] > div h1')).toHaveCount(1);
await addForm(page, { name: "Test Form 2" });
- await page.goto(`apps/routing-forms/forms`);
+ await page.goto(`routing/forms`);
await page.waitForSelector('[data-testid="routing-forms-list"]');
await expect(page.locator('[data-testid="routing-forms-list"] > div h1')).toHaveCount(2);
@@ -351,7 +351,7 @@ test.describe("Routing Forms", () => {
["event-routing", "Option-2", "Option-2", "Option-2", "Option-2", "", "", "", expect.any(String)],
]);
- await page.goto(`apps/routing-forms/route-builder/${routingForm.id}`);
+ await page.goto(`routing/route-builder/${routingForm.id}`);
const [download] = await Promise.all([
// Start waiting for the download
page.waitForEvent("download"),
@@ -446,7 +446,7 @@ test.describe("Routing Forms", () => {
test("Test preview should return correct route", async ({ page, users }) => {
const user = await createUserAndLogin({ users, page });
const routingForm = user.routingForms[0];
- await page.goto(`apps/routing-forms/form-edit/${routingForm.id}`);
+ await page.goto(`routing/form-edit/${routingForm.id}`);
await page.click('[data-testid="test-preview"]');
//event redirect
@@ -696,7 +696,7 @@ async function addAllTypesOfFieldsAndSaveForm(
page: Page,
form: { description: string; label: string }
) {
- await page.goto(`apps/routing-forms/form-edit/${formId}`);
+ await page.goto(`routing/form-edit/${formId}`);
await page.click('[data-testid="add-field"]');
await page.fill('[data-testid="description"]', form.description);
@@ -752,7 +752,7 @@ async function addAllTypesOfFieldsAndSaveForm(
}
async function addShortTextFieldAndSaveForm({ page, formId }: { page: Page; formId: string }) {
- await page.goto(`apps/routing-forms/form-edit/${formId}`);
+ await page.goto(`routing/form-edit/${formId}`);
await page.click('[data-testid="add-field"]');
await page.locator(".data-testid-field-type").nth(0).click();
await page.fill(`[name="fields.0.label"]`, "Short Text");
diff --git a/packages/app-store/routing-forms/playwright/tests/testUtils.ts b/packages/app-store/routing-forms/playwright/tests/testUtils.ts
index 7f86e19721c..1c576978d46 100644
--- a/packages/app-store/routing-forms/playwright/tests/testUtils.ts
+++ b/packages/app-store/routing-forms/playwright/tests/testUtils.ts
@@ -36,7 +36,7 @@ export async function addOneFieldAndDescriptionAndSaveForm(
page: Page,
form: { description?: string; field?: { typeIndex: number; label: string } }
) {
- await page.goto(`apps/routing-forms/form-edit/${formId}`);
+ await page.goto(`routing/form-edit/${formId}`);
await page.click('[data-testid="add-field"]');
if (form.description) {
await page.fill('[data-testid="description"]', form.description);
diff --git a/packages/app-store/typeform/pages/how-to-use/[...appPages].tsx b/packages/app-store/typeform/pages/how-to-use/[...appPages].tsx
index c4fd176dc38..ac486b340fc 100644
--- a/packages/app-store/typeform/pages/how-to-use/[...appPages].tsx
+++ b/packages/app-store/typeform/pages/how-to-use/[...appPages].tsx
@@ -17,7 +17,7 @@ export default function HowToUse() {
<ol className="mb-5 ml-5 mt-5 list-decimal ltr:mr-5 rtl:ml-5">
<li>
Make sure that you have{" "}
- <Link href="/apps/routing-forms" className="text-subtle text-base">
+ <Link href="/routing" className="text-subtle text-base">
Routing Forms
</Link>{" "}
app installed
diff --git a/packages/features/shell/Shell.tsx b/packages/features/shell/Shell.tsx
index 4094e515e30..2dc91844821 100644
--- a/packages/features/shell/Shell.tsx
+++ b/packages/features/shell/Shell.tsx
@@ -25,7 +25,7 @@ import { useAppTheme } from "./useAppTheme";
const Layout = (props: LayoutProps) => {
const { banners, bannersHeight } = useBanners();
const pathname = usePathname();
- const isFullPageWithoutSidebar = pathname?.startsWith("/apps/routing-forms/reporting/");
+ const isFullPageWithoutSidebar = pathname?.startsWith("/routing/reporting/");
const pageTitle = typeof props.heading === "string" && !props.title ? props.heading : props.title;
const withoutSeo = props.withoutSeo ?? props.withoutMain ?? false;
@@ -138,23 +138,26 @@ export function ShellMain(props: LayoutProps) {
const { buttonToShow, isLoading, enableNotifications, disableNotifications } = useNotifications();
+ const backPath = props.backPath;
+ // Replace multiple leading slashes with a single slash
+ // e.g., `//routing/forms` -> `/routing/forms`
+ const validBackPath = typeof backPath === "string" ? backPath.replace(/^\/+/, "/") : null;
+
return (
<>
- {(props.heading || !!props.backPath) && (
+ {(props.heading || !!backPath) && (
<div
className={classNames(
"flex items-center md:mb-6 md:mt-0",
props.smallHeading ? "lg:mb-7" : "lg:mb-8",
props.hideHeadingOnMobile ? "mb-0" : "mb-6"
)}>
- {!!props.backPath && (
+ {!!backPath && (
<Button
variant="icon"
size="sm"
color="minimal"
- onClick={() =>
- typeof props.backPath === "string" ? router.push(props.backPath as string) : router.back()
- }
+ onClick={() => (validBackPath ? router.push(validBackPath) : router.back())}
StartIcon="arrow-left"
aria-label="Go Back"
className="rounded-md ltr:mr-2 rtl:ml-2"
diff --git a/packages/features/shell/navigation/Navigation.tsx b/packages/features/shell/navigation/Navigation.tsx
index 385cc0f0912..cebf81f6b19 100644
--- a/packages/features/shell/navigation/Navigation.tsx
+++ b/packages/features/shell/navigation/Navigation.tsx
@@ -87,10 +87,10 @@ const getNavigationItems = (orgBranding: OrganizationBranding): NavigationItemTy
icon: "ellipsis",
},
{
- name: "routing_forms",
- href: "/apps/routing-forms/forms",
- icon: "file-text",
- isCurrent: ({ pathname }) => pathname?.startsWith("/apps/routing-forms/") ?? false,
+ name: "routing",
+ href: "/routing/forms",
+ icon: "split",
+ isCurrent: ({ pathname }) => pathname?.startsWith("/routing/forms") ?? false,
moreOnMobile: true,
},
{
diff --git a/packages/types/App.d.ts b/packages/types/App.d.ts
index 62b14dcc890..9e315fe48a0 100644
--- a/packages/types/App.d.ts
+++ b/packages/types/App.d.ts
@@ -131,7 +131,7 @@ export interface App {
isGlobal?: boolean;
/**
* For apps that are accessible on an alternate URL(which is simpler and shorter), this can be set.
- * e.g. Routing Forms App is available as /routing-forms in addition to regular /apps/routing-forms.
+ * e.g. Routing Forms App is available as /routing-forms in addition to regular /routing.
*/
simplePath?: string;
/** A contact email, mainly to ask for support */
diff --git a/packages/ui/components/head-seo/head-seo.test.tsx b/packages/ui/components/head-seo/head-seo.test.tsx
index 54f283729b6..7d163fda487 100644
--- a/packages/ui/components/head-seo/head-seo.test.tsx
+++ b/packages/ui/components/head-seo/head-seo.test.tsx
@@ -39,9 +39,6 @@ vi.mock("next-seo", () => {
vi.mock("@calcom/lib/OgImages", async () => {
return {
- constructAppImage() {
- return "constructAppImage";
- },
constructGenericImage() {
return "constructGenericImage";
},
@@ -142,14 +139,6 @@ describe("Tests for HeadSeo component", () => {
});
});
- test("Should render with app props", async () => {
- const { container } = render(<HeadSeo {...basicProps} app={{} as HeadSeoProps["app"]} />);
- await waitFor(async () => {
- const mockedNextSeoEl = container.querySelector("#mocked-next-seo");
- expect(mockedNextSeoEl?.getAttribute("image")).toContain("constructAppImage");
- });
- });
-
test("Should render with meeting props", async () => {
const { container } = render(<HeadSeo {...basicProps} meeting={{} as HeadSeoProps["meeting"]} />);
await waitFor(async () => {
diff --git a/packages/ui/components/icon/icon-list.mjs b/packages/ui/components/icon/icon-list.mjs
index 55cbdfa5ed0..340bce40f33 100644
--- a/packages/ui/components/icon/icon-list.mjs
+++ b/packages/ui/components/icon/icon-list.mjs
@@ -117,6 +117,7 @@ export const lucideIconList = new Set([
"sliders-vertical",
"smartphone",
"sparkles",
+ "split",
"square-check",
"star",
"sun",
diff --git a/packages/ui/components/icon/icon-names.ts b/packages/ui/components/icon/icon-names.ts
index 9ffbbd5bcb0..993400acb6a 100644
--- a/packages/ui/components/icon/icon-names.ts
+++ b/packages/ui/components/icon/icon-names.ts
@@ -117,6 +117,7 @@ export type IconName =
| "sliders-vertical"
| "smartphone"
| "sparkles"
+ | "split"
| "square-check"
| "star"
| "sun"
diff --git a/turbo.json b/turbo.json
index 4eb207223a4..dffae485947 100644
--- a/turbo.json
+++ b/turbo.json
@@ -238,11 +238,6 @@
"ALLOWED_HOSTNAMES",
"ANALYZE",
"API_KEY_PREFIX",
- "APP_ROUTER_APPS_CATEGORIES_CATEGORY_ENABLED",
- "APP_ROUTER_APPS_CATEGORIES_ENABLED",
- "APP_ROUTER_APPS_INSTALLED_CATEGORY_ENABLED",
- "APP_ROUTER_APPS_SLUG_ENABLED",
- "APP_ROUTER_APPS_SLUG_SETUP_ENABLED",
"APP_ROUTER_AUTH_FORGOT_PASSWORD_ENABLED",
"APP_ROUTER_AUTH_LOGIN_ENABLED",
"APP_ROUTER_AUTH_LOGOUT_ENABLED",