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.any.js 949B

12345678910111213141516171819202122232425262728293031323334353637
  1. import { sendAnalytics, createVpaasConferenceJoinedEvent } from '../analytics';
  2. import { CONFERENCE_JOINED } from '../base/conference/actionTypes';
  3. import { MiddlewareRegistry } from '../base/redux';
  4. import { isVpaasMeeting, getVpaasTenant } from './functions';
  5. /**
  6. * The redux middleware for billing counter.
  7. *
  8. * @param {Store} store - The redux store.
  9. * @returns {Function}
  10. */
  11. MiddlewareRegistry.register(store => next => async action => {
  12. switch (action.type) {
  13. case CONFERENCE_JOINED: {
  14. _maybeTrackVpaasConferenceJoin(store.getState());
  15. break;
  16. }
  17. }
  18. return next(action);
  19. });
  20. /**
  21. * Tracks the conference join event if the meeting is a vpaas one.
  22. *
  23. * @param {Store} state - The app state.
  24. * @returns {Function}
  25. */
  26. function _maybeTrackVpaasConferenceJoin(state) {
  27. if (isVpaasMeeting(state)) {
  28. sendAnalytics(createVpaasConferenceJoinedEvent(
  29. getVpaasTenant(state)));
  30. }
  31. }