import type { MutableRefObject } from "react"; import { forwardRef } from "react"; import type { BookerLayout } from "@calcom/features/bookings/Booker/types"; import { APP_NAME } from "@calcom/lib/constants"; import { useBookerUrl } from "@calcom/lib/hooks/useBookerUrl"; import { useLocale } from "@calcom/lib/hooks/useLocale"; import { TextArea } from "@calcom/ui"; import type { EmbedFramework, EmbedType, PreviewState } from "../types"; import { Codes, doWeNeedCalOriginProp } from "./EmbedCodes"; import { embedLibUrl, EMBED_PREVIEW_HTML_URL } from "./constants"; import { getApiNameForReactSnippet, getApiNameForVanillaJsSnippet } from "./getApiName"; import { getDimension } from "./getDimension"; import { useEmbedCalOrigin } from "./hooks"; export const tabs = [ { name: "HTML", href: "embedTabName=embed-code", icon: "code" as const, type: "code", Component: forwardRef< HTMLTextAreaElement | HTMLIFrameElement | null, { embedType: EmbedType; calLink: string; previewState: PreviewState; namespace: string } >(function EmbedHtml({ embedType, calLink, previewState, namespace }, ref) { const { t } = useLocale(); const embedSnippetString = useGetEmbedSnippetString(namespace); 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 })}