2018-05-25 20:30:28 +00:00
|
|
|
import { SET_ROOM } from '../base/conference';
|
2017-09-01 19:14:03 +00:00
|
|
|
import { MiddlewareRegistry } from '../base/redux';
|
|
|
|
|
|
|
|
import { initAnalytics } from './functions';
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Middleware which intercepts config actions to handle evaluating analytics
|
|
|
|
* config based on the config stored in the store.
|
|
|
|
*
|
|
|
|
* @param {Store} store - The redux store.
|
|
|
|
* @returns {Function}
|
|
|
|
*/
|
|
|
|
MiddlewareRegistry.register(store => next => action => {
|
|
|
|
switch (action.type) {
|
2018-05-25 20:30:28 +00:00
|
|
|
case SET_ROOM: {
|
|
|
|
const result = next(action);
|
|
|
|
|
2017-09-01 19:14:03 +00:00
|
|
|
initAnalytics(store);
|
2018-05-25 20:30:28 +00:00
|
|
|
|
|
|
|
return result;
|
2017-09-01 19:14:03 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return next(action);
|
|
|
|
});
|