import { CalWindow } from "@calcom/embed-core"; import Cal from "./Cal"; export const getCalApi = (): Promise => new Promise(function tryReadingFromWindow(resolve) { const api = (window as CalWindow).Cal; if (!api) { setTimeout(() => { tryReadingFromWindow(resolve); }, 50); return; } resolve(api); }); export default Cal;