diff --git a/client/coral-framework/helpers/plugins.js b/client/coral-framework/helpers/plugins.js index 4dbfd4c4e..be730535d 100644 --- a/client/coral-framework/helpers/plugins.js +++ b/client/coral-framework/helpers/plugins.js @@ -8,7 +8,7 @@ import plugins from 'pluginsConfig'; * Returns the config object of given plugin. */ function getConfig(plugin) { - return plugins.configs.filter(o => o.plugin === plugin)[0].module(); + return plugins.configs.filter(o => o.plugin === plugin)[0].getModule(); } /** @@ -17,7 +17,7 @@ function getConfig(plugin) { export function getSlotElements(slot, props = {}) { return plugins.components .map((o, i) => ({ - component: o.module(), + component: o.getModule(), props: {...getConfig(o.plugin), ...props, key: i}, })) .filter(o => o.props.slot === slot) @@ -26,20 +26,20 @@ export function getSlotElements(slot, props = {}) { // Returns a map of redux actions. export function getPluginActions() { - return merge(...plugins.actions.map(o => ({...o.module()}))); + return merge(...plugins.actions.map(o => ({...o.getModule()}))); } // Returns a map of redux reducers. export function getPluginReducers() { - merge(...plugins.reducers.map(o => ({...o.module()}))); + merge(...plugins.reducers.map(o => ({...o.getModule()}))); } // Returns an array of graphQL queries and mutators. export function getPluginQueriesAndMutators() { return flatten( merge( - plugins.queries.map(o => values(o.module())), - plugins.mutators.map(o => values(o.module())), + plugins.queries.map(o => values(o.getModule())), + plugins.mutators.map(o => values(o.getModule())), ) ); } diff --git a/client/coral-framework/loaders/plugins-loader.js b/client/coral-framework/loaders/plugins-loader.js index f1705933f..8398bbcb8 100644 --- a/client/coral-framework/loaders/plugins-loader.js +++ b/client/coral-framework/loaders/plugins-loader.js @@ -4,8 +4,8 @@ * * Outputs a module that looks like the following: * - * module.exports.actions = [{plugin: string, module: callback}, ...] - * module.exports.reducer = [{plugin: string, module: callback}, ...] + * module.exports.actions = [{plugin: string, getModule: callback}, ...] + * module.exports.reducer = [{plugin: string, getModule: callback}, ...] * [...] * */ @@ -30,7 +30,7 @@ function moduleExists(loc) { function addIfExists(list, plugin, resource) { if (moduleExists(`../../../plugins/${plugin}/client/${resource}`)) { - list.push(`{module: () => require('plugins/${plugin}/client/${resource}'), plugin: '${plugin}'}`); + list.push(`{getModule: () => require('plugins/${plugin}/client/${resource}'), plugin: '${plugin}'}`); } }