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 3.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  1. // @flow
  2. import { ReducerRegistry } from '../base/redux';
  3. import {
  4. SET_DYNAMIC_BRANDING_DATA,
  5. SET_DYNAMIC_BRANDING_FAILED,
  6. SET_DYNAMIC_BRANDING_READY
  7. } from './actionTypes';
  8. /**
  9. * The name of the redux store/state property which is the root of the redux
  10. * state of the feature {@code dynamic-branding}.
  11. */
  12. const STORE_NAME = 'features/dynamic-branding';
  13. const DEFAULT_STATE = {
  14. /**
  15. * The custom background color for the LargeVideo.
  16. *
  17. * @public
  18. * @type {string}
  19. */
  20. backgroundColor: '',
  21. /**
  22. * The custom background image used on the LargeVideo.
  23. *
  24. * @public
  25. * @type {string}
  26. */
  27. backgroundImageUrl: '',
  28. /**
  29. * Flag indicating that the branding data can be displayed.
  30. * This is used in order to avoid image flickering / text changing(blipping).
  31. *
  32. * @public
  33. * @type {boolean}
  34. */
  35. customizationReady: false,
  36. /**
  37. * Flag indicating that the dynamic branding data request has failed.
  38. * When the request fails there is no logo (JitsiWatermark) displayed.
  39. *
  40. * @public
  41. * @type {boolean}
  42. */
  43. customizationFailed: false,
  44. /**
  45. * Flag indicating that the dynamic branding has not been modified and should use
  46. * the default options.
  47. *
  48. * @public
  49. * @type {boolean}
  50. */
  51. defaultBranding: true,
  52. /**
  53. * Url for a custom page for DID numbers list.
  54. *
  55. * @public
  56. * @type {string}
  57. */
  58. didPageUrl: '',
  59. /**
  60. * The custom invite domain.
  61. *
  62. * @public
  63. * @type {string}
  64. */
  65. inviteDomain: '',
  66. /**
  67. * The custom url used when the user clicks the logo.
  68. *
  69. * @public
  70. * @type {string}
  71. */
  72. logoClickUrl: '',
  73. /**
  74. * The custom logo (JitisWatermark).
  75. *
  76. * @public
  77. * @type {string}
  78. */
  79. logoImageUrl: '',
  80. /**
  81. * Flag used to signal if the app should use a custom logo or not
  82. *
  83. * @public
  84. * @type {boolean}
  85. */
  86. useDynamicBrandingData: false
  87. };
  88. /**
  89. * Reduces redux actions for the purposes of the feature {@code dynamic-branding}.
  90. */
  91. ReducerRegistry.register(STORE_NAME, (state = DEFAULT_STATE, action) => {
  92. switch (action.type) {
  93. case SET_DYNAMIC_BRANDING_DATA: {
  94. const {
  95. backgroundColor,
  96. backgroundImageUrl,
  97. defaultBranding,
  98. didPageUrl,
  99. inviteDomain,
  100. logoClickUrl,
  101. logoImageUrl
  102. } = action.value;
  103. return {
  104. backgroundColor,
  105. backgroundImageUrl,
  106. defaultBranding,
  107. didPageUrl,
  108. inviteDomain,
  109. logoClickUrl,
  110. logoImageUrl,
  111. customizationFailed: false,
  112. customizationReady: true,
  113. useDynamicBrandingData: true
  114. };
  115. }
  116. case SET_DYNAMIC_BRANDING_FAILED: {
  117. return {
  118. ...state,
  119. customizationReady: true,
  120. customizationFailed: true,
  121. useDynamicBrandingData: true
  122. };
  123. }
  124. case SET_DYNAMIC_BRANDING_READY:
  125. return {
  126. ...state,
  127. customizationReady: true
  128. };
  129. }
  130. return state;
  131. });