diff --git a/packages/embeds/embed-core/index.html b/packages/embeds/embed-core/index.html index c51dc1e91e..3ea6a85498 100644 --- a/packages/embeds/embed-core/index.html +++ b/packages/embeds/embed-core/index.html @@ -255,8 +255,12 @@ Note that one of the embeds would stay in loading state as they are using the same namespace and it is not supported to have more than 1 embeds using same namespace +
+

Test Month View

+
+
-

Test Weekly View

+

Test Week View

diff --git a/packages/embeds/embed-core/playground.ts b/packages/embeds/embed-core/playground.ts index b492d7db54..3fdb919469 100644 --- a/packages/embeds/embed-core/playground.ts +++ b/packages/embeds/embed-core/playground.ts @@ -345,6 +345,34 @@ if (only === "all" || only == "ns:floatingButton") { }); } +if (only === "all" || only == "ns:monthView") { + // Create a namespace "second". It can be accessed as Cal.ns.second with the exact same API as Cal + Cal("init", "monthView", { + debug: true, + origin: "http://localhost:3000", + }); + + Cal.ns.monthView( + "inline", + // eslint-disable-next-line @typescript-eslint/ban-ts-comment + //@ts-ignore + { + elementOrSelector: "#cal-booking-place-monthView .place", + calLink: "pro/paid", + config: { + iframeAttrs: { + id: "cal-booking-place-monthView-iframe", + }, + layout: "month_view", + }, + } + ); + Cal.ns.monthView("on", { + action: "*", + callback, + }); +} + if (only === "all" || only == "ns:weekView") { // Create a namespace "second". It can be accessed as Cal.ns.second with the exact same API as Cal Cal("init", "weekView", { diff --git a/packages/embeds/embed-core/src/embed-iframe.ts b/packages/embeds/embed-core/src/embed-iframe.ts index 11e98dd453..c2f9dc9f71 100644 --- a/packages/embeds/embed-core/src/embed-iframe.ts +++ b/packages/embeds/embed-core/src/embed-iframe.ts @@ -257,7 +257,7 @@ function getNamespace() { return embedStore.namespace; } if (isBrowser) { - const namespace = window?.getEmbedNamespace?.() || null; + const namespace = window?.getEmbedNamespace?.() ?? null; embedStore.namespace = namespace; return namespace; } diff --git a/packages/features/bookings/Booker/Booker.tsx b/packages/features/bookings/Booker/Booker.tsx index 19b06bd51c..88ccf174a6 100644 --- a/packages/features/bookings/Booker/Booker.tsx +++ b/packages/features/bookings/Booker/Booker.tsx @@ -5,7 +5,7 @@ import StickyBox from "react-sticky-box"; import { shallow } from "zustand/shallow"; import BookingPageTagManager from "@calcom/app-store/BookingPageTagManager"; -import { useEmbedUiConfig, useIsEmbed } from "@calcom/embed-core/embed-iframe"; +import { useEmbedType, useEmbedUiConfig, useIsEmbed } from "@calcom/embed-core/embed-iframe"; import classNames from "@calcom/lib/classNames"; import useMediaQuery from "@calcom/lib/hooks/useMediaQuery"; import { BookerLayouts, defaultBookerLayoutSettings } from "@calcom/prisma/zod-utils"; @@ -48,10 +48,14 @@ const BookerComponent = ({ const [_layout, setLayout] = useBookerStore((state) => [state.layout, state.setLayout], shallow); const isEmbed = useIsEmbed(); + const embedType = useEmbedType(); + // Floating Button and Element Click both are modal and thus have dark background + const hasDarkBackground = isEmbed && embedType !== "inline"; const embedUiConfig = useEmbedUiConfig(); // In Embed we give preference to embed configuration for the layout.If that's not set, we use the App configuration for the event layout - const layout = isEmbed ? validateLayout(embedUiConfig.layout) || _layout : _layout; + // But if it's mobile view, there is only one layout supported which is 'mobile' + const layout = isEmbed ? (isMobile ? "mobile" : validateLayout(embedUiConfig.layout) || _layout) : _layout; const [bookerState, setBookerState] = useBookerStore((state) => [state.state, state.setState], shallow); const selectedDate = useBookerStore((state) => state.selectedDate); @@ -133,14 +137,14 @@ const BookerComponent = ({ {event.data ? : null}
{!hideBranding ? : null}