1import type { DesktopAppBranding } from "@t3tools/contracts";
2import {
3 formatAppDisplayName,
4 resolveHostedAppChannelLabel,
5 resolveWebAppStageLabel,
6} from "./branding.logic";
7
8function readInjectedDesktopAppBranding(): DesktopAppBranding | null {
9 if (typeof window === "undefined") {
10 return null;
11 }
12
13 return window.desktopBridge?.getAppBranding() ?? null;
14}
15
16const injectedDesktopAppBranding = readInjectedDesktopAppBranding();
17const hostedAppChannel = import.meta.env.VITE_HOSTED_APP_CHANNEL?.trim().toLowerCase();
18
19export const HOSTED_APP_CHANNEL =
20 hostedAppChannel === "latest" || hostedAppChannel === "nightly" ? hostedAppChannel : null;
21export const HOSTED_APP_CHANNEL_LABEL = resolveHostedAppChannelLabel(HOSTED_APP_CHANNEL);
22export const APP_BASE_NAME = injectedDesktopAppBranding?.baseName ?? "T3 Code";
23export const APP_STAGE_LABEL =
24 injectedDesktopAppBranding?.stageLabel ??
25 resolveWebAppStageLabel({
26 hostedAppChannel: HOSTED_APP_CHANNEL,
27 development: import.meta.env.DEV,
28 });
29export const APP_DISPLAY_NAME =
30 injectedDesktopAppBranding?.displayName ??
31 formatAppDisplayName({ baseName: APP_BASE_NAME, stageLabel: APP_STAGE_LABEL });
32export const APP_VERSION = import.meta.env.APP_VERSION || "0.0.0";
33export const DESKTOP_DOWNLOAD_URL = "https://t3.codes/download";
34// Redirects to the App Store or Google Play to match the phone that opens it.
35export const MOBILE_APP_URL = "https://t3.codes/mobile";