fix: Connect atoms not working inside iframe (#25418)
* fix: google connect broken for iframe * chore: add changesets * chore: update atoms exports * chore: update atoms exports
This commit is contained in:
1 parent
a050ccb4ee
commit
8fcbf2c167
3 files changed
+17
-2
No files matched your search
@@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
"@calcom/atoms": patch
|
||||||
|
---
|
||||||
|
|
||||||
|
This PR fixes the issue of connect atoms not working inside iframes. It also updates the atoms exports to include the `useAvailableSlots` hook.
|
||||||
@@ -18,7 +18,7 @@ export const useGetRedirectUrl = (
|
|||||||
redir?: string,
|
redir?: string,
|
||||||
isDryRun?: boolean
|
isDryRun?: boolean
|
||||||
) => {
|
) => {
|
||||||
const redirectUrl = !!redir ? encodeURIComponent(redir) : "";
|
const redirectUrl = redir ? encodeURIComponent(redir) : "";
|
||||||
|
|
||||||
const authUrl = useQuery({
|
const authUrl = useQuery({
|
||||||
queryKey: getQueryKey(calendar),
|
queryKey: getQueryKey(calendar),
|
||||||
@@ -49,7 +49,15 @@ export const useConnect = (calendar: (typeof CALENDARS)[number], redir?: string,
|
|||||||
const redirectUri = await refetch();
|
const redirectUri = await refetch();
|
||||||
|
|
||||||
if (redirectUri.data) {
|
if (redirectUri.data) {
|
||||||
window.location.href = redirectUri.data;
|
let targetWindow;
|
||||||
|
if (window !== window.top && window.top) {
|
||||||
|
// if its an iframe, the target window should be the parent window
|
||||||
|
targetWindow = window.top;
|
||||||
|
} else {
|
||||||
|
targetWindow = window;
|
||||||
|
}
|
||||||
|
|
||||||
|
targetWindow.location.href = redirectUri.data;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -48,3 +48,5 @@ export { CreateSchedulePlatformWrapper as CreateSchedule } from "./create-schedu
|
|||||||
export { CreateScheduleForm } from "./create-schedule/CreateScheduleForm";
|
export { CreateScheduleForm } from "./create-schedule/CreateScheduleForm";
|
||||||
|
|
||||||
export { ListSchedulesPlatformWrapper as ListSchedules } from "./list-schedules/index";
|
export { ListSchedulesPlatformWrapper as ListSchedules } from "./list-schedules/index";
|
||||||
|
|
||||||
|
export { useAvailableSlots } from "./hooks/useAvailableSlots";
|
||||||
Reference in new issue
Block a user