From 3bca49804dc3766df5327f508783a9839e3fb131 Mon Sep 17 00:00:00 2001 From: Hariom Balhara Date: Thu, 22 Jun 2023 16:26:59 +0530 Subject: [PATCH] Fix generated code --- apps/web/components/Embed.tsx | 69 +++++++++++++++++++++++++++++------ 1 file changed, 58 insertions(+), 11 deletions(-) diff --git a/apps/web/components/Embed.tsx b/apps/web/components/Embed.tsx index 9b83f85081..fe74baa574 100644 --- a/apps/web/components/Embed.tsx +++ b/apps/web/components/Embed.tsx @@ -44,7 +44,12 @@ type PreviewState = { height: string; }; theme: Theme; - floatingPopup: Record; + floatingPopup: { + config: { + layout: BookerLayouts; + }; + [key: string]: string | boolean | undefined | Record; + }; elementClick: Record; palette: { brandColor: string; @@ -175,14 +180,16 @@ const Codes: Record string>> = { return code` import Cal, { getCalApi } from "@calcom/embed-react"; import { useEffect } from "react"; -function MyComponent() { +export default function MyApp() { useEffect(()=>{ (async function () { const cal = await getCalApi(); ${uiInstructionCode} })(); }, []) - return ; + return ; };`; }, "floating-popup": ({ @@ -205,7 +212,15 @@ function MyComponent() { }, []) };`; }, - "element-click": ({ calLink, uiInstructionCode }: { calLink: string; uiInstructionCode: string }) => { + "element-click": ({ + calLink, + uiInstructionCode, + previewState, + }: { + calLink: string; + uiInstructionCode: string; + previewState: PreviewState; + }) => { return code` import Cal, { getCalApi } from "@calcom/embed-react"; import { useEffect } from "react"; @@ -216,15 +231,26 @@ function MyComponent() { ${uiInstructionCode} })(); }, []) - return