2022-10-04 10:52:09 +00:00
|
|
|
import { IStateful } from '../base/app/types';
|
2022-06-16 09:49:07 +00:00
|
|
|
import { WELCOME_PAGE_ENABLED } from '../base/flags/constants';
|
|
|
|
import { getFeatureFlag } from '../base/flags/functions';
|
|
|
|
import { toState } from '../base/redux/functions';
|
2017-09-01 04:13:59 +00:00
|
|
|
|
|
|
|
|
|
|
|
/**
|
2022-06-16 09:49:07 +00:00
|
|
|
* Determines whether the {@code WelcomePage} is enabled.
|
2017-09-01 04:13:59 +00:00
|
|
|
*
|
2022-10-04 10:52:09 +00:00
|
|
|
* @param {IStateful} stateful - The redux state or {@link getState}
|
2018-05-10 04:45:24 +00:00
|
|
|
* function.
|
2022-06-16 09:49:07 +00:00
|
|
|
* @returns {boolean} If the {@code WelcomePage} is enabled by the app, then
|
2017-10-01 06:35:19 +00:00
|
|
|
* {@code true}; otherwise, {@code false}.
|
2017-09-01 04:13:59 +00:00
|
|
|
*/
|
2022-10-04 10:52:09 +00:00
|
|
|
export function isWelcomePageEnabled(stateful: IStateful) {
|
2022-06-16 09:49:07 +00:00
|
|
|
if (navigator.product === 'ReactNative') {
|
|
|
|
return getFeatureFlag(stateful, WELCOME_PAGE_ENABLED, false);
|
|
|
|
}
|
2021-11-11 14:32:56 +00:00
|
|
|
|
2022-12-13 18:34:35 +00:00
|
|
|
const config = toState(stateful)['features/base/config'];
|
|
|
|
|
|
|
|
return !config.welcomePage?.disabled;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns the configured custom URL (if any) to redirect to instead of the normal landing page.
|
|
|
|
*
|
|
|
|
* @param {IStateful} stateful - The redux state or {@link getState}.
|
|
|
|
* @returns {string} - The custom URL.
|
|
|
|
*/
|
|
|
|
export function getCustomLandingPageURL(stateful: IStateful) {
|
|
|
|
return toState(stateful)['features/base/config'].welcomePage?.customUrl;
|
2022-06-16 09:49:07 +00:00
|
|
|
}
|