fix: Skip onboarding calls in podcast-only demo mode
- Add demoMode utility for consistent demo mode detection - Skip onboarding API calls in OnboardingContext when in demo mode - Redirect to /podcast-maker instead of /onboarding in demo mode
This commit is contained in:
47
frontend/src/utils/demoMode.ts
Normal file
47
frontend/src/utils/demoMode.ts
Normal file
@@ -0,0 +1,47 @@
|
||||
/**
|
||||
* Demo mode detection utilities for podcast-only demo mode.
|
||||
*/
|
||||
|
||||
const DEMO_MODE_STORAGE_KEYS = [
|
||||
'app_mode',
|
||||
'demo_mode',
|
||||
'podcast_only_demo_mode',
|
||||
];
|
||||
|
||||
const DEMO_MODE_ENV_KEYS = [
|
||||
'REACT_APP_APP_MODE',
|
||||
'REACT_APP_DEMO_MODE',
|
||||
'REACT_APP_PODCAST_ONLY_DEMO_MODE',
|
||||
];
|
||||
|
||||
/**
|
||||
* Check if podcast-only demo mode is enabled.
|
||||
* Checks localStorage first, then environment variables.
|
||||
*/
|
||||
export function isPodcastOnlyDemoMode(): boolean {
|
||||
// Check localStorage
|
||||
for (const key of DEMO_MODE_STORAGE_KEYS) {
|
||||
const value = (localStorage.getItem(key) || '').toLowerCase();
|
||||
if (value === 'true' || value === 'podcast-only' || value === 'podcast_only') {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
// Check environment variables
|
||||
for (const key of DEMO_MODE_ENV_KEYS) {
|
||||
const value = (process.env[key] || '').toLowerCase();
|
||||
if (value === 'true' || value === 'podcast-only' || value === 'podcast_only') {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the app should skip onboarding entirely.
|
||||
* Returns true in podcast-only demo mode.
|
||||
*/
|
||||
export function shouldSkipOnboarding(): boolean {
|
||||
return isPodcastOnlyDemoMode();
|
||||
}
|
||||
Reference in New Issue
Block a user