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.

middleware.web.ts 1.3KB

12345678910111213141516171819202122232425262728293031
  1. import ChatPrivacyDialog from '../../chat/components/web/ChatPrivacyDialog';
  2. import DisplayNamePrompt from '../../display-name/components/web/DisplayNamePrompt';
  3. import EmbedMeetingDialog from '../../embed-meeting/components/EmbedMeetingDialog';
  4. import KeyboardShortcutsDialog from '../../keyboard-shortcuts/components/web/KeyboardShortcutsDialog';
  5. import MiddlewareRegistry from '../redux/MiddlewareRegistry';
  6. import { OPEN_DIALOG } from './actionTypes';
  7. // ! IMPORTANT - This whole middleware is only needed for the transition from from @atlaskit dialog to our component.
  8. // ! It should be removed when the transition is over.
  9. const NEW_DIALOG_LIST = [ KeyboardShortcutsDialog, ChatPrivacyDialog, DisplayNamePrompt, EmbedMeetingDialog ];
  10. // This function is necessary while the transition from @atlaskit dialog to our component is ongoing.
  11. const isNewDialog = (component: any) => NEW_DIALOG_LIST.some(comp => comp === component);
  12. /**
  13. * Implements the entry point of the middleware of the feature base/media.
  14. *
  15. * @param {IStore} store - The redux store.
  16. * @returns {Function}
  17. */
  18. MiddlewareRegistry.register(() => (next: Function) => (action: any) => {
  19. switch (action.type) {
  20. case OPEN_DIALOG: {
  21. action.isNewDialog = isNewDialog(action.component);
  22. }
  23. }
  24. return next(action);
  25. });