import type { ExtendedWindow } from "~/types/window"; export enum InstallationSource { WORDPRESS_PLUGIN = "wordpress-plugin", DIRECT_SCRIPT = "direct-script" } export function detectInstallationSource(): InstallationSource { if (typeof window === "undefined") { return InstallationSource.DIRECT_SCRIPT; } const extendedWindow = window as ExtendedWindow; if (extendedWindow.chatbotData?.sharingID) { return InstallationSource.WORDPRESS_PLUGIN; } return InstallationSource.DIRECT_SCRIPT; }