fix: enforce team-only access on premium toggles in cal video (#25680) (#25681)

* fix(cal-video): enforce team-only access on premium toggles

* fix(cal-video): disable redirect URL field and add upgrade badge for non-team users

* chore: improvments

---------

Co-authored-by: Udit Takkar <udit222001@gmail.com>
This commit is contained in:
Eesh Midha
2025-12-12 21:04:30 +00:00
committed by GitHub
co-authored by Udit Takkar
parent 13103c0881
commit d034e7aff7
@@ -4,6 +4,7 @@ import { useState } from "react";
import { useFormContext, Controller } from "react-hook-form";
import { useIsPlatform } from "@calcom/atoms/hooks/useIsPlatform";
import { useHasTeamPlan } from "@calcom/features/billing/hooks/useHasPaidPlan";
import type { FormValues } from "@calcom/features/eventtypes/lib/types";
import type { CalVideoSettings as CalVideoSettingsType } from "@calcom/features/eventtypes/lib/types";
import { useLocale } from "@calcom/lib/hooks/useLocale";
@@ -22,6 +23,7 @@ const CalVideoSettings = ({ calVideoSettings }: { calVideoSettings?: CalVideoSet
const isPlatform = useIsPlatform();
const [isExpanded, setIsExpanded] = useState(false);
const [parent] = useAutoAnimate<HTMLDivElement>();
const { hasTeamPlan } = useHasTeamPlan();
return (
<>
<Tooltip content="expandable" side="right" className="lg:hidden">
@@ -51,6 +53,7 @@ const CalVideoSettings = ({ calVideoSettings }: { calVideoSettings?: CalVideoSet
title={t("disable_recording_for_guests")}
labelClassName="text-sm leading-6 whitespace-normal wrap-break-word"
checked={value}
disabled={!hasTeamPlan}
onCheckedChange={onChange}
Badge={<UpgradeTeamsBadge checkForActiveStatus />}
/>
@@ -67,6 +70,7 @@ const CalVideoSettings = ({ calVideoSettings }: { calVideoSettings?: CalVideoSet
title={t("disable_recording_for_organizer")}
labelClassName="text-sm leading-6 whitespace-normal wrap-break-word"
checked={value}
disabled={!hasTeamPlan}
onCheckedChange={onChange}
Badge={<UpgradeTeamsBadge checkForActiveStatus />}
/>
@@ -84,6 +88,7 @@ const CalVideoSettings = ({ calVideoSettings }: { calVideoSettings?: CalVideoSet
title={t("enable_automatic_recording")}
labelClassName="text-sm"
checked={value}
disabled={!hasTeamPlan}
onCheckedChange={onChange}
Badge={<UpgradeTeamsBadge checkForActiveStatus />}
/>
@@ -101,6 +106,7 @@ const CalVideoSettings = ({ calVideoSettings }: { calVideoSettings?: CalVideoSet
title={t("enable_automatic_transcription")}
labelClassName="text-sm leading-6 whitespace-normal wrap-break-word"
checked={value}
disabled={!hasTeamPlan}
onCheckedChange={onChange}
Badge={<UpgradeTeamsBadge checkForActiveStatus />}
/>
@@ -118,6 +124,7 @@ const CalVideoSettings = ({ calVideoSettings }: { calVideoSettings?: CalVideoSet
title={t("disable_transcription_for_guests")}
labelClassName="text-sm leading-6 whitespace-normal wrap-break-word"
checked={value}
disabled={!hasTeamPlan}
onCheckedChange={onChange}
Badge={<UpgradeTeamsBadge checkForActiveStatus />}
/>
@@ -135,6 +142,7 @@ const CalVideoSettings = ({ calVideoSettings }: { calVideoSettings?: CalVideoSet
title={t("disable_transcription_for_organizer")}
labelClassName="text-sm leading-6 whitespace-normal wrap-break-word"
checked={value}
disabled={!hasTeamPlan}
onCheckedChange={onChange}
Badge={<UpgradeTeamsBadge checkForActiveStatus />}
/>
@@ -153,6 +161,7 @@ const CalVideoSettings = ({ calVideoSettings }: { calVideoSettings?: CalVideoSet
description={t("require_email_for_guests_description")}
labelClassName="text-sm leading-6 whitespace-normal break-words"
checked={value}
disabled={!hasTeamPlan}
onCheckedChange={onChange}
Badge={<UpgradeTeamsBadge checkForActiveStatus />}
/>