Skip to content
6 changes: 0 additions & 6 deletions packages/features/eventtypes/components/Locations.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,6 @@ const Locations: React.FC<LocationsProps> = ({
<div className="flex flex-col gap-4">
<Controller
name="calVideoSettings.disableRecordingForGuests"
defaultValue={!!eventType.calVideoSettings?.disableRecordingForGuests}
render={({ field: { onChange, value } }) => {
return (
<SettingsToggle
Expand All @@ -364,7 +363,6 @@ const Locations: React.FC<LocationsProps> = ({

<Controller
name="calVideoSettings.disableRecordingForOrganizer"
defaultValue={!!eventType.calVideoSettings?.disableRecordingForOrganizer}
render={({ field: { onChange, value } }) => {
return (
<SettingsToggle
Expand Down Expand Up @@ -398,7 +396,6 @@ const Locations: React.FC<LocationsProps> = ({

<Controller
name="calVideoSettings.enableAutomaticTranscription"
defaultValue={!!eventType.calVideoSettings?.enableAutomaticTranscription}
render={({ field: { onChange, value } }) => {
return (
<SettingsToggle
Expand All @@ -415,7 +412,6 @@ const Locations: React.FC<LocationsProps> = ({
{!isPlatform && (
<Controller
name="calVideoSettings.disableTranscriptionForGuests"
defaultValue={!!eventType.calVideoSettings?.disableTranscriptionForGuests}
render={({ field: { onChange, value } }) => {
return (
<SettingsToggle
Expand All @@ -432,7 +428,6 @@ const Locations: React.FC<LocationsProps> = ({
{!isPlatform && (
<Controller
name="calVideoSettings.disableTranscriptionForOrganizer"
defaultValue={!!eventType.calVideoSettings?.disableTranscriptionForOrganizer}
render={({ field: { onChange, value } }) => {
return (
<SettingsToggle
Expand All @@ -449,7 +444,6 @@ const Locations: React.FC<LocationsProps> = ({

<TextField
label={t("enter_redirect_url_on_exit_description")}
defaultValue={eventType.calVideoSettings?.redirectUrlOnExit || ""}
data-testid="calVideoSettings.redirectUrlOnExit"
containerClassName="mt-4"
className="leading-6"
Expand Down
26 changes: 23 additions & 3 deletions packages/platform/atoms/event-types/hooks/useEventTypeForm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,14 @@ export const useEventTypeForm = ({
includeNoShowInRRCalculation: eventType.includeNoShowInRRCalculation,
useEventLevelSelectedCalendars: eventType.useEventLevelSelectedCalendars,
customReplyToEmail: eventType.customReplyToEmail || null,
calVideoSettings: eventType.calVideoSettings,
calVideoSettings: eventType.calVideoSettings || {
disableRecordingForOrganizer: false,
disableRecordingForGuests: false,
enableAutomaticTranscription: false,
redirectUrlOnExit: null,
disableTranscriptionForGuests: false,
disableTranscriptionForOrganizer: false,
},
maxActiveBookingsPerBooker: eventType.maxActiveBookingsPerBooker || null,
maxActiveBookingPerBookerOfferReschedule: eventType.maxActiveBookingPerBookerOfferReschedule,
};
Expand Down Expand Up @@ -316,7 +323,8 @@ export const useEventTypeForm = ({
metadata,
customInputs,
assignAllTeamMembers,
// We don't need to send send these values to the backend
calVideoSettings,
// We don't need to send these values to the backend
// eslint-disable-next-line @typescript-eslint/no-unused-vars
seatsPerTimeSlotEnabled,
// eslint-disable-next-line @typescript-eslint/no-unused-vars
Expand Down Expand Up @@ -374,6 +382,16 @@ export const useEventTypeForm = ({

// eslint-disable-next-line @typescript-eslint/no-unused-vars
const { availability, users, scheduleName, ...rest } = input;

// Check if Daily.co video is selected as a location
const hasDailyVideo = values.locations?.some((location) => location.type === "integrations:daily");

const shouldSubmit = dirtyFieldExists || hasDailyVideo;

// Get calVideoSettings from dirty values or current form values
const finalCalVideoSettings =
calVideoSettings || values.calVideoSettings || defaultValues.calVideoSettings;

const payload = {
...rest,
length,
Expand Down Expand Up @@ -401,6 +419,8 @@ export const useEventTypeForm = ({
aiPhoneCallConfig: rest.aiPhoneCallConfig
? { ...rest.aiPhoneCallConfig, templateType: rest.aiPhoneCallConfig.templateType as TemplateType }
: undefined,
// Always include calVideoSettings if Daily.co video is selected
...(hasDailyVideo && { calVideoSettings: finalCalVideoSettings }),
} satisfies EventTypeUpdateInput;
// Filter out undefined values
const filteredPayload = Object.entries(payload).reduce((acc, [key, value]) => {
Expand All @@ -411,7 +431,7 @@ export const useEventTypeForm = ({
return acc;
}, {}) as EventTypeUpdateInput;

if (dirtyFieldExists) {
if (shouldSubmit) {
onSubmit({ ...filteredPayload, id: eventType.id });
}
};
Expand Down
Loading