Skip to content

Commit

Permalink
isEmbed check
Browse files Browse the repository at this point in the history
  • Loading branch information
PeerRich committed Dec 30, 2024
1 parent dc79dc7 commit c2247ef
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions apps/web/lib/plain/plainChat.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ import { usePathname, useSearchParams } from "next/navigation";
import Script from "next/script";
import { useEffect, useState, useCallback, useMemo } from "react";

import { useIsEmbed } from "@calcom/embed-core/embed-iframe";

declare global {
interface Window {
Plain?: {
Expand Down Expand Up @@ -74,6 +76,7 @@ const PlainChat = () => {
const { data: session } = useSession();
const pathname = usePathname();
const searchParams = useSearchParams();
const isEmbed = useIsEmbed();

const shouldOpenPlain = pathname === "/event-types" && searchParams?.has("openPlain");
const userEmail = session?.user?.email;
Expand Down Expand Up @@ -264,9 +267,8 @@ const PlainChat = () => {
}
`;

const isDisabled = true; // temporary disable. should become a feature flag

if (isDisabled || !isAppDomain || isSmallScreen || !config || typeof window === "undefined") return null;
// TODO: wrap in feature flag
if (isEmbed || !isAppDomain || isSmallScreen || !config || typeof window === "undefined") return null;

return (
<>
Expand Down

0 comments on commit c2247ef

Please sign in to comment.