2020-05-22 06:36:24 +00:00
|
|
|
// @flow
|
|
|
|
|
|
|
|
import { ReducerRegistry } from '../base/redux';
|
|
|
|
|
2020-09-16 10:44:49 +00:00
|
|
|
import {
|
|
|
|
SET_DYNAMIC_BRANDING_DATA,
|
|
|
|
SET_DYNAMIC_BRANDING_FAILED,
|
|
|
|
SET_DYNAMIC_BRANDING_READY
|
|
|
|
} from './actionTypes';
|
2020-05-22 06:36:24 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* The name of the redux store/state property which is the root of the redux
|
|
|
|
* state of the feature {@code dynamic-branding}.
|
|
|
|
*/
|
|
|
|
const STORE_NAME = 'features/dynamic-branding';
|
|
|
|
|
|
|
|
const DEFAULT_STATE = {
|
2020-09-16 10:44:49 +00:00
|
|
|
/**
|
|
|
|
* The custom background color for the LargeVideo.
|
|
|
|
*
|
|
|
|
* @public
|
|
|
|
* @type {string}
|
|
|
|
*/
|
2020-05-22 06:36:24 +00:00
|
|
|
backgroundColor: '',
|
2020-09-16 10:44:49 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* The custom background image used on the LargeVideo.
|
|
|
|
*
|
|
|
|
* @public
|
|
|
|
* @type {string}
|
|
|
|
*/
|
2020-05-22 06:36:24 +00:00
|
|
|
backgroundImageUrl: '',
|
2020-09-16 10:44:49 +00:00
|
|
|
|
|
|
|
/**
|
2021-05-24 07:17:40 +00:00
|
|
|
* Flag indicating that the branding data can be displayed.
|
|
|
|
* This is used in order to avoid image flickering / text changing(blipping).
|
2020-09-16 10:44:49 +00:00
|
|
|
*
|
|
|
|
* @public
|
|
|
|
* @type {boolean}
|
|
|
|
*/
|
2020-05-22 06:36:24 +00:00
|
|
|
customizationReady: false,
|
2020-09-16 10:44:49 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Flag indicating that the dynamic branding data request has failed.
|
|
|
|
* When the request fails there is no logo (JitsiWatermark) displayed.
|
|
|
|
*
|
|
|
|
* @public
|
|
|
|
* @type {boolean}
|
|
|
|
*/
|
|
|
|
customizationFailed: false,
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Flag indicating that the dynamic branding has not been modified and should use
|
|
|
|
* the default options.
|
|
|
|
*
|
|
|
|
* @public
|
|
|
|
* @type {boolean}
|
|
|
|
*/
|
|
|
|
defaultBranding: true,
|
|
|
|
|
2021-02-24 09:37:14 +00:00
|
|
|
/**
|
|
|
|
* Url for a custom page for DID numbers list.
|
|
|
|
*
|
|
|
|
* @public
|
|
|
|
* @type {string}
|
|
|
|
*/
|
|
|
|
didPageUrl: '',
|
|
|
|
|
2020-09-16 10:44:49 +00:00
|
|
|
/**
|
|
|
|
* The custom invite domain.
|
|
|
|
*
|
|
|
|
* @public
|
|
|
|
* @type {string}
|
|
|
|
*/
|
2020-08-20 07:25:12 +00:00
|
|
|
inviteDomain: '',
|
2020-09-16 10:44:49 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* The custom url used when the user clicks the logo.
|
|
|
|
*
|
|
|
|
* @public
|
|
|
|
* @type {string}
|
|
|
|
*/
|
2020-05-22 06:36:24 +00:00
|
|
|
logoClickUrl: '',
|
2020-09-16 10:44:49 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* The custom logo (JitisWatermark).
|
|
|
|
*
|
|
|
|
* @public
|
|
|
|
* @type {string}
|
|
|
|
*/
|
|
|
|
logoImageUrl: '',
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Flag used to signal if the app should use a custom logo or not
|
|
|
|
*
|
|
|
|
* @public
|
|
|
|
* @type {boolean}
|
|
|
|
*/
|
|
|
|
useDynamicBrandingData: false
|
2020-05-22 06:36:24 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Reduces redux actions for the purposes of the feature {@code dynamic-branding}.
|
|
|
|
*/
|
|
|
|
ReducerRegistry.register(STORE_NAME, (state = DEFAULT_STATE, action) => {
|
|
|
|
switch (action.type) {
|
|
|
|
case SET_DYNAMIC_BRANDING_DATA: {
|
2020-09-16 10:44:49 +00:00
|
|
|
const {
|
|
|
|
backgroundColor,
|
|
|
|
backgroundImageUrl,
|
|
|
|
defaultBranding,
|
2021-02-24 09:37:14 +00:00
|
|
|
didPageUrl,
|
2020-09-16 10:44:49 +00:00
|
|
|
inviteDomain,
|
|
|
|
logoClickUrl,
|
|
|
|
logoImageUrl
|
|
|
|
} = action.value;
|
2020-05-22 06:36:24 +00:00
|
|
|
|
|
|
|
return {
|
|
|
|
backgroundColor,
|
|
|
|
backgroundImageUrl,
|
2020-09-16 10:44:49 +00:00
|
|
|
defaultBranding,
|
2021-02-24 09:37:14 +00:00
|
|
|
didPageUrl,
|
2020-08-20 07:25:12 +00:00
|
|
|
inviteDomain,
|
2020-05-22 06:36:24 +00:00
|
|
|
logoClickUrl,
|
|
|
|
logoImageUrl,
|
2020-09-16 10:44:49 +00:00
|
|
|
customizationFailed: false,
|
|
|
|
customizationReady: true,
|
|
|
|
useDynamicBrandingData: true
|
|
|
|
};
|
|
|
|
}
|
|
|
|
case SET_DYNAMIC_BRANDING_FAILED: {
|
|
|
|
return {
|
|
|
|
...state,
|
|
|
|
customizationReady: true,
|
|
|
|
customizationFailed: true,
|
|
|
|
useDynamicBrandingData: true
|
2020-05-22 06:36:24 +00:00
|
|
|
};
|
|
|
|
}
|
|
|
|
case SET_DYNAMIC_BRANDING_READY:
|
|
|
|
return {
|
|
|
|
...state,
|
|
|
|
customizationReady: true
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
return state;
|
|
|
|
});
|