2020-05-22 06:36:24 +00:00
|
|
|
// @flow
|
|
|
|
|
|
|
|
import { ReducerRegistry } from '../base/redux';
|
|
|
|
|
|
|
|
import { SET_DYNAMIC_BRANDING_DATA, SET_DYNAMIC_BRANDING_READY } from './actionTypes';
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 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 = {
|
|
|
|
backgroundColor: '',
|
|
|
|
backgroundImageUrl: '',
|
|
|
|
customizationReady: false,
|
2020-08-20 07:25:12 +00:00
|
|
|
inviteDomain: '',
|
2020-05-22 06:36:24 +00:00
|
|
|
logoClickUrl: '',
|
|
|
|
logoImageUrl: ''
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 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-08-20 07:25:12 +00:00
|
|
|
const { backgroundColor, backgroundImageUrl, inviteDomain, logoClickUrl, logoImageUrl } = action.value;
|
2020-05-22 06:36:24 +00:00
|
|
|
|
|
|
|
return {
|
|
|
|
backgroundColor,
|
|
|
|
backgroundImageUrl,
|
2020-08-20 07:25:12 +00:00
|
|
|
inviteDomain,
|
2020-05-22 06:36:24 +00:00
|
|
|
logoClickUrl,
|
|
|
|
logoImageUrl,
|
|
|
|
customizationReady: true
|
|
|
|
};
|
|
|
|
}
|
|
|
|
case SET_DYNAMIC_BRANDING_READY:
|
|
|
|
return {
|
|
|
|
...state,
|
|
|
|
customizationReady: true
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return state;
|
|
|
|
});
|