import type { KcContext } from "./KcContext"; import type { AndByDiscriminatingKey } from "../tools/AndByDiscriminatingKey"; import { ftlValuesGlobalName } from "../bin/keycloakify/ftlValuesGlobalName"; export type ExtendsKcContext = [KcContextExtension] extends [never] ? KcContext : AndByDiscriminatingKey<"pageId", KcContextExtension & KcContext.Common, KcContext>; export function getKcContextFromWindow(): ExtendsKcContext | undefined { return typeof window === "undefined" ? undefined : (window as any)[ftlValuesGlobalName]; }