Files
actual/packages/loot-core/src/shared/environment.ts
Matiss Janis Aboltins 328b36f124 [AI] Fix navigator is not defined error in @actual-app/api for Node.js environments (#7202)
* [AI] Fix navigator is not defined error in @actual-app/api for Node.js environments

Add platform.api.ts to provide Node.js-safe defaults for platform detection,
which the API's Vite config resolves before the browser-only platform.ts.
Also guard navigator access in environment.ts isElectron() function.

Fixes #7201

https://claude.ai/code/session_015Xz2nHC12pNkADGjGZnSXd

* Add release notes for PR #7202

---------

Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2026-03-15 08:13:55 +00:00

22 lines
485 B
TypeScript

export function isPreviewEnvironment() {
return String(process.env.REACT_APP_NETLIFY) === 'true';
}
export function isDevelopmentEnvironment() {
return process.env.NODE_ENV === 'development';
}
export function isNonProductionEnvironment() {
return isPreviewEnvironment() || isDevelopmentEnvironment();
}
export function isElectron() {
if (
typeof navigator !== 'undefined' &&
navigator.userAgent.indexOf('Electron') >= 0
) {
return true;
}
return false;
}