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