2022-11-11 08:20:33 +00:00
|
|
|
import { redirectToStaticPage } from '../app/actions.web';
|
2022-01-11 10:26:05 +00:00
|
|
|
import { CONFERENCE_JOINED } from '../base/conference/actionTypes';
|
|
|
|
import {
|
|
|
|
JitsiConferenceErrors,
|
|
|
|
JitsiConferenceEvents
|
|
|
|
} from '../base/lib-jitsi-meet';
|
2022-11-11 08:20:33 +00:00
|
|
|
import MiddlewareRegistry from '../base/redux/MiddlewareRegistry';
|
2021-07-20 08:58:42 +00:00
|
|
|
|
2021-06-25 13:28:54 +00:00
|
|
|
import { SET_DETAILS } from './actionTypes';
|
|
|
|
import { STATUSES } from './constants';
|
2022-01-11 10:26:05 +00:00
|
|
|
import logger from './logger';
|
2021-06-25 13:28:54 +00:00
|
|
|
|
|
|
|
/**
|
2021-07-15 07:22:21 +00:00
|
|
|
* The redux middleware for jaas.
|
2021-06-25 13:28:54 +00:00
|
|
|
*
|
|
|
|
* @param {Store} store - The redux store.
|
|
|
|
* @returns {Function}
|
|
|
|
*/
|
|
|
|
MiddlewareRegistry.register(store => next => async action => {
|
|
|
|
switch (action.type) {
|
2022-01-11 10:26:05 +00:00
|
|
|
case CONFERENCE_JOINED: {
|
|
|
|
const { conference } = action;
|
|
|
|
|
|
|
|
if (store.getState()['features/base/config'].iAmRecorder) {
|
|
|
|
// We don't register anything on web if we are in iAmRecorder mode
|
2022-01-27 23:26:25 +00:00
|
|
|
return next(action);
|
2022-01-11 10:26:05 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
conference.on(
|
2022-11-11 08:20:33 +00:00
|
|
|
JitsiConferenceEvents.CONFERENCE_ERROR, (errorType: string, errorMsg: string) => {
|
2022-01-11 10:26:05 +00:00
|
|
|
errorType === JitsiConferenceErrors.SETTINGS_ERROR && logger.error(errorMsg);
|
|
|
|
});
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2021-06-25 13:28:54 +00:00
|
|
|
case SET_DETAILS: {
|
|
|
|
const { status } = action.payload;
|
|
|
|
|
|
|
|
if (status === STATUSES.BLOCKED) {
|
|
|
|
store.dispatch(redirectToStaticPage('/static/planLimit.html'));
|
|
|
|
}
|
2022-01-11 10:26:05 +00:00
|
|
|
break;
|
2021-06-25 13:28:54 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return next(action);
|
|
|
|
});
|