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.

functions.web.js 1.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. // @flow
  2. import { TOOLBAR_BUTTONS } from './constants';
  3. export * from './functions.any';
  4. /**
  5. * Removes all analytics related options from the given configuration, in case of a libre build.
  6. *
  7. * @param {*} config - The configuration which needs to be cleaned up.
  8. * @returns {void}
  9. */
  10. export function _cleanupConfig(config: Object) { // eslint-disable-line no-unused-vars
  11. }
  12. /**
  13. * Returns the dial out url.
  14. *
  15. * @param {Object} state - The state of the app.
  16. * @returns {string}
  17. */
  18. export function getDialOutStatusUrl(state: Object): string {
  19. return state['features/base/config'].guestDialOutStatusUrl;
  20. }
  21. /**
  22. * Returns the dial out status url.
  23. *
  24. * @param {Object} state - The state of the app.
  25. * @returns {string}
  26. */
  27. export function getDialOutUrl(state: Object): string {
  28. return state['features/base/config'].guestDialOutUrl;
  29. }
  30. /**
  31. * Returns the list of enabled toolbar buttons.
  32. *
  33. * @param {Object} state - The redux state.
  34. * @returns {Array<string>} - The list of enabled toolbar buttons.
  35. */
  36. export function getToolbarButtons(state: Object): Array<string> {
  37. const { toolbarButtons } = state['features/base/config'];
  38. return Array.isArray(toolbarButtons) ? toolbarButtons : TOOLBAR_BUTTONS;
  39. }
  40. /**
  41. * Curried selector to check if the specified button is enabled.
  42. *
  43. * @param {string} buttonName - The name of the button.
  44. * {@link interfaceConfig}.
  45. * @returns {Function} - Selector that returns a boolean.
  46. */
  47. export const isToolbarButtonEnabled = (buttonName: string) =>
  48. (state: Object): boolean =>
  49. getToolbarButtons(state).includes(buttonName);