File tree Expand file tree Collapse file tree
packages/features/ee/support/lib/intercom Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11"use client" ;
22
3+ import { useSession } from "next-auth/react" ;
34import { usePathname , useRouter , useSearchParams } from "next/navigation" ;
45import { useEffect , type FC } from "react" ;
56import { 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
You can’t perform that action at this time.
0 commit comments