Skip to content

Commit 286ee6b

Browse files
authored
fix: disable intercom while being impersonated (calcom#23935)
1 parent ef8b0fa commit 286ee6b

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

packages/features/ee/support/lib/intercom/provider.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
"use client";
22

3+
import { useSession } from "next-auth/react";
34
import { usePathname, useRouter, useSearchParams } from "next/navigation";
45
import { useEffect, type FC } from "react";
56
import { IntercomProvider } from "react-use-intercom";
@@ -31,6 +32,9 @@ const Provider: FC<{ children: React.ReactNode }> = ({ children }) => {
3132
const searchParams = useSearchParams();
3233
const pathname = usePathname();
3334
const router = useRouter();
35+
const { data: session } = useSession();
36+
37+
const isBeingImpersonated = !!session?.user?.impersonatedBy?.id;
3438

3539
const shouldOpenSupport =
3640
pathname === "/event-types" && (searchParams?.has("openPlain") || searchParams?.has("openSupport"));
@@ -65,7 +69,7 @@ const Provider: FC<{ children: React.ReactNode }> = ({ children }) => {
6569
const isOnboardingPage = pathname?.startsWith("/getting-started");
6670
const isCalVideoPage = pathname?.startsWith("/video/");
6771

68-
if (isOnboardingPage || isCalVideoPage) {
72+
if (isOnboardingPage || isCalVideoPage || isBeingImpersonated) {
6973
return <>{children}</>;
7074
}
7175

0 commit comments

Comments
 (0)