fix: only boot intercom if .env variable is set (#14656)

This commit is contained in:
Somay Chauhan
2024-04-19 09:04:02 +01:00
committed by GitHub
parent d25c043046
commit f6e45842fd
2 changed files with 4 additions and 4 deletions
@@ -204,17 +204,17 @@ export default function HelpMenuItem({ onHelpItemSelect }: HelpMenuItemProps) {
setFreshChat(false);
} else if (isInterComEnabled) {
shutdown();
toggleIntercom(false);
}
toggleIntercom(false);
} else {
if (isFreshChatEnabled) {
setFreshChat(true);
} else if (isInterComEnabled) {
await open();
toggleIntercom(true);
} else {
loadChat({ open: true });
}
toggleIntercom(true);
}
onHelpItemSelect();
}}>
+2 -2
View File
@@ -19,7 +19,7 @@ import {
} from "@calcom/features/ee/organizations/components/OrgUpgradeBanner";
import { getOrgFullOrigin } from "@calcom/features/ee/organizations/lib/orgDomains";
import HelpMenuItem from "@calcom/features/ee/support/components/HelpMenuItem";
import useIntercom from "@calcom/features/ee/support/lib/intercom/useIntercom";
import useIntercom, { isInterComEnabled } from "@calcom/features/ee/support/lib/intercom/useIntercom";
import { TeamsUpgradeBanner, type TeamsUpgradeBannerProps } from "@calcom/features/ee/teams/components";
import { useFlagMap } from "@calcom/features/flags/context/provider";
import { KBarContent, KBarRoot, KBarTrigger } from "@calcom/features/kbar/Kbar";
@@ -223,7 +223,7 @@ const Layout = (props: LayoutProps) => {
useEffect(() => {
// not using useMediaQuery as it toggles between true and false
const showIntercom = localStorage.getItem("showIntercom");
if (showIntercom === "false" || window.innerWidth <= 768 || !user) return;
if (!isInterComEnabled || showIntercom === "false" || window.innerWidth <= 768 || !user) return;
boot();
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [user]);