fix: open cal video url on new page when ready (#19683)

* fix: open cal video url on new page when ready

* fix: open on new tab

* chore: change logic

* chore: add condition for embed

* chore: simplify the code

---------

Co-authored-by: Peer Richelsen <peeroke@gmail.com>
This commit is contained in:
Udit Takkar
2025-03-05 18:27:06 +05:30
committed by GitHub
co-authored by Peer Richelsen
parent 381f2781a3
commit f008a28499
@@ -8,6 +8,7 @@ import { shallow } from "zustand/shallow";
import dayjs from "@calcom/dayjs";
import { sdkActionManager } from "@calcom/embed-core/embed-iframe";
import { useIsEmbed } from "@calcom/embed-core/embed-iframe";
import type { BookerProps } from "@calcom/features/bookings/Booker";
import { Booker as BookerComponent } from "@calcom/features/bookings/Booker";
import { useBookerLayout } from "@calcom/features/bookings/Booker/components/hooks/useBookerLayout";
@@ -111,6 +112,8 @@ export const BookerWebWrapper = (props: BookerWebWrapperAtomProps) => {
});
const slots = useSlots(event);
const isEmbed = useIsEmbed();
const prefetchNextMonth =
(bookerLayout.layout === BookerLayouts.WEEK_VIEW &&
!!bookerLayout.extraDays &&
@@ -201,7 +204,13 @@ export const BookerWebWrapper = (props: BookerWebWrapperAtomProps) => {
}}
onConnectNowInstantMeeting={() => {
const newPath = `${pathname}?isInstantMeeting=true`;
router.push(newPath);
if (isEmbed) {
const fullUrl = `${new URL(document.URL).origin}/${newPath}`;
window.open(fullUrl, "_blank", "noopener,noreferrer");
} else {
router.push(newPath);
}
}}
onOverlayClickNoCalendar={() => {
router.push("/apps/categories/calendar");