@legalplace/wizardx-core 4.42.10-nightly.20251125160107 → 4.42.10-nightly.20251125160329

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.
@@ -25,7 +25,7 @@ export declare function getPluginsSagas(): Saga[];
25
25
  export declare function clearPlugins(): void;
26
26
  export declare const RunActionAnchor: () => void;
27
27
  export declare const RunOverrideActionAnchor: () => void;
28
- export declare const registerPluginsAppStates: () => void;
28
+ export declare const registerPluginsAppStates: (appStates: any) => any;
29
29
  export declare const getPluginsStoreReducers: typeof getPluginsReducers;
30
30
  export declare const getPluginsStoreSagas: typeof getPluginsSagas;
31
31
  export {};
@@ -121,6 +121,6 @@ export function clearPlugins() {
121
121
  }
122
122
  export const RunActionAnchor = () => { };
123
123
  export const RunOverrideActionAnchor = () => { };
124
- export const registerPluginsAppStates = () => { };
124
+ export const registerPluginsAppStates = (appStates) => appStates || [];
125
125
  export const getPluginsStoreReducers = getPluginsReducers;
126
126
  export const getPluginsStoreSagas = getPluginsSagas;
@@ -1,4 +1,6 @@
1
- import type { Store } from "redux";
1
+ import type { Store, EmptyObject, AnyAction } from "redux";
2
2
  import type { StateType } from "../types/State.type";
3
- export declare const createAppStore: (historyType?: "browser" | "memory") => Store<StateType>;
4
- export declare const getStore: (throwIfDoesNotExist?: boolean) => Store<StateType>;
3
+ export declare const createAppStore: (historyType?: "browser" | "memory") => void;
4
+ export declare const getStore: (throwIfDoesNotExist?: boolean) => Store<EmptyObject & StateType, AnyAction> & {
5
+ dispatch: unknown;
6
+ };
@@ -1,5 +1,6 @@
1
- import { configureStore } from "@reduxjs/toolkit";
1
+ import { combineReducers, legacy_createStore as createStore, applyMiddleware } from "redux";
2
2
  import { connectRouter, routerMiddleware } from "connected-react-router";
3
+ import { composeWithDevTools } from "redux-devtools-extension";
3
4
  import { appReducer } from "./reducers/app";
4
5
  import { userReducer } from "./reducers/user";
5
6
  import { referencesReducer } from "./reducers/references";
@@ -27,74 +28,32 @@ let store;
27
28
  export const createAppStore = (historyType = "browser") => {
28
29
  if (store !== undefined) {
29
30
  createHistory(historyType);
30
- return store;
31
+ return;
31
32
  }
32
33
  const history = createHistory(historyType);
33
- const sagaMiddleware = getSagaMiddleware();
34
- store = configureStore({
35
- reducer: {
36
- router: connectRouter(history),
37
- app: appReducer,
38
- user: userReducer,
39
- references: referencesReducer,
40
- inputs: inputsReducer,
41
- mandatories: mandatoriesReducer,
42
- conditions: conditionsReducer,
43
- smartscript: smartscriptReducer,
44
- pluginsStore: pluginsStoreReducer,
45
- },
46
- middleware: (getDefaultMiddleware) => getDefaultMiddleware({
47
- serializableCheck: {
48
- ignoredActions: [
49
- "@@router/LOCATION_CHANGE",
50
- "@@router/CALL_HISTORY_METHOD",
51
- ],
52
- ignoredPaths: ["router"],
53
- },
54
- immutableCheck: Globals.appEnv !== "production",
55
- })
56
- .concat([
57
- pluginsHookMiddleware,
58
- routerMiddleware(history),
59
- sagaMiddleware,
60
- paginationWatcherMiddleware,
61
- selectorsMiddleware,
62
- conditionsWatcherMiddleware,
63
- prefillerWatcherMiddleware,
64
- evaluationsWatcherMiddleware,
65
- multiplesActionsMiddleware,
66
- mandatoriesWatcherMiddleware,
67
- smartscriptMiddleware,
68
- thirdPartyScriptsMiddleware,
69
- ]),
70
- devTools: Globals.appEnv !== "production"
71
- ? {
72
- name: "WizardX Core",
73
- trace: true,
74
- traceLimit: 25,
75
- features: {
76
- pause: true,
77
- lock: true,
78
- persist: true,
79
- export: true,
80
- import: "custom",
81
- jump: true,
82
- skip: true,
83
- reorder: true,
84
- dispatch: true,
85
- test: true,
86
- },
87
- }
88
- : false,
34
+ const wizardxReducers = combineReducers({
35
+ router: connectRouter(history),
36
+ app: appReducer,
37
+ user: userReducer,
38
+ references: referencesReducer,
39
+ inputs: inputsReducer,
40
+ mandatories: mandatoriesReducer,
41
+ conditions: conditionsReducer,
42
+ smartscript: smartscriptReducer,
43
+ pluginsStore: pluginsStoreReducer,
89
44
  });
45
+ const sagaMiddleware = getSagaMiddleware();
46
+ const appliedMiddlewares = applyMiddleware(pluginsHookMiddleware, routerMiddleware(history), sagaMiddleware, paginationWatcherMiddleware, selectorsMiddleware, conditionsWatcherMiddleware, prefillerWatcherMiddleware, evaluationsWatcherMiddleware, multiplesActionsMiddleware, mandatoriesWatcherMiddleware, smartscriptMiddleware, thirdPartyScriptsMiddleware);
47
+ const middlewares = Globals.appEnv !== "production"
48
+ ? composeWithDevTools(appliedMiddlewares)
49
+ : appliedMiddlewares;
50
+ store = createStore(wizardxReducers, middlewares);
90
51
  sagasRunner(sagaMiddleware);
91
52
  subscribeListeners(store);
92
53
  store.dispatch({ type: "@@WIZARDX/INIT" });
93
- return store;
94
54
  };
95
55
  export const getStore = (throwIfDoesNotExist = true) => {
96
- if (store === undefined && throwIfDoesNotExist) {
97
- throw new Error("Store not yet created. Call createAppStore() first before accessing the store.");
98
- }
56
+ if (store === undefined && throwIfDoesNotExist)
57
+ throw new Error("Store not yet created");
99
58
  return store;
100
59
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@legalplace/wizardx-core",
3
- "version": "4.42.10-nightly.20251125160107",
3
+ "version": "4.42.10-nightly.20251125160329",
4
4
  "author": "Moncef Hammou (moncef@legalplace.fr)",
5
5
  "license": "MIT",
6
6
  "files": [
@@ -60,7 +60,6 @@
60
60
  "@legalplace/typeorm-constants": "^3.74.4",
61
61
  "@loadable/component": "^5.15.0",
62
62
  "@redux-saga/core": "^1.1.3",
63
- "@reduxjs/toolkit": "^2.11.0",
64
63
  "axios": "^0.24.0",
65
64
  "connected-react-router": "^6.8.0",
66
65
  "crypto-js": "^4.1.1",
@@ -112,6 +111,7 @@
112
111
  "jest-junit": "^13.0.0",
113
112
  "lodash": "^4.17.21",
114
113
  "react-async-ssr": "^0.7.2",
114
+ "redux-devtools-extension": "^2.13.9",
115
115
  "redux-mock-store": "^1.5.4",
116
116
  "regenerator-runtime": "^0.13.9",
117
117
  "rimraf": "^3.0.2",