fix: embed non-transparent dark background on success page (#9085)

* Fix colorscheme dark on success page due to embed not detected properly there

* Use calNamespace in getEmbediframe

* Fix missing variable

* Update basic.e2e.ts

---------

Co-authored-by: Omar López <[email protected]>
This commit is contained in:
Hariom BalharaandOmar López authored and GitHub committed 2023-06-06 23:52:13 +00:00
1 parent b0c5b629d7
commit 6308955e89
10 files changed
+58 -42

No files matched your search

@@ -11,7 +11,8 @@ type Theme = "dark" | "light";
export type EmbedThemeConfig = Theme | "auto";
export type UiConfig = {
hideEventTypeDetails?: boolean;
theme?: EmbedThemeConfig;
// If theme not provided we would get null
theme?: EmbedThemeConfig | null;
styles?: EmbedStyles & EmbedNonStylesConfig;
//TODO: Extract from tailwind the list of all custom variables and support them in auto-completion as well as runtime validation. Followup with listing all variables in Embed Snippet Generator UI.
cssVarsPerTheme?: Record<Theme, Record<string, string>>;
@@ -46,9 +47,8 @@ declare global {
};
CalComPageStatus: string;
isEmbed?: () => boolean;
resetEmbedStatus: () => void;
getEmbedNamespace: () => string | null;
getEmbedTheme: () => "dark" | "light" | null;
getEmbedTheme: () => EmbedThemeConfig | null;
}
}
@@ -434,7 +434,7 @@ if (isBrowser) {
// Exposes certain global variables/fns that are used by the app to get interface with the embed.
embedInit();
const url = new URL(document.URL);
embedStore.theme = window?.getEmbedTheme?.() as UiConfig["theme"];
embedStore.theme = window?.getEmbedTheme?.();
if (url.searchParams.get("prerender") !== "true" && window?.isEmbed?.()) {
log("Initializing embed-iframe");
// HACK
+1 -1
View File
@@ -215,7 +215,7 @@ export class Cal {
}) {
const iframe = (this.iframe = document.createElement("iframe"));
iframe.className = "cal-embed";
iframe.name = "cal-embed";
iframe.name = `cal-embed=${this.namespace}`;
const config = this.getConfig();
const { iframeAttrs, ...restQueryObject } = queryObject;