fix: invalid type of enable_transcription_storage (#15049)

* fix: invalid type of enable_transcription_storage

* fix: type err
This commit is contained in:
Udit Takkar authored and GitHub committed 2024-05-15 16:12:24 +05:30
1 parent 973b624882
commit 87a8b5a8dd
4 files changed
+33 -15

No files matched your search

+1 -1
View File
@@ -6,7 +6,7 @@ import { Toaster } from "react-hot-toast";
import { useLocale } from "@calcom/lib/hooks/useLocale"; import { useLocale } from "@calcom/lib/hooks/useLocale";
import { showToast } from "@calcom/ui"; import { showToast } from "@calcom/ui";
export const CalAiTransctibe = () => { export const CalAiTranscribe = () => {
const daily = useDaily(); const daily = useDaily();
const { t } = useLocale(); const { t } = useLocale();
@@ -60,6 +60,19 @@ export async function getServerSideProps(context: GetServerSidePropsContext) {
}; };
} }
const hasTeamPlan = booking.user?.id
? await prisma.membership.findFirst({
where: {
userId: booking.user.id,
team: {
slug: {
not: null,
},
},
},
})
: false;
const profile = booking.user const profile = booking.user
? ( ? (
await UserRepository.enrichUserWithItsProfile({ await UserRepository.enrichUserWithItsProfile({
@@ -114,6 +127,7 @@ export async function getServerSideProps(context: GetServerSidePropsContext) {
} }
: bookingObj.user, : bookingObj.user,
}, },
hasTeamPlan: !!hasTeamPlan,
trpcState: ssr.dehydrate(), trpcState: ssr.dehydrate(),
}, },
}; };
@@ -14,13 +14,13 @@ import { useLocale } from "@calcom/lib/hooks/useLocale";
import { markdownToSafeHTML } from "@calcom/lib/markdownToSafeHTML"; import { markdownToSafeHTML } from "@calcom/lib/markdownToSafeHTML";
import { Icon } from "@calcom/ui"; import { Icon } from "@calcom/ui";
import { CalAiTransctibe } from "~/videos/ai/ai-transcribe"; import { CalAiTranscribe } from "~/videos/ai/ai-transcribe";
import { type PageProps } from "./videos-single-view.getServerSideProps"; import { type PageProps } from "./videos-single-view.getServerSideProps";
export default function JoinCall(props: PageProps) { export default function JoinCall(props: PageProps) {
const { t } = useLocale(); const { t } = useLocale();
const { meetingUrl, meetingPassword, booking } = props; const { meetingUrl, meetingPassword, booking, hasTeamPlan } = props;
const [daily, setDaily] = useState<DailyCall | null>(null); const [daily, setDaily] = useState<DailyCall | null>(null);
useEffect(() => { useEffect(() => {
@@ -47,14 +47,16 @@ export default function JoinCall(props: PageProps) {
}, },
url: meetingUrl, url: meetingUrl,
...(typeof meetingPassword === "string" && { token: meetingPassword }), ...(typeof meetingPassword === "string" && { token: meetingPassword }),
customTrayButtons: { ...(hasTeamPlan && {
transcription: { customTrayButtons: {
label: "Cal.ai", transcription: {
tooltip: "Toggle real time transcription powered by AI", label: "Cal.ai",
iconPath: `${WEBAPP_URL}/sparkles.svg`, tooltip: "Toggle real time transcription powered by AI",
iconPathDarkMode: `${WEBAPP_URL}/sparkles.svg`, iconPath: `${WEBAPP_URL}/sparkles.svg`,
iconPathDarkMode: `${WEBAPP_URL}/sparkles.svg`,
},
}, },
}, }),
}); });
setDaily(callFrame); setDaily(callFrame);
@@ -86,7 +88,7 @@ export default function JoinCall(props: PageProps) {
</Head> </Head>
<DailyProvider callObject={daily}> <DailyProvider callObject={daily}>
<div className="mx-auto" style={{ zIndex: 2, position: "absolute", bottom: 60, width: "100%" }}> <div className="mx-auto" style={{ zIndex: 2, position: "absolute", bottom: 60, width: "100%" }}>
<CalAiTransctibe /> <CalAiTranscribe />
</div> </div>
<div style={{ zIndex: 2, position: "relative" }}> <div style={{ zIndex: 2, position: "relative" }}>
{booking?.user?.organization?.calVideoLogo ? ( {booking?.user?.organization?.calVideoLogo ? (
@@ -30,7 +30,7 @@ const dailyReturnTypeSchema = z.object({
enable_chat: z.boolean(), enable_chat: z.boolean(),
enable_knocking: z.boolean(), enable_knocking: z.boolean(),
enable_prejoin_ui: z.boolean(), enable_prejoin_ui: z.boolean(),
enable_transcription_storage: z.boolean(), enable_transcription_storage: z.boolean().default(false),
}), }),
}); });
@@ -179,9 +179,11 @@ const DailyVideoApiAdapter = (): VideoApiAdapter => {
exp: exp, exp: exp,
enable_recording: scalePlan === "true" && !!hasTeamPlan === true ? "cloud" : undefined, enable_recording: scalePlan === "true" && !!hasTeamPlan === true ? "cloud" : undefined,
enable_transcription_storage: !!hasTeamPlan, enable_transcription_storage: !!hasTeamPlan,
permissions: { ...(!!hasTeamPlan && {
canAdmin: ["transcription"], permissions: {
}, canAdmin: ["transcription"],
},
}),
}, },
}; };
}; };