fix: App theme being used in routing-form embed (#19489)
* fix wrong theme routing-form embed * fix wrong theme routing-form embed
This commit is contained in:
1 parent
6068829d70
commit
564c84dade
13 files changed
+433
-157
No files matched your search
@@ -82,7 +82,6 @@ export const getServerSideProps = async function getServerSideProps(
|
||||
return {
|
||||
props: {
|
||||
isEmbed,
|
||||
themeBasis: form.user.username,
|
||||
profile: {
|
||||
theme: form.user.theme,
|
||||
brandColor: form.user.brandColor,
|
||||
|
||||
@@ -664,7 +664,13 @@ class CalApi {
|
||||
config.prerender = "true";
|
||||
}
|
||||
|
||||
const configWithGuestKeyAndColorScheme = withColorScheme(Cal.ensureGuestKey(config), containerEl);
|
||||
const configWithGuestKeyAndColorScheme = withColorScheme(
|
||||
Cal.ensureGuestKey({
|
||||
...config,
|
||||
embedType: "modal",
|
||||
}),
|
||||
containerEl
|
||||
);
|
||||
const existingModalEl = document.querySelector(`cal-modal-box[uid="${uid}"]`);
|
||||
|
||||
if (existingModalEl) {
|
||||
@@ -695,7 +701,6 @@ class CalApi {
|
||||
throw new Error("iframeAttrs should be an object");
|
||||
}
|
||||
|
||||
config.embedType = "modal";
|
||||
let iframe = null;
|
||||
|
||||
if (!iframe) {
|
||||
|
||||
@@ -43,6 +43,7 @@ import {
|
||||
|
||||
import { useBookerTime } from "../bookings/Booker/components/hooks/useBookerTime";
|
||||
import { buildCssVarsPerTheme } from "./lib/buildCssVarsPerTheme";
|
||||
import { EmbedTheme } from "./lib/constants";
|
||||
import { getDimension } from "./lib/getDimension";
|
||||
import { useEmbedDialogCtx } from "./lib/hooks/useEmbedDialogCtx";
|
||||
import { useEmbedParams } from "./lib/hooks/useEmbedParams";
|
||||
@@ -68,12 +69,6 @@ type GotoStateProps = {
|
||||
dialog?: string;
|
||||
};
|
||||
|
||||
const enum Theme {
|
||||
auto = "auto",
|
||||
light = "light",
|
||||
dark = "dark",
|
||||
}
|
||||
|
||||
const queryParamsForDialog = [
|
||||
"embedType",
|
||||
"embedTabName",
|
||||
@@ -178,7 +173,10 @@ function useEmbedGoto(noQueryParamMode = false) {
|
||||
return { gotoState, resetState, gotoEmbedTypeSelectionState };
|
||||
}
|
||||
|
||||
const ThemeSelectControl = ({ children, ...props }: ControlProps<{ value: Theme; label: string }, false>) => {
|
||||
const ThemeSelectControl = ({
|
||||
children,
|
||||
...props
|
||||
}: ControlProps<{ value: EmbedTheme; label: string }, false>) => {
|
||||
return (
|
||||
<components.Control {...props}>
|
||||
<Icon name="sun" className="text-subtle mr-2 h-4 w-4" />
|
||||
@@ -764,7 +762,7 @@ const EmbedTypeCodeAndPreviewDialogContent = ({
|
||||
height: "100%",
|
||||
config: defaultConfig,
|
||||
} as PreviewState["inline"],
|
||||
theme: Theme.auto,
|
||||
theme: EmbedTheme.auto,
|
||||
layout: defaultConfig.layout,
|
||||
floatingPopup: {
|
||||
config: defaultConfig,
|
||||
@@ -882,9 +880,9 @@ const EmbedTypeCodeAndPreviewDialogContent = ({
|
||||
}
|
||||
|
||||
const ThemeOptions = [
|
||||
{ value: Theme.auto, label: "Auto" },
|
||||
{ value: Theme.dark, label: "Dark Theme" },
|
||||
{ value: Theme.light, label: "Light Theme" },
|
||||
{ value: EmbedTheme.auto, label: "Auto" },
|
||||
{ value: EmbedTheme.dark, label: "Dark EmbedTheme" },
|
||||
{ value: EmbedTheme.light, label: "Light EmbedTheme" },
|
||||
];
|
||||
|
||||
const layoutOptions = [
|
||||
@@ -1113,7 +1111,7 @@ const EmbedTypeCodeAndPreviewDialogContent = ({
|
||||
<CollapsibleContent>
|
||||
<div className="text-sm">
|
||||
<Label className="mb-6">
|
||||
<div className="mb-2">Theme</div>
|
||||
<div className="mb-2">EmbedTheme</div>
|
||||
<Select
|
||||
className="w-full"
|
||||
defaultValue={ThemeOptions[0]}
|
||||
|
||||
@@ -2,3 +2,8 @@ import { EMBED_LIB_URL, WEBAPP_URL } from "@calcom/lib/constants";
|
||||
|
||||
export const embedLibUrl = EMBED_LIB_URL;
|
||||
export const EMBED_PREVIEW_HTML_URL = `${WEBAPP_URL}/embed/preview.html`;
|
||||
export const enum EmbedTheme {
|
||||
auto = "auto",
|
||||
light = "light",
|
||||
dark = "dark",
|
||||
}
|
||||
Reference in new issue
Block a user