1import type { DesktopAppBranding } from "@t3tools/contracts";
2import { formatAppDisplayName } from "./branding.logic";
3
4function readInjectedDesktopAppBranding(): DesktopAppBranding | null {
5 if (typeof window === "undefined") {
6 return null;
7 }
8
9 return window.desktopBridge?.getAppBranding?.() ?? null;
10}
11
12const injectedDesktopAppBranding = readInjectedDesktopAppBranding();
13const hostedAppChannel = import.meta.env.VITE_HOSTED_APP_CHANNEL?.trim().toLowerCase();
14
15export const HOSTED_APP_CHANNEL =
16 hostedAppChannel === "latest" || hostedAppChannel === "nightly" ? hostedAppChannel : null;
17export const HOSTED_APP_CHANNEL_LABEL =
18 HOSTED_APP_CHANNEL === "nightly" ? "Nightly" : HOSTED_APP_CHANNEL === "latest" ? "Latest" : null;
19export const APP_BASE_NAME = injectedDesktopAppBranding?.baseName ?? "The Knife";
20export const APP_STAGE_LABEL =
21 injectedDesktopAppBranding?.stageLabel ??
22 HOSTED_APP_CHANNEL_LABEL ??
23 (import.meta.env.DEV ? "Dev" : "Latest");
24export const APP_DISPLAY_NAME =
25 injectedDesktopAppBranding?.displayName ??
26 formatAppDisplayName({ baseName: APP_BASE_NAME, stageLabel: APP_STAGE_LABEL });
27export const APP_VERSION = import.meta.env.APP_VERSION || "0.0.0";