interface ConfigFromBackend { commitTime: string; contactEmail: string; contactPhone: string; position: string; } interface MyWindow extends Window { APP_CONFIG?: ConfigFromBackend; } declare const window: MyWindow; const confString = (input: string | undefined, def: string): string => { if ( input === undefined || (typeof input === "string" && input.trim() === "") ) { return def; } return input; }; export const BUILD_TIMESTAMP: Date = window.APP_CONFIG?.commitTime ? new Date(window.APP_CONFIG.commitTime) : new Date(); export const CONTACT_EMAIL = confString( window.APP_CONFIG?.contactEmail, typeof import.meta.env.VITE_CONTACT_EMAIL === "string" ? import.meta.env.VITE_CONTACT_EMAIL : "", ); export const CONTACT_PHONE = confString( window.APP_CONFIG?.contactPhone, typeof import.meta.env.VITE_CONTACT_PHONE === "string" ? import.meta.env.VITE_CONTACT_PHONE : "", ); export const POSITION = confString( window.APP_CONFIG?.position, typeof import.meta.env.VITE_POSITION === "string" ? import.meta.env.VITE_POSITION : "", );