您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

middleware.any.ts 1.1KB

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