Skip to content

Scheduling infrastructure for absolutely everyone.

fix: Default to Daily if Viable (#10279)

Joe Au-Yeung66c1e29d919c
diff --git a/apps/web/playwright/manage-booking-questions.e2e.ts b/apps/web/playwright/manage-booking-questions.e2e.ts
index 7685b916619..b05a321fb52 100644
--- a/apps/web/playwright/manage-booking-questions.e2e.ts
+++ b/apps/web/playwright/manage-booking-questions.e2e.ts
@@ -297,8 +297,6 @@ async function runTestStepsCommonForTeamAndUserEventType(
},
});
- expect(payload.location).toBe("integrations:daily");
-
expect(payload.attendees[0]).toMatchObject({
name: "Booker",
diff --git a/packages/core/EventManager.ts b/packages/core/EventManager.ts
index 95f1d9951a2..47b8c0114b5 100644
--- a/packages/core/EventManager.ts
+++ b/packages/core/EventManager.ts
@@ -5,6 +5,7 @@ import type { z } from "zod";
import { getCalendar } from "@calcom/app-store/_utils/getCalendar";
import { FAKE_DAILY_CREDENTIAL } from "@calcom/app-store/dailyvideo/lib/VideoApiAdapter";
+import { appKeysSchema as calVideoKeysSchema } from "@calcom/app-store/dailyvideo/zod";
import { getEventLocationTypeFromApp } from "@calcom/app-store/locations";
import { MeetLocationType } from "@calcom/app-store/locations";
import getApps from "@calcom/app-store/utils";
@@ -94,7 +95,22 @@ export default class EventManager {
public async create(event: CalendarEvent): Promise<CreateUpdateResult> {
const evt = processLocation(event);
// Fallback to cal video if no location is set
- if (!evt.location) evt["location"] = "integrations:daily";
+ if (!evt.location) {
+ // See if cal video is enabled & has keys
+ const calVideo = await prisma.app.findFirst({
+ where: {
+ slug: "daily-video",
+ },
+ select: {
+ keys: true,
+ enabled: true,
+ },
+ });
+
+ const calVideoKeys = calVideoKeysSchema.safeParse(calVideo?.keys);
+
+ if (calVideo?.enabled && calVideoKeys.success) evt["location"] = "integrations:daily";
+ }
// Fallback to Cal Video if Google Meet is selected w/o a Google Cal
if (evt.location === MeetLocationType && evt.destinationCalendar?.integration !== "google_calendar") {