diff --git a/client/coral-embed-stream/src/reducers/index.js b/client/coral-embed-stream/src/reducers/index.js index a896e64c0..15056d414 100644 --- a/client/coral-embed-stream/src/reducers/index.js +++ b/client/coral-embed-stream/src/reducers/index.js @@ -3,7 +3,6 @@ import embed from './embed'; import configure from './configure'; import stream from './stream'; import profile from './profile'; -import debug from './debug'; export default { login, @@ -11,5 +10,4 @@ export default { configure, stream, profile, - debug, }; diff --git a/client/coral-embed/src/Stream.js b/client/coral-embed/src/Stream.js index fffa26aba..600e19741 100644 --- a/client/coral-embed/src/Stream.js +++ b/client/coral-embed/src/Stream.js @@ -161,8 +161,12 @@ export default class Stream { ); } - dispatch(action) { - this.pym.sendMessage('dispatch', action); + enableDebug() { + this.pym.sendMessage('enableDebug'); + } + + disableDebug() { + this.pym.sendMessage('disableDebug'); } login(token) { diff --git a/client/coral-embed/src/StreamInterface.js b/client/coral-embed/src/StreamInterface.js index 57339cf90..50bce0800 100644 --- a/client/coral-embed/src/StreamInterface.js +++ b/client/coral-embed/src/StreamInterface.js @@ -3,10 +3,6 @@ export default class StreamInterface { this._stream = stream; } - dispatch(action) { - return this._stream.dispatch(action); - } - on(eventName, callback) { return this._stream.emitter.on(eventName, callback); } @@ -26,4 +22,12 @@ export default class StreamInterface { remove() { return this._stream.remove(); } + + enableDebug() { + return this._stream.enableDebug(); + } + + disableDebug() { + return this._stream.disableDebug(); + } } diff --git a/client/coral-framework/actions/config.js b/client/coral-framework/actions/config.js index dd1522333..3a04d3fa4 100644 --- a/client/coral-framework/actions/config.js +++ b/client/coral-framework/actions/config.js @@ -1,6 +1,18 @@ -import { MERGE_CONFIG } from '../constants/config'; +import { + MERGE_CONFIG, + ENABLE_PLUGINS_DEBUG, + DISABLE_PLUGINS_DEBUG, +} from '../constants/config'; export const mergeConfig = config => ({ type: MERGE_CONFIG, config, }); + +export const enablePlugins = () => ({ + type: ENABLE_PLUGINS_DEBUG, +}); + +export const disablePlugins = () => ({ + type: DISABLE_PLUGINS_DEBUG, +}); diff --git a/client/coral-framework/components/Slot.js b/client/coral-framework/components/Slot.js index d60d69185..0dea70e57 100644 --- a/client/coral-framework/components/Slot.js +++ b/client/coral-framework/components/Slot.js @@ -74,7 +74,6 @@ class Slot extends React.Component { let children = this.getChildren(); // @Deprecated plugin_config - const pluginsConfig = get(reduxState, 'config.plugins_config') || get(reduxState, 'config.plugin_config') || diff --git a/client/coral-framework/reducers/config.js b/client/coral-framework/reducers/config.js index eccc0d4bf..b063f9b97 100644 --- a/client/coral-framework/reducers/config.js +++ b/client/coral-framework/reducers/config.js @@ -11,11 +11,19 @@ export default function config(state = initialState, action) { switch (action.type) { case ENABLE_PLUGINS_DEBUG: return { - plugins: true, + ...state, + plugins_config: { + ...state.plugins_config, + debug: true, + }, }; case DISABLE_PLUGINS_DEBUG: return { - plugins: false, + ...state, + plugins_config: { + ...state.plugins_config, + debug: false, + }, }; case LOGOUT: return { diff --git a/client/coral-framework/services/bootstrap.js b/client/coral-framework/services/bootstrap.js index fc06ea441..f2263ecac 100644 --- a/client/coral-framework/services/bootstrap.js +++ b/client/coral-framework/services/bootstrap.js @@ -25,7 +25,7 @@ import { createIntrospection } from 'coral-framework/services/introspection'; import introspectionData from 'coral-framework/graphql/introspection.json'; import coreReducers from '../reducers'; import { checkLogin as checkLoginAction } from '../actions/auth'; -import { mergeConfig } from '../actions/config'; +import { mergeConfig, enableDebug, disableDebug } from '../actions/config'; import { setAuthToken, logout } from '../actions/auth'; /** @@ -216,10 +216,12 @@ export async function createContext({ store.dispatch(logout()); }); - pym.onMessage('dispatch', action => { - store.dispatch({ - type: action, - }); + pym.onMessage('enableDebug', () => { + store.dispatch(enableDebug()); + }); + + pym.onMessage('disableDebug', () => { + store.dispatch(disableDebug()); }); }