@legalplace/wizardx-core 4.42.10-nightly.20251126151952 → 4.42.10-nightly.20251126153634

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -9,11 +9,7 @@ export const PluginLoader = (props) => {
9
9
  const { anchor } = props;
10
10
  const plugins = getStore().getState().pluginsStore;
11
11
  let Plugins = [];
12
- console.log("PluginLoader", plugins);
13
- console.log("anchor", anchor);
14
12
  if (!plugins || !plugins.config || !Array.isArray(plugins.config)) {
15
- ``;
16
- console.log("No plugins found");
17
13
  return _jsx(_Fragment, {});
18
14
  }
19
15
  const matchedPlugins = plugins.config.filter((p) => {
@@ -23,13 +19,11 @@ export const PluginLoader = (props) => {
23
19
  if (p.anchor[i] !== anchor[i] && p.anchor[i] !== "*")
24
20
  return false;
25
21
  }
26
- console.log("Matched plugin", p);
27
22
  return true;
28
23
  });
29
24
  if (matchedPlugins.length > 0) {
30
25
  Plugins = matchedPlugins.map((p, i) => (_jsx(p.component, Object.assign({}, (props.props || {})), i)));
31
26
  }
32
- console.log("Plugins", Plugins);
33
27
  return _jsx(_Fragment, { children: Plugins });
34
28
  };
35
29
  export function replaceComponent(replacerName, OriginalComponent, componentName) {
@@ -130,13 +124,44 @@ export function loadPlugins(plugins) {
130
124
  pluginsStoreReducers = Object.assign(Object.assign({}, pluginsStoreReducers), { [key]: plugin.redux.reducer });
131
125
  pluginsSagas = [...pluginsSagas, ...plugin.redux.sagas];
132
126
  }
127
+ if (plugin.reduxStore) {
128
+ pluginsStoreReducers = Object.assign(Object.assign({}, pluginsStoreReducers), { [key]: plugin.reduxStore.reducer });
129
+ if (plugin.reduxStore.sagas) {
130
+ pluginsSagas = [...pluginsSagas, ...plugin.reduxStore.sagas];
131
+ }
132
+ }
133
+ if (plugin.replace) {
134
+ Object.keys(plugin.replace).forEach((componentName) => {
135
+ if (plugin.replace) {
136
+ registerReplacer(componentName, plugin.replace[componentName]);
137
+ }
138
+ });
139
+ }
140
+ const configs = [];
133
141
  if (plugin.config && Array.isArray(plugin.config)) {
142
+ configs.push(...plugin.config);
143
+ }
144
+ else {
145
+ Object.keys(plugin).forEach((prop) => {
146
+ if (["redux", "reduxStore", "replace", "config", "appstates", "actionOverride", "additionalRoutes", "paginationAfterNext"].includes(prop)) {
147
+ return;
148
+ }
149
+ const value = plugin[prop];
150
+ if (value && (typeof value === "function" || (typeof value === "object" && (value.$$typeof || value._payload)))) {
151
+ configs.push({
152
+ anchor: [prop],
153
+ component: value,
154
+ });
155
+ }
156
+ });
157
+ }
158
+ if (configs.length > 0) {
134
159
  const currentState = store.getState().pluginsStore;
135
160
  const existingConfig = currentState.config || [];
136
161
  store.dispatch({
137
162
  type: "@@PLUGIN/ADD_CONFIG",
138
163
  payload: {
139
- config: [...existingConfig, ...plugin.config],
164
+ config: [...existingConfig, ...configs],
140
165
  },
141
166
  });
142
167
  }
@@ -1,4 +1,5 @@
1
1
  import type { LoadableComponent } from "@loadable/component";
2
+ import type React from "react";
2
3
  import type { Reducer } from "redux";
3
4
  import type { ActionsLibraryType } from "./getActions.type";
4
5
  import type { StateType } from "./State.type";
@@ -18,6 +19,23 @@ export type IPluginConfigReduxWithState<T extends Record<string, any> = {}, K ex
18
19
  stateKey: K;
19
20
  };
20
21
  export interface IPlugin {
21
- config: IPluginConfig[];
22
+ config?: IPluginConfig[];
22
23
  redux?: IPluginConfigRedux;
24
+ reduxStore?: {
25
+ reducer: IPluginConfigReduxReducer;
26
+ sagas?: IPluginConfigReduxSaga[];
27
+ };
28
+ replace?: Record<string, React.ComponentType<any> | React.LazyExoticComponent<React.ComponentType<any>>>;
29
+ appstates?: {
30
+ register?: (currentAppStates: string[]) => string[];
31
+ pageAppState?: Record<string, string>;
32
+ components?: Record<string, React.ComponentType<any> | React.LazyExoticComponent<React.ComponentType<any>>>;
33
+ };
34
+ actionOverride?: Record<string, (action: any) => any>;
35
+ additionalRoutes?: Array<{
36
+ path: string;
37
+ component: React.ComponentType<any> | React.LazyExoticComponent<React.ComponentType<any>>;
38
+ }>;
39
+ paginationAfterNext?: React.ComponentType<any> | React.LazyExoticComponent<React.ComponentType<any>>;
40
+ [key: string]: any;
23
41
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@legalplace/wizardx-core",
3
- "version": "4.42.10-nightly.20251126151952",
3
+ "version": "4.42.10-nightly.20251126153634",
4
4
  "author": "Moncef Hammou (moncef@legalplace.fr)",
5
5
  "license": "MIT",
6
6
  "files": [