diff --git a/.env.example b/.env.example
index 616c7d2b54..124aac0ff8 100644
--- a/.env.example
+++ b/.env.example
@@ -361,7 +361,6 @@ APP_ROUTER_GETTING_STARTED_STEP_ENABLED=0
APP_ROUTER_APPS_ENABLED=0
APP_ROUTER_TEAM_ENABLED=0
APP_ROUTER_TEAMS_ENABLED=0
-APP_ROUTER_AVAILABILITY_ENABLED=0
APP_ROUTER_AUTH_FORGOT_PASSWORD_ENABLED=0
APP_ROUTER_AUTH_LOGIN_ENABLED=0
APP_ROUTER_AUTH_LOGOUT_ENABLED=0
diff --git a/apps/web/abTest/middlewareFactory.ts b/apps/web/abTest/middlewareFactory.ts
index 1c92e05dd2..e3555464be 100644
--- a/apps/web/abTest/middlewareFactory.ts
+++ b/apps/web/abTest/middlewareFactory.ts
@@ -25,7 +25,6 @@ const ROUTES: [URLPattern, boolean][] = [
["/booking/:path*", process.env.APP_ROUTER_BOOKING_ENABLED === "1"] as const,
["/team", process.env.APP_ROUTER_TEAM_ENABLED === "1"] as const,
["/teams", process.env.APP_ROUTER_TEAMS_ENABLED === "1"] as const,
- ["/availability", process.env.APP_ROUTER_AVAILABILITY_ENABLED === "1"] as const,
].map(([pathname, enabled]) => [
new URLPattern({
pathname,
diff --git a/apps/web/app/availability/[schedule]/page.tsx b/apps/web/app/availability/[schedule]/page.tsx
new file mode 100644
index 0000000000..bdeef24588
--- /dev/null
+++ b/apps/web/app/availability/[schedule]/page.tsx
@@ -0,0 +1,92 @@
+import type { PageProps } from "app/_types";
+import { _generateMetadata } from "app/_utils";
+import { WithLayout } from "app/layoutHOC";
+import { notFound } from "next/navigation";
+import { cache } from "react";
+import { z } from "zod";
+
+// import { getServerSessionForAppDir } from "@calcom/feature-auth/lib/get-server-session-for-app-dir";
+import { ScheduleRepository } from "@calcom/lib/server/repository/schedule";
+
+// import { TravelScheduleRepository } from "@calcom/lib/server/repository/travelSchedule";
+// import { UserRepository } from "@calcom/lib/server/repository/user";
+import { AvailabilitySettingsWebWrapper } from "~/availability/[schedule]/schedule-view";
+
+const querySchema = z.object({
+ schedule: z
+ .string()
+ .refine((val) => !isNaN(Number(val)), {
+ message: "schedule must be a string that can be cast to a number",
+ })
+ .transform((val) => Number(val)),
+});
+
+const getSchedule = cache((id: number) => ScheduleRepository.findScheduleById({ id }));
+
+export const generateMetadata = async ({ params, searchParams }: PageProps) => {
+ const parsed = querySchema.safeParse({ ...params, ...searchParams });
+ if (!parsed.success) {
+ notFound();
+ }
+
+ const schedule = await getSchedule(parsed.data.schedule);
+
+ if (!schedule) {
+ notFound();
+ }
+
+ return await _generateMetadata(
+ (t) => (schedule.name ? `${schedule.name} | ${t("availability")}` : t("availability")),
+ () => ""
+ );
+};
+
+const Page = async ({ params, searchParams }: PageProps) => {
+ const parsed = querySchema.safeParse({ ...params, ...searchParams });
+ if (!parsed.success) {
+ notFound();
+ }
+ // const scheduleId = Number(params.schedule);
+
+ // const session = await getServerSessionForAppDir();
+ // const userId = session?.user?.id;
+ // if (!userId) {
+ // notFound();
+ // }
+
+ // let userData, schedule, travelSchedules;
+
+ // try {
+ // userData = await UserRepository.getTimeZoneAndDefaultScheduleId({
+ // userId,
+ // });
+ // if (!userData?.timeZone || !userData?.defaultScheduleId) {
+ // throw new Error("timeZone and defaultScheduleId not found");
+ // }
+ // } catch (e) {
+ // notFound();
+ // }
+
+ // try {
+ // schedule = await ScheduleRepository.findDetailedScheduleById({
+ // scheduleId,
+ // isManagedEventType: false,
+ // userId,
+ // timeZone: userData.timeZone,
+ // defaultScheduleId: userData.defaultScheduleId,
+ // });
+ // } catch (e) {}
+
+ // try {
+ // travelSchedules = await TravelScheduleRepository.findTravelSchedulesByUserId(userId);
+ // } catch (e) {}
+
+ return (
+
+ );
+};
+
+export default WithLayout({ ServerPage: Page });
diff --git a/apps/web/app/availability/page.tsx b/apps/web/app/availability/page.tsx
new file mode 100644
index 0000000000..e32e6e2b26
--- /dev/null
+++ b/apps/web/app/availability/page.tsx
@@ -0,0 +1,39 @@
+import { _generateMetadata } from "app/_utils";
+import { WithLayout } from "app/layoutHOC";
+import { notFound } from "next/navigation";
+
+// import { getServerSessionForAppDir } from "@calcom/feature-auth/lib/get-server-session-for-app-dir";
+// import { OrganizationRepository } from "@calcom/lib/server/repository/organization";
+import AvailabilityPage from "~/availability/availability-view";
+
+export const generateMetadata = async () => {
+ return await _generateMetadata(
+ (t) => t("availability"),
+ (t) => t("configure_availability")
+ );
+};
+
+const Page = async () => {
+ // const session = await getServerSessionForAppDir();
+ // const userId = session?.user?.id;
+ // const orgId = session?.user?.org?.id;
+ // if (!userId || !orgId) {
+ // notFound();
+ // }
+
+ try {
+ // const currentOrg = await OrganizationRepository.findCurrentOrg({
+ // orgId,
+ // userId,
+ // });
+ return (
+
+ );
+ } catch {
+ notFound();
+ }
+};
+
+export default WithLayout({ ServerPage: Page });
diff --git a/apps/web/app/future/availability/troubleshoot/page.tsx b/apps/web/app/availability/troubleshoot/page.tsx
similarity index 100%
rename from apps/web/app/future/availability/troubleshoot/page.tsx
rename to apps/web/app/availability/troubleshoot/page.tsx
diff --git a/apps/web/app/future/availability/[schedule]/page.tsx b/apps/web/app/future/availability/[schedule]/page.tsx
deleted file mode 100644
index 2c4fb1382e..0000000000
--- a/apps/web/app/future/availability/[schedule]/page.tsx
+++ /dev/null
@@ -1,72 +0,0 @@
-import type { PageProps } from "app/_types";
-import { _generateMetadata } from "app/_utils";
-import { WithLayout } from "app/layoutHOC";
-import { notFound } from "next/navigation";
-
-import { getServerSessionForAppDir } from "@calcom/feature-auth/lib/get-server-session-for-app-dir";
-import { ScheduleRepository } from "@calcom/lib/server/repository/schedule";
-import { TravelScheduleRepository } from "@calcom/lib/server/repository/travelSchedule";
-import { UserRepository } from "@calcom/lib/server/repository/user";
-
-import { AvailabilitySettingsWebWrapper } from "~/availability/[schedule]/schedule-view";
-
-export const generateMetadata = async ({ params }: PageProps) => {
- const scheduleId = params?.schedule ? Number(params.schedule) : -1;
- const schedule = await ScheduleRepository.findScheduleById({ id: scheduleId });
-
- if (!schedule) {
- return await _generateMetadata(
- (t) => t("availability"),
- () => ""
- );
- }
-
- return await _generateMetadata(
- (t) => (schedule.name ? `${schedule.name} | ${t("availability")}` : t("availability")),
- () => ""
- );
-};
-
-const Page = async ({ params }: PageProps) => {
- if (params?.schedule) {
- notFound();
- }
- const scheduleId = Number(params.schedule);
-
- const session = await getServerSessionForAppDir();
- const userId = session?.user?.id;
- if (!userId) {
- notFound();
- }
-
- let userData, schedule, travelSchedules;
-
- try {
- userData = await UserRepository.getTimeZoneAndDefaultScheduleId({
- userId,
- });
- if (!userData?.timeZone || !userData?.defaultScheduleId) {
- throw new Error("timeZone and defaultScheduleId not found");
- }
- } catch (e) {
- notFound();
- }
-
- try {
- schedule = await ScheduleRepository.findDetailedScheduleById({
- scheduleId,
- isManagedEventType: false,
- userId,
- timeZone: userData.timeZone,
- defaultScheduleId: userData.defaultScheduleId,
- });
- } catch (e) {}
-
- try {
- travelSchedules = await TravelScheduleRepository.findTravelSchedulesByUserId(userId);
- } catch (e) {}
-
- return ;
-};
-
-export default WithLayout({ ServerPage: Page });
diff --git a/apps/web/app/future/availability/page.tsx b/apps/web/app/future/availability/page.tsx
deleted file mode 100644
index 09d33577b0..0000000000
--- a/apps/web/app/future/availability/page.tsx
+++ /dev/null
@@ -1,36 +0,0 @@
-import { _generateMetadata } from "app/_utils";
-import { WithLayout } from "app/layoutHOC";
-import { notFound } from "next/navigation";
-
-import { getServerSessionForAppDir } from "@calcom/feature-auth/lib/get-server-session-for-app-dir";
-import { OrganizationRepository } from "@calcom/lib/server/repository/organization";
-
-import AvailabilityPage from "~/availability/availability-view";
-
-export const generateMetadata = async () => {
- return await _generateMetadata(
- (t) => t("availability"),
- (t) => t("configure_availability")
- );
-};
-
-const Page = async () => {
- const session = await getServerSessionForAppDir();
- const userId = session?.user?.id;
- const orgId = session?.user?.org?.id;
- if (!userId || !orgId) {
- notFound();
- }
-
- try {
- const currentOrg = await OrganizationRepository.findCurrentOrg({
- orgId,
- userId,
- });
- return ;
- } catch {
- notFound();
- }
-};
-
-export default WithLayout({ ServerPage: Page });
diff --git a/apps/web/middleware.ts b/apps/web/middleware.ts
index 7e8c586127..1290b8bd17 100644
--- a/apps/web/middleware.ts
+++ b/apps/web/middleware.ts
@@ -193,6 +193,7 @@ export const config = {
"/teams",
"/future/teams/",
"/settings/:path*",
+ "/availability/:path*",
],
};
diff --git a/apps/web/pages/availability/[schedule].tsx b/apps/web/pages/availability/[schedule].tsx
deleted file mode 100644
index 2c95f64f5f..0000000000
--- a/apps/web/pages/availability/[schedule].tsx
+++ /dev/null
@@ -1,9 +0,0 @@
-import PageWrapper from "@components/PageWrapper";
-
-import { AvailabilitySettingsWebWrapper } from "~/availability/[schedule]/schedule-view";
-
-const AvailabilitySettings = () => ;
-
-AvailabilitySettings.PageWrapper = PageWrapper;
-
-export default AvailabilitySettings;
diff --git a/apps/web/pages/availability/index.tsx b/apps/web/pages/availability/index.tsx
deleted file mode 100644
index fd2aeffe88..0000000000
--- a/apps/web/pages/availability/index.tsx
+++ /dev/null
@@ -1,9 +0,0 @@
-import PageWrapper from "@components/PageWrapper";
-
-import _AvailabilityPage from "~/availability/availability-view";
-
-const AvailabilityPage = () => <_AvailabilityPage />;
-
-AvailabilityPage.PageWrapper = PageWrapper;
-
-export default AvailabilityPage;
diff --git a/apps/web/pages/availability/troubleshoot.tsx b/apps/web/pages/availability/troubleshoot.tsx
deleted file mode 100644
index 1098bf4951..0000000000
--- a/apps/web/pages/availability/troubleshoot.tsx
+++ /dev/null
@@ -1,8 +0,0 @@
-import PageWrapper from "@components/PageWrapper";
-
-import Troubleshoot, { getLayout } from "~/availability/troubleshoot/troubleshoot-view";
-
-const TroubleshooterPage = () => ;
-TroubleshooterPage.getLayout = getLayout;
-TroubleshooterPage.PageWrapper = PageWrapper;
-export default TroubleshooterPage;
diff --git a/apps/web/scripts/vercel-app-router-deploy.sh b/apps/web/scripts/vercel-app-router-deploy.sh
index 86b6eb1c44..591c0b3c3c 100755
--- a/apps/web/scripts/vercel-app-router-deploy.sh
+++ b/apps/web/scripts/vercel-app-router-deploy.sh
@@ -7,7 +7,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_EVENT_TYPES_ENABLED" app/future/event-types
-checkRoute "$APP_ROUTER_AVAILABILITY_ENABLED" app/future/availability
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
diff --git a/packages/core/EventManager.ts b/packages/core/EventManager.ts
index 0c2a49ea11..4f900c2c70 100644
--- a/packages/core/EventManager.ts
+++ b/packages/core/EventManager.ts
@@ -980,7 +980,7 @@ export default class EventManager {
const createdEvent = await crm.createEvent(event, currentAppOption).catch((error) => {
success = false;
// We don't know the type of the error here, so for an Error instance we can read message but otherwise we stringify the error
- let errorMsg = error instanceof Error ? error.message : JSON.stringify(error);
+ const errorMsg = error instanceof Error ? error.message : JSON.stringify(error);
log.warn(`Error creating crm event for ${credential.type}`, errorMsg);
});
diff --git a/turbo.json b/turbo.json
index 1e9fa18fe6..2eb54ef949 100644
--- a/turbo.json
+++ b/turbo.json
@@ -251,7 +251,6 @@
"APP_ROUTER_AUTH_OAUTH2_ENABLED",
"APP_ROUTER_TEAM_ENABLED",
"APP_ROUTER_TEAMS_ENABLED",
- "APP_ROUTER_AVAILABILITY_ENABLED",
"APP_USER_NAME",
"BASECAMP3_CLIENT_ID",
"BASECAMP3_CLIENT_SECRET",