import { forwardRef } from "react"; import type { MutableRefObject } from "react"; import type { BookerLayout } from "@calcom/features/bookings/Booker/types"; import { APP_NAME, IS_SELF_HOSTED } from "@calcom/lib/constants"; import { useBookerUrl } from "@calcom/lib/hooks/useBookerUrl"; import { useLocale } from "@calcom/lib/hooks/useLocale"; import { TextArea } from "@calcom/ui"; import { Code, Trello } from "@calcom/ui/components/icon"; import type { EmbedType, PreviewState, EmbedFramework } from "../types"; import { Codes } from "./EmbedCodes"; import { EMBED_PREVIEW_HTML_URL, embedLibUrl } from "./constants"; import { getDimension } from "./getDimension"; import { useEmbedCalOrigin } from "./hooks"; export const tabs = [ { name: "HTML", href: "embedTabName=embed-code", icon: Code, type: "code", Component: forwardRef< HTMLTextAreaElement | HTMLIFrameElement | null, { embedType: EmbedType; calLink: string; previewState: PreviewState } >(function EmbedHtml({ embedType, calLink, previewState }, ref) { const { t } = useLocale(); const embedSnippetString = useGetEmbedSnippetString(); const embedCalOrigin = useEmbedCalOrigin(); if (ref instanceof Function || !ref) { return null; } if (ref.current && !(ref.current instanceof HTMLTextAreaElement)) { return null; } return ( <>
{t("place_where_cal_widget_appear", { appName: APP_NAME })}