Fallback if embedLibUrl is empty string (#19223)

Co-authored-by: Hariom Balhara <hariombalhara@gmgmail.com>
This commit is contained in:
Hariom Balhara
2025-02-11 14:56:31 +05:30
committed by GitHub
co-authored by Hariom Balhara
parent 08bcc77e2c
commit 552d88ad6d
+3 -3
View File
@@ -1,10 +1,10 @@
// We can't import @calcom/lib/constants here yet as this file is compiled using Vite
const WEBAPP_URL = process.env.EMBED_PUBLIC_WEBAPP_URL ?? "";
const EMBED_LIB_URL = process.env.EMBED_PUBLIC_EMBED_LIB_URL ?? WEBAPP_URL;
const IS_E2E = process.env.NEXT_PUBLIC_IS_E2E === "1";
const WEBAPP_URL = process.env.EMBED_PUBLIC_WEBAPP_URL || "";
if (!WEBAPP_URL) {
throw new Error("WEBAPP_URL is not set");
}
const EMBED_LIB_URL = process.env.EMBED_PUBLIC_EMBED_LIB_URL || WEBAPP_URL;
const IS_E2E = process.env.NEXT_PUBLIC_IS_E2E === "1";
// Because it is only used in Embed Snippet Generator preview that is accessible through dashboard only which has URL WEBAPP_URL, we are good with this strict restriction
if (!IS_E2E && (window.self === window.top || !document.referrer.startsWith(WEBAPP_URL))) {