Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

functions.web.js 2.0KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  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 replaceParticipant config.
  32. *
  33. * @param {Object} state - The state of the app.
  34. * @returns {boolean}
  35. */
  36. export function getReplaceParticipant(state: Object): string {
  37. return state['features/base/config'].replaceParticipant;
  38. }
  39. /**
  40. * Returns the list of enabled toolbar buttons.
  41. *
  42. * @param {Object} state - The redux state.
  43. * @returns {Array<string>} - The list of enabled toolbar buttons.
  44. */
  45. export function getToolbarButtons(state: Object): Array<string> {
  46. const { toolbarButtons } = state['features/base/config'];
  47. return Array.isArray(toolbarButtons) ? toolbarButtons : TOOLBAR_BUTTONS;
  48. }
  49. /**
  50. * Checks if the specified button is enabled.
  51. *
  52. * @param {string} buttonName - The name of the button.
  53. * {@link interfaceConfig}.
  54. * @param {Object|Array<string>} state - The redux state or the array with the enabled buttons.
  55. * @returns {boolean} - True if the button is enabled and false otherwise.
  56. */
  57. export function isToolbarButtonEnabled(buttonName: string, state: Object | Array<string>) {
  58. const buttons = Array.isArray(state) ? state : getToolbarButtons(state);
  59. return buttons.includes(buttonName);
  60. }