| 1234567891011121314151617181920212223242526272829303132333435 | /* @flow */
import { RouteRegistry } from '../base/react';
import { WelcomePage } from './components';
import {
    generateRoomWithoutSeparator,
    isWelcomePageAppEnabled,
    isWelcomePageUserEnabled
} from './functions';
/**
 * Register route for {@code WelcomePage}.
 */
RouteRegistry.register({
    component: WelcomePage,
    onEnter,
    path: '/'
});
/**
 * Skips the {@code WelcomePage} if it is disabled (by the app or the user).
 *
 * @param {Object} store - The redux store.
 * @param {Function} replace - The function to redirect to another path.
 * @returns {void}
 */
function onEnter({ getState }, replace) {
    if (isWelcomePageAppEnabled(getState)) {
        isWelcomePageUserEnabled(getState)
            || replace(`/${generateRoomWithoutSeparator()}`);
    } else {
        replace(undefined);
    }
}
 |