feat: link email to participant (requireEmailForGuests) (#24661)
* feat: link email to participatn * fix: bugs * refactor: improve code * refactor: prevent repload * chore: remove unued * fix: type * refactor * fix: type * feat: restrict host * feat: type * feat: tests * fix: don't allow guest * fix: merk guest * fix: bugs * fix: test * fix: test * refactor: feedback * fix: tests --------- Co-authored-by: Volnei Munhoz <[email protected]>
This commit is contained in:
1 parent
bf0fbe4888
commit
c196ff1095
28 files changed
+618
-155
No files matched your search
@@ -6,6 +6,7 @@ import type { NextRequest } from "next/server";
|
||||
import { getServerSession } from "@calcom/features/auth/lib/getServerSession";
|
||||
import handleCancelBooking from "@calcom/features/bookings/lib/handleCancelBooking";
|
||||
import { bookingCancelWithCsrfSchema } from "@calcom/prisma/zod-utils";
|
||||
import { validateCsrfToken } from "@calcom/web/lib/validateCsrfToken";
|
||||
|
||||
import { buildLegacyRequest } from "@lib/buildLegacyCtx";
|
||||
|
||||
@@ -17,13 +18,11 @@ async function handler(req: NextRequest) {
|
||||
return NextResponse.json({ success: false, message: "Invalid JSON" }, { status: 400 });
|
||||
}
|
||||
const bookingData = bookingCancelWithCsrfSchema.parse(appDirRequestBody);
|
||||
const cookieStore = await cookies();
|
||||
const cookieToken = cookieStore.get("calcom.csrf_token")?.value;
|
||||
|
||||
if (!cookieToken || cookieToken !== bookingData.csrfToken) {
|
||||
return NextResponse.json({ success: false, message: "Invalid CSRF token" }, { status: 403 });
|
||||
const csrfError = await validateCsrfToken(bookingData.csrfToken);
|
||||
if (csrfError) {
|
||||
return csrfError;
|
||||
}
|
||||
cookieStore.delete("calcom.csrf_token");
|
||||
|
||||
const session = await getServerSession({ req: buildLegacyRequest(await headers(), await cookies()) });
|
||||
|
||||
|
||||
@@ -0,0 +1,94 @@
|
||||
import { defaultResponderForAppDir } from "app/api/defaultResponderForAppDir";
|
||||
import { NextResponse } from "next/server";
|
||||
import type { NextRequest } from "next/server";
|
||||
import { z } from "zod";
|
||||
|
||||
import {
|
||||
generateGuestMeetingTokenFromOwnerMeetingToken,
|
||||
updateMeetingTokenIfExpired,
|
||||
} from "@calcom/app-store/dailyvideo/lib/VideoApiAdapter";
|
||||
import { getHostsAndGuests } from "@calcom/features/bookings/lib/getHostsAndGuests";
|
||||
import { BookingRepository } from "@calcom/features/bookings/repositories/BookingRepository";
|
||||
import { getCalVideoReference } from "@calcom/features/get-cal-video-reference";
|
||||
import { VideoCallGuestRepository } from "@calcom/features/video-call-guest/repositories/VideoCallGuestRepository";
|
||||
import prisma from "@calcom/prisma";
|
||||
import { validateCsrfToken } from "@calcom/web/lib/validateCsrfToken";
|
||||
|
||||
const videoCallGuestWithCsrfSchema = z.object({
|
||||
bookingUid: z.string(),
|
||||
email: z.string().email(),
|
||||
name: z.string().min(1),
|
||||
csrfToken: z.string().length(64, "Invalid CSRF token"),
|
||||
});
|
||||
|
||||
async function handler(req: NextRequest) {
|
||||
let appDirRequestBody;
|
||||
try {
|
||||
appDirRequestBody = await req.json();
|
||||
} catch {
|
||||
return NextResponse.json({ success: false, message: "Invalid JSON" }, { status: 400 });
|
||||
}
|
||||
|
||||
const guestData = videoCallGuestWithCsrfSchema.parse(appDirRequestBody);
|
||||
|
||||
const csrfError = await validateCsrfToken(guestData.csrfToken);
|
||||
if (csrfError) {
|
||||
return csrfError;
|
||||
}
|
||||
|
||||
const bookingRepo = new BookingRepository(prisma);
|
||||
const booking = await bookingRepo.findBookingIncludeCalVideoSettingsAndReferences({
|
||||
bookingUid: guestData.bookingUid,
|
||||
});
|
||||
|
||||
if (!booking) {
|
||||
return NextResponse.json({ error: "Booking not found" }, { status: 404 });
|
||||
}
|
||||
|
||||
const { hosts, guests } = getHostsAndGuests(booking);
|
||||
const isHost = hosts.some((host) => host.email.toLowerCase() === guestData.email.trim().toLowerCase());
|
||||
const isGuest = guests.some((guest) => guest.email.toLowerCase() === guestData.email.trim().toLowerCase());
|
||||
|
||||
if (isHost) {
|
||||
return NextResponse.json({ error: "hosts_must_use_login" }, { status: 403 });
|
||||
} else if (!isGuest) {
|
||||
return NextResponse.json({ error: "invalid_guest_email" }, { status: 403 });
|
||||
}
|
||||
|
||||
const videoCallGuestRepo = new VideoCallGuestRepository(prisma);
|
||||
const guestSession = await videoCallGuestRepo.upsertVideoCallGuest({
|
||||
bookingUid: guestData.bookingUid,
|
||||
email: guestData.email,
|
||||
name: guestData.name,
|
||||
});
|
||||
|
||||
const videoReference = getCalVideoReference(booking.references);
|
||||
|
||||
if (!videoReference) {
|
||||
return NextResponse.json({ error: "Video reference not found" }, { status: 404 });
|
||||
}
|
||||
|
||||
const endTime = new Date(booking.endTime);
|
||||
const fourteenDaysAfter = new Date(endTime.getTime() + 14 * 24 * 60 * 60 * 1000);
|
||||
const epochTimeFourteenDaysAfter = Math.floor(fourteenDaysAfter.getTime() / 1000);
|
||||
|
||||
const videoReferencePassword = await updateMeetingTokenIfExpired({
|
||||
bookingReferenceId: videoReference.id,
|
||||
roomName: videoReference.uid,
|
||||
meetingToken: videoReference.meetingPassword,
|
||||
exp: epochTimeFourteenDaysAfter,
|
||||
});
|
||||
|
||||
const guestMeetingPassword = await generateGuestMeetingTokenFromOwnerMeetingToken({
|
||||
meetingToken: videoReferencePassword,
|
||||
userId: guestSession.id,
|
||||
});
|
||||
|
||||
return NextResponse.json({
|
||||
guestSessionId: guestSession.id,
|
||||
meetingPassword: guestMeetingPassword,
|
||||
meetingUrl: videoReference.meetingUrl,
|
||||
});
|
||||
}
|
||||
|
||||
export const POST = defaultResponderForAppDir(handler);
|
||||
@@ -0,0 +1,13 @@
|
||||
import { cookies } from "next/headers";
|
||||
import { NextResponse } from "next/server";
|
||||
|
||||
export async function validateCsrfToken(csrfToken: string): Promise<NextResponse | null> {
|
||||
const cookieStore = await cookies();
|
||||
const cookieToken = cookieStore.get("calcom.csrf_token")?.value;
|
||||
|
||||
if (!cookieToken || cookieToken !== csrfToken) {
|
||||
return NextResponse.json({ success: false, message: "Invalid CSRF token" }, { status: 403 });
|
||||
}
|
||||
cookieStore.delete("calcom.csrf_token");
|
||||
return null;
|
||||
}
|
||||
@@ -10,7 +10,6 @@ import { getServerSession } from "@calcom/features/auth/lib/getServerSession";
|
||||
import { BookingRepository } from "@calcom/features/bookings/repositories/BookingRepository";
|
||||
import { OrganizationRepository } from "@calcom/features/ee/organizations/repositories/OrganizationRepository";
|
||||
import { EventTypeRepository } from "@calcom/features/eventtypes/repositories/eventTypeRepository";
|
||||
import { FeaturesRepository } from "@calcom/features/flags/features.repository";
|
||||
import { getCalVideoReference } from "@calcom/features/get-cal-video-reference";
|
||||
import { UserRepository } from "@calcom/features/users/repositories/UserRepository";
|
||||
import { CAL_VIDEO_MEETING_LINK_FOR_TESTING } from "@calcom/lib/constants";
|
||||
@@ -26,6 +25,7 @@ type CalVideoSettings = {
|
||||
enableAutomaticRecordingForOrganizer: boolean;
|
||||
disableTranscriptionForGuests: boolean;
|
||||
disableTranscriptionForOrganizer: boolean;
|
||||
requireEmailForGuests: boolean;
|
||||
};
|
||||
|
||||
const shouldEnableRecordButton = ({
|
||||
@@ -124,7 +124,7 @@ export async function getServerSideProps(context: GetServerSidePropsContext) {
|
||||
const { req } = context;
|
||||
|
||||
const bookingRepo = new BookingRepository(prisma);
|
||||
const booking = await bookingRepo.findBookingForMeetingPage({
|
||||
const booking = await bookingRepo.findBookingIncludeCalVideoSettingsAndReferences({
|
||||
bookingUid: context.query.uid as string,
|
||||
});
|
||||
|
||||
@@ -211,6 +211,7 @@ export async function getServerSideProps(context: GetServerSidePropsContext) {
|
||||
});
|
||||
|
||||
const sessionUserId = session?.user?.impersonatedBy ? session.user.impersonatedBy.id : session?.user.id;
|
||||
const sessionUserEmail = session?.user?.email;
|
||||
const isOrganizer = await checkIfUserIsHost({
|
||||
booking: {
|
||||
eventTypeId: bookingObj.eventType?.id,
|
||||
@@ -219,18 +220,25 @@ export async function getServerSideProps(context: GetServerSidePropsContext) {
|
||||
sessionUserId,
|
||||
});
|
||||
|
||||
const isAttendee = sessionUserEmail
|
||||
? bookingObj.attendees?.some(
|
||||
(attendee) => attendee.email.toLowerCase() === sessionUserEmail.toLowerCase()
|
||||
) ?? false
|
||||
: false;
|
||||
|
||||
// set meetingPassword for guests
|
||||
if (!isOrganizer) {
|
||||
const userIdForToken = sessionUserId;
|
||||
|
||||
const guestMeetingPassword = await generateGuestMeetingTokenFromOwnerMeetingToken({
|
||||
meetingToken: videoReferencePassword,
|
||||
userId: sessionUserId,
|
||||
userId: userIdForToken,
|
||||
});
|
||||
|
||||
bookingObj.references.forEach((bookRef) => {
|
||||
bookRef.meetingPassword = guestMeetingPassword;
|
||||
});
|
||||
}
|
||||
|
||||
// Only for backward compatibility and setting user id in participants for organizer
|
||||
else {
|
||||
const meetingPassword = await setEnableRecordingUIAndUserIdForOrganizer(
|
||||
@@ -247,11 +255,6 @@ export async function getServerSideProps(context: GetServerSidePropsContext) {
|
||||
|
||||
const videoReference = getCalVideoReference(bookingObj.references);
|
||||
|
||||
const featureRepo = new FeaturesRepository(prisma);
|
||||
const displayLogInOverlay = profile?.organizationId
|
||||
? await featureRepo.checkIfTeamHasFeature(profile.organizationId, "cal-video-log-in-overlay")
|
||||
: false;
|
||||
|
||||
const showRecordingButton = shouldEnableRecordButton({
|
||||
hasTeamPlan: !!hasTeamPlan,
|
||||
calVideoSettings: bookingObj.eventType?.calVideoSettings,
|
||||
@@ -293,7 +296,6 @@ export async function getServerSideProps(context: GetServerSidePropsContext) {
|
||||
},
|
||||
hasTeamPlan: !!hasTeamPlan,
|
||||
calVideoLogo,
|
||||
displayLogInOverlay,
|
||||
loggedInUserName: sessionUserId ? session?.user?.name : undefined,
|
||||
showRecordingButton,
|
||||
enableAutomaticTranscription,
|
||||
@@ -303,6 +305,8 @@ export async function getServerSideProps(context: GetServerSidePropsContext) {
|
||||
? undefined
|
||||
: bookingObj.eventType?.calVideoSettings?.redirectUrlOnExit,
|
||||
overrideName: Array.isArray(context.query.name) ? context.query.name[0] : context.query.name,
|
||||
requireEmailForGuests: bookingObj.eventType?.calVideoSettings?.requireEmailForGuests ?? false,
|
||||
isLoggedInUserPartOfMeeting: isAttendee || isOrganizer,
|
||||
},
|
||||
};
|
||||
}
|
||||
@@ -11,6 +11,7 @@ import { WEBSITE_URL } from "@calcom/lib/constants";
|
||||
import { WEBAPP_URL } from "@calcom/lib/constants";
|
||||
import { TRANSCRIPTION_STOPPED_ICON, RECORDING_DEFAULT_ICON } from "@calcom/lib/constants";
|
||||
import { formatToLocalizedDate, formatToLocalizedTime } from "@calcom/lib/dayjs";
|
||||
import { emailRegex } from "@calcom/lib/emailSchema";
|
||||
import { useLocale } from "@calcom/lib/hooks/useLocale";
|
||||
import { markdownToSafeHTML } from "@calcom/lib/markdownToSafeHTML";
|
||||
import type { inferSSRProps } from "@calcom/types/inferSSRProps";
|
||||
@@ -34,7 +35,6 @@ export default function JoinCall(props: PageProps) {
|
||||
booking,
|
||||
hasTeamPlan,
|
||||
calVideoLogo,
|
||||
displayLogInOverlay,
|
||||
loggedInUserName,
|
||||
overrideName,
|
||||
showRecordingButton,
|
||||
@@ -42,16 +42,27 @@ export default function JoinCall(props: PageProps) {
|
||||
enableAutomaticRecordingForOrganizer,
|
||||
showTranscriptionButton,
|
||||
rediectAttendeeToOnExit,
|
||||
requireEmailForGuests,
|
||||
isLoggedInUserPartOfMeeting,
|
||||
} = props;
|
||||
const [daily, setDaily] = useState<DailyCall | null>(null);
|
||||
const [userNameForCall, setUserNameForCall] = useState<string | undefined>(
|
||||
overrideName ?? loggedInUserName ?? undefined
|
||||
);
|
||||
const [isUserNameConfirmed, setIsUserNameConfirmed] = useState<boolean>(!displayLogInOverlay);
|
||||
const [guestCredentials, setGuestCredentials] = useState<{
|
||||
meetingPassword: string;
|
||||
meetingUrl: string;
|
||||
userName: string;
|
||||
} | null>(null);
|
||||
|
||||
const userNameForCall = overrideName ?? loggedInUserName ?? undefined;
|
||||
const hideLoginModal =
|
||||
!!userNameForCall && (requireEmailForGuests ? !!loggedInUserName && isLoggedInUserPartOfMeeting : true);
|
||||
const [isCallFrameReady, setIsCallFrameReady] = useState<boolean>(false);
|
||||
|
||||
const activeMeetingPassword = guestCredentials?.meetingPassword ?? meetingPassword;
|
||||
const activeMeetingUrl = guestCredentials?.meetingUrl ?? meetingUrl;
|
||||
const activeUserName = guestCredentials?.userName ?? userNameForCall;
|
||||
|
||||
const createCallFrame = useCallback(
|
||||
(userName?: string) => {
|
||||
(userName?: string, password?: string, url?: string) => {
|
||||
let callFrame: DailyCall | undefined;
|
||||
|
||||
try {
|
||||
@@ -76,9 +87,9 @@ export default function JoinCall(props: PageProps) {
|
||||
width: "100%",
|
||||
height: "100%",
|
||||
},
|
||||
url: meetingUrl,
|
||||
url: url ?? meetingUrl,
|
||||
userName: userName,
|
||||
...(typeof meetingPassword === "string" && { token: meetingPassword }),
|
||||
...(typeof (password ?? meetingPassword) === "string" && { token: password ?? meetingPassword }),
|
||||
...(hasTeamPlan && {
|
||||
customTrayButtons: {
|
||||
...(showRecordingButton
|
||||
@@ -116,16 +127,15 @@ export default function JoinCall(props: PageProps) {
|
||||
},
|
||||
[meetingUrl, meetingPassword, hasTeamPlan, showRecordingButton, showTranscriptionButton, t]
|
||||
);
|
||||
|
||||
useEffect(() => {
|
||||
if (displayLogInOverlay && !loggedInUserName && !overrideName && !isUserNameConfirmed) {
|
||||
if (!hideLoginModal && !guestCredentials) {
|
||||
return;
|
||||
}
|
||||
|
||||
let callFrame: DailyCall | null = null;
|
||||
|
||||
try {
|
||||
callFrame = createCallFrame(userNameForCall) ?? null;
|
||||
callFrame = createCallFrame(activeUserName, activeMeetingPassword, activeMeetingUrl) ?? null;
|
||||
setDaily(callFrame);
|
||||
setIsCallFrameReady(true);
|
||||
|
||||
@@ -146,28 +156,16 @@ export default function JoinCall(props: PageProps) {
|
||||
setIsCallFrameReady(false);
|
||||
};
|
||||
}, [
|
||||
displayLogInOverlay,
|
||||
isUserNameConfirmed,
|
||||
userNameForCall,
|
||||
hideLoginModal,
|
||||
activeUserName,
|
||||
activeMeetingPassword,
|
||||
activeMeetingUrl,
|
||||
createCallFrame,
|
||||
loggedInUserName,
|
||||
overrideName,
|
||||
guestCredentials,
|
||||
]);
|
||||
|
||||
const handleJoinAsGuest = useCallback((guestName: string) => {
|
||||
const trimmedName = guestName.trim();
|
||||
if (!trimmedName) {
|
||||
return;
|
||||
}
|
||||
|
||||
setUserNameForCall(trimmedName);
|
||||
setIsUserNameConfirmed(true);
|
||||
}, []);
|
||||
|
||||
const handleUserNameConfirmed = useCallback(() => {
|
||||
setIsUserNameConfirmed(true);
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<DailyProvider callObject={daily}>
|
||||
{isCallFrameReady && (
|
||||
@@ -205,14 +203,16 @@ export default function JoinCall(props: PageProps) {
|
||||
/>
|
||||
)}
|
||||
</div>
|
||||
{displayLogInOverlay && !isUserNameConfirmed && (
|
||||
{!hideLoginModal && (
|
||||
<LogInOverlay
|
||||
isLoggedIn={!!loggedInUserName}
|
||||
isOpen={!hideLoginModal}
|
||||
bookingUid={booking.uid}
|
||||
loggedInUserName={loggedInUserName ?? undefined}
|
||||
overrideName={overrideName}
|
||||
onJoinAsGuest={handleJoinAsGuest}
|
||||
onUserNameConfirmed={handleUserNameConfirmed}
|
||||
requireEmailForGuests={requireEmailForGuests}
|
||||
onGuestCredentialsReceived={setGuestCredentials}
|
||||
meetingPassword={meetingPassword}
|
||||
meetingUrl={meetingUrl}
|
||||
/>
|
||||
)}
|
||||
|
||||
@@ -291,46 +291,125 @@ function ProgressBar(props: ProgressBarProps) {
|
||||
}
|
||||
|
||||
interface LogInOverlayProps {
|
||||
isLoggedIn: boolean;
|
||||
isOpen: boolean;
|
||||
bookingUid: string;
|
||||
loggedInUserName?: string;
|
||||
overrideName?: string;
|
||||
onJoinAsGuest: (guestName: string) => void;
|
||||
onUserNameConfirmed?: () => void;
|
||||
requireEmailForGuests?: boolean;
|
||||
onGuestCredentialsReceived: (credentials: {
|
||||
meetingPassword: string;
|
||||
meetingUrl: string;
|
||||
userName: string;
|
||||
}) => void;
|
||||
meetingPassword?: string;
|
||||
meetingUrl: string;
|
||||
}
|
||||
|
||||
export function LogInOverlay(props: LogInOverlayProps) {
|
||||
const { t } = useLocale();
|
||||
const { bookingUid, isLoggedIn, loggedInUserName, overrideName, onJoinAsGuest, onUserNameConfirmed } =
|
||||
props;
|
||||
const {
|
||||
bookingUid,
|
||||
isOpen: _open,
|
||||
loggedInUserName,
|
||||
overrideName,
|
||||
requireEmailForGuests = false,
|
||||
onGuestCredentialsReceived,
|
||||
meetingPassword,
|
||||
meetingUrl,
|
||||
} = props;
|
||||
|
||||
const [isOpen, setIsOpen] = useState(!isLoggedIn);
|
||||
const [isOpen, setIsOpen] = useState(_open);
|
||||
const [userName, setUserName] = useState(overrideName ?? loggedInUserName ?? "");
|
||||
const [userEmail, setUserEmail] = useState("");
|
||||
const [isLoading, setIsLoading] = useState(false);
|
||||
const [error, setError] = useState<string | null>(null);
|
||||
|
||||
const handleContinueAsGuest = useCallback(async () => {
|
||||
const trimmedName = userName.trim();
|
||||
const trimmedEmail = userEmail.trim();
|
||||
|
||||
if (!trimmedName) {
|
||||
setError(t("please_enter_name"));
|
||||
return;
|
||||
}
|
||||
|
||||
if (requireEmailForGuests) {
|
||||
if (!trimmedEmail) {
|
||||
setError(t("please_enter_name_and_email"));
|
||||
return;
|
||||
}
|
||||
|
||||
if (!emailRegex.test(trimmedEmail)) {
|
||||
setError(t("invalid_email_address"));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
setIsLoading(true);
|
||||
setError(null);
|
||||
|
||||
try {
|
||||
onJoinAsGuest(trimmedName);
|
||||
onUserNameConfirmed?.();
|
||||
setIsOpen(false);
|
||||
} catch (error) {
|
||||
console.error("Error joining as guest:", error);
|
||||
const errorMessage = error instanceof Error ? error.message : t("failed_to_join_call");
|
||||
// Only create guest session if email is required and provided
|
||||
if (requireEmailForGuests && trimmedEmail) {
|
||||
const csrfResponse = await fetch("/api/csrf", { cache: "no-store" });
|
||||
const { csrfToken } = await csrfResponse.json();
|
||||
|
||||
const response = await fetch("/api/video/guest-session", {
|
||||
method: "POST",
|
||||
headers: { "Content-Type": "application/json" },
|
||||
body: JSON.stringify({
|
||||
bookingUid,
|
||||
email: trimmedEmail,
|
||||
name: trimmedName,
|
||||
csrfToken,
|
||||
}),
|
||||
});
|
||||
|
||||
if (!response.ok) {
|
||||
const errorData = await response.json();
|
||||
const errorKey = errorData.error;
|
||||
throw new Error(errorKey || "Failed to create guest session");
|
||||
}
|
||||
|
||||
const { meetingPassword, meetingUrl } = await response.json();
|
||||
|
||||
onGuestCredentialsReceived({
|
||||
meetingPassword,
|
||||
meetingUrl,
|
||||
userName: trimmedName,
|
||||
});
|
||||
|
||||
setIsOpen(false);
|
||||
} else {
|
||||
// If email not required, use existing credentials from SSR props
|
||||
if (!meetingPassword) {
|
||||
throw new Error("Meeting password not available");
|
||||
}
|
||||
|
||||
onGuestCredentialsReceived({
|
||||
meetingPassword,
|
||||
meetingUrl,
|
||||
userName: trimmedName,
|
||||
});
|
||||
|
||||
setIsOpen(false);
|
||||
}
|
||||
} catch (error) {
|
||||
const errorKey = error instanceof Error ? error.message : "failed_to_join_call";
|
||||
const errorMessage = t(errorKey) || errorKey;
|
||||
setError(errorMessage);
|
||||
} finally {
|
||||
setIsLoading(false);
|
||||
}
|
||||
}, [userName, onJoinAsGuest, onUserNameConfirmed, t]);
|
||||
}, [
|
||||
userName,
|
||||
userEmail,
|
||||
bookingUid,
|
||||
requireEmailForGuests,
|
||||
t,
|
||||
onGuestCredentialsReceived,
|
||||
meetingPassword,
|
||||
meetingUrl,
|
||||
]);
|
||||
|
||||
const handleKeyDown = useCallback(
|
||||
(e: React.KeyboardEvent<HTMLInputElement>) => {
|
||||
@@ -351,38 +430,81 @@ export function LogInOverlay(props: LogInOverlayProps) {
|
||||
[error]
|
||||
);
|
||||
|
||||
const handleEmailChange = useCallback(
|
||||
(e: React.ChangeEvent<HTMLInputElement>) => {
|
||||
setUserEmail(e.target.value);
|
||||
if (error) {
|
||||
setError(null);
|
||||
}
|
||||
},
|
||||
[error]
|
||||
);
|
||||
|
||||
return (
|
||||
<Dialog open={isOpen} onOpenChange={setIsOpen}>
|
||||
<DialogContent
|
||||
title={t("join_video_call")}
|
||||
description={t("choose_how_you_d_like_to_appear_on_the_call")}
|
||||
className="bg-white text-black dark:bg-black dark:text-white sm:max-w-[480px]">
|
||||
<div className="pb-4">
|
||||
className="bg-black/80 p-6 sm:max-w-lg">
|
||||
<div className="mt-2 pb-4">
|
||||
<div className="space-y-4">
|
||||
<div>
|
||||
<div className="font-semibold">{t("join_as_guest")}</div>
|
||||
<p className="text-subtle text-sm">{t("ideal_for_one_time_calls")}</p>
|
||||
</div>
|
||||
|
||||
<div className="flex gap-4">
|
||||
<Input
|
||||
type="text"
|
||||
placeholder={t("your_name")}
|
||||
className="w-full flex-1"
|
||||
value={userName}
|
||||
onChange={handleUserNameChange}
|
||||
onKeyDown={handleKeyDown}
|
||||
disabled={isLoading}
|
||||
autoFocus
|
||||
/>
|
||||
<Button color="secondary" onClick={handleContinueAsGuest} loading={isLoading}>
|
||||
{t("continue")}
|
||||
</Button>
|
||||
</div>
|
||||
{requireEmailForGuests ? (
|
||||
<div className="flex flex-col gap-4">
|
||||
<Input
|
||||
type="text"
|
||||
placeholder={t("your_name")}
|
||||
className="w-full flex-1"
|
||||
value={userName}
|
||||
onChange={handleUserNameChange}
|
||||
onKeyDown={handleKeyDown}
|
||||
disabled={isLoading}
|
||||
autoFocus
|
||||
/>
|
||||
|
||||
<Input
|
||||
type="email"
|
||||
placeholder={t("email_address")}
|
||||
className="w-full flex-1"
|
||||
value={userEmail}
|
||||
onChange={handleEmailChange}
|
||||
onKeyDown={handleKeyDown}
|
||||
disabled={isLoading}
|
||||
/>
|
||||
|
||||
<Button
|
||||
color="secondary"
|
||||
className="w-fit self-end"
|
||||
onClick={handleContinueAsGuest}
|
||||
loading={isLoading}>
|
||||
{t("continue")}
|
||||
</Button>
|
||||
</div>
|
||||
) : (
|
||||
<div className="flex gap-4">
|
||||
<Input
|
||||
type="text"
|
||||
placeholder={t("your_name")}
|
||||
className="w-full flex-1"
|
||||
value={userName}
|
||||
onChange={handleUserNameChange}
|
||||
onKeyDown={handleKeyDown}
|
||||
disabled={isLoading}
|
||||
autoFocus
|
||||
/>
|
||||
<Button color="secondary" onClick={handleContinueAsGuest} loading={isLoading}>
|
||||
{t("continue")}
|
||||
</Button>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
|
||||
{error && (
|
||||
<div className="rounded-md bg-red-50 p-3 dark:bg-red-900/20">
|
||||
<div className="mt-4 rounded-md bg-red-50 p-3 dark:bg-red-900/20">
|
||||
<div className="flex">
|
||||
<div className="ml-3">
|
||||
<p className="text-sm font-medium text-red-800 dark:text-red-200">{error}</p>
|
||||
@@ -392,7 +514,7 @@ export function LogInOverlay(props: LogInOverlayProps) {
|
||||
)}
|
||||
|
||||
{/* Divider */}
|
||||
<hr className="my-5 h-0.5 border-t-0 bg-neutral-100 dark:bg-white/10" />
|
||||
<hr className="my-6 h-0.5 border-t-0 bg-neutral-100 dark:bg-white/10" />
|
||||
|
||||
<div className="mt-5 space-y-4">
|
||||
<div>
|
||||
@@ -487,7 +609,6 @@ export function VideoMeetingInfo(props: VideoMeetingInfo) {
|
||||
|
||||
<div
|
||||
className="prose-sm prose prose-invert"
|
||||
// eslint-disable-next-line react/no-danger
|
||||
dangerouslySetInnerHTML={{ __html: markdownToSafeHTML(booking.description) }}
|
||||
/>
|
||||
</>
|
||||
|
||||
@@ -67,6 +67,8 @@
|
||||
"disable_recording_for_organizer": "Disable recording for organizer",
|
||||
"disable_transcription_for_guests": "Disable transcription for guests",
|
||||
"disable_transcription_for_organizer": "Disable transcription for organizer",
|
||||
"require_email_for_guests": "Require email for guests",
|
||||
"require_email_for_guests_description": "When enabled, guests must provide their email address to join the call",
|
||||
"event_request_declined_recurring": "Your recurring event request has been declined",
|
||||
"event_request_cancelled": "Your scheduled event was canceled",
|
||||
"event_request_reassigned": "Your scheduled event was reassigned",
|
||||
@@ -680,6 +682,8 @@
|
||||
"continue_as_guest": "Continue as Guest",
|
||||
"join_as_guest": "Join as Guest",
|
||||
"ideal_for_one_time_calls": "Ideal for one-time calls",
|
||||
"hosts_must_use_login": "Hosts must login to cal.com and then join this meeting",
|
||||
"invalid_guest_email": "We don't recognize this email address for this meeting. Double-check you're using the same email that received the invitation.",
|
||||
"any_location": "Any location",
|
||||
"yes": "Yes",
|
||||
"no": "No",
|
||||
@@ -1453,6 +1457,8 @@
|
||||
"track_your_meetings": "Track your meetings, get notifications, and manage your schedule more effectively.",
|
||||
"track_meetings_and_manage_schedule": "Track your meetings and manage your schedule more effectively",
|
||||
"failed_to_join_call": "Failed to join the call. Please try again.",
|
||||
"please_enter_name": "Please enter your name",
|
||||
"please_enter_name_and_email": "Please enter your name and email address",
|
||||
"choose_how_you_d_like_to_join_call": "Choose how you'd like to join this call",
|
||||
"choose_how_you_d_like_to_appear_on_the_call": "Choose how you'd like to appear on the call",
|
||||
"new_event_trigger": "when new event is booked",
|
||||
|
||||
Reference in new issue
Block a user