You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

reducer.js 1.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. // @flow
  2. import { ReducerRegistry } from '../base/redux';
  3. import { SET_DYNAMIC_BRANDING_DATA, SET_DYNAMIC_BRANDING_READY } from './actionTypes';
  4. /**
  5. * The name of the redux store/state property which is the root of the redux
  6. * state of the feature {@code dynamic-branding}.
  7. */
  8. const STORE_NAME = 'features/dynamic-branding';
  9. const DEFAULT_STATE = {
  10. backgroundColor: '',
  11. backgroundImageUrl: '',
  12. customizationReady: false,
  13. inviteDomain: '',
  14. logoClickUrl: '',
  15. logoImageUrl: ''
  16. };
  17. /**
  18. * Reduces redux actions for the purposes of the feature {@code dynamic-branding}.
  19. */
  20. ReducerRegistry.register(STORE_NAME, (state = DEFAULT_STATE, action) => {
  21. switch (action.type) {
  22. case SET_DYNAMIC_BRANDING_DATA: {
  23. const { backgroundColor, backgroundImageUrl, inviteDomain, logoClickUrl, logoImageUrl } = action.value;
  24. return {
  25. backgroundColor,
  26. backgroundImageUrl,
  27. inviteDomain,
  28. logoClickUrl,
  29. logoImageUrl,
  30. customizationReady: true
  31. };
  32. }
  33. case SET_DYNAMIC_BRANDING_READY:
  34. return {
  35. ...state,
  36. customizationReady: true
  37. };
  38. }
  39. return state;
  40. });