@legalplace/wizardx-core 3.1.4 → 3.2.0

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.
package/CHANGELOG.md CHANGED
@@ -3,6 +3,23 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ # [3.2.0](https://git.legalplace.eu/legalplace/monorepo/compare/@legalplace/wizardx-core@3.1.4...@legalplace/wizardx-core@3.2.0) (2023-03-08)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * fix build api[#6208](https://git.legalplace.eu/legalplace/monorepo/issues/6208) ([67e81f9](https://git.legalplace.eu/legalplace/monorepo/commits/67e81f948e320c944aaaf6de848d5d25aafcdd6f))
12
+
13
+
14
+ ### Features
15
+
16
+ * refactoring model duplication api[#6208](https://git.legalplace.eu/legalplace/monorepo/issues/6208) ([6186eba](https://git.legalplace.eu/legalplace/monorepo/commits/6186eba1ad49ee4d5606e9b11ec8b84fcd53d138))
17
+ * refactoring softSocial plugin into Kanoon (WIP) api[#6208](https://git.legalplace.eu/legalplace/monorepo/issues/6208) ([94f0642](https://git.legalplace.eu/legalplace/monorepo/commits/94f0642946793adc7310af2c0de556a55aaae62b))
18
+
19
+
20
+
21
+
22
+
6
23
  ## [3.1.4](https://git.legalplace.eu/legalplace/monorepo/compare/@legalplace/wizardx-core@3.1.3...@legalplace/wizardx-core@3.1.4) (2023-03-02)
7
24
 
8
25
  **Note:** Version bump only for package @legalplace/wizardx-core
@@ -2,8 +2,11 @@ import type { Props } from "react";
2
2
  import React from "react";
3
3
  import type { LoadableComponent } from "@loadable/component";
4
4
  import type { Action, AnyAction, CombinedState, Reducer } from "redux";
5
+ import type { Saga } from "redux-saga";
5
6
  declare let pluginsStoreReducers: Record<string, Reducer<CombinedState<Record<string, any>>, AnyAction>>;
7
+ declare const pluginsStoreSagas: Record<string, Saga[]>;
6
8
  export declare const getPluginsStoreReducers: () => Readonly<typeof pluginsStoreReducers>;
9
+ export declare const getPluginsStoreSagas: () => Readonly<typeof pluginsStoreSagas>;
7
10
  export declare type PluginAppStatesRegisterFunction = (currentAppStates: string[]) => string[];
8
11
  export declare type PluginsPageAppStatesType = Record<string, string>;
9
12
  export declare type actionOverrideFunction = (action: Action) => Action;
@@ -20,7 +20,9 @@ let reduxAnchors = {};
20
20
  let actionOverrideAnchor = {};
21
21
  let replacers = {};
22
22
  let pluginsStoreReducers = {};
23
+ const pluginsStoreSagas = {};
23
24
  export const getPluginsStoreReducers = () => pluginsStoreReducers;
25
+ export const getPluginsStoreSagas = () => pluginsStoreSagas;
24
26
  let PluginsAppStatesRegistrers = [];
25
27
  let PluginsPageAppStates = {};
26
28
  let PluginsAppStatesComponents = {};
@@ -118,6 +120,9 @@ const loadPluginFiles = (pluginsList) => __awaiter(void 0, void 0, void 0, funct
118
120
  if (anchor === "reduxStore" && anchors[anchor].reducer) {
119
121
  pluginsStoreReducers[plugin] = anchors[anchor].reducer;
120
122
  }
123
+ if (anchor === "reduxStore" && anchors[anchor].sagas) {
124
+ pluginsStoreSagas[plugin] = anchors[anchor].sagas;
125
+ }
121
126
  if (!Object.prototype.hasOwnProperty.call(globalAnchors, anchor))
122
127
  globalAnchors[anchor] = [];
123
128
  globalAnchors[anchor].push(anchors[anchor]);
@@ -125,7 +130,8 @@ const loadPluginFiles = (pluginsList) => __awaiter(void 0, void 0, void 0, funct
125
130
  if (typeof anchors.onLoad === "function")
126
131
  anchors.onLoad();
127
132
  });
128
- if (Object.keys(pluginsStoreReducers).length > 0) {
133
+ if (Object.keys(pluginsStoreReducers).length > 0 ||
134
+ Object.keys(pluginsStoreSagas).length > 0) {
129
135
  getStore().dispatch({ type: INIT_PLUGINS });
130
136
  }
131
137
  });
@@ -1,4 +1,4 @@
1
- import type { OVC_TYPE } from "../libs/InputsInitiator";
1
+ import type { OptionsVariablesType } from "../libs/InputsInitiator";
2
2
  export declare type relVarsValsT = Record<string, string | number>;
3
3
  export declare type getRelatedVarsT = (optionId: number, index: number, variables: number[]) => relVarsValsT;
4
4
  export declare const getRelatedVariablesValues: getRelatedVarsT;
@@ -11,5 +11,5 @@ export declare type parseVariableLabelT = (id: number, index: number) => string;
11
11
  export declare const parseVariableLabel: parseVariableLabelT;
12
12
  export declare type parseOptionLabelT = (id: number, index: number) => string;
13
13
  export declare const parseOptionLabel: parseOptionLabelT;
14
- export declare type parseRawT = (text: string, inputs?: OVC_TYPE, placeholder?: string) => string;
14
+ export declare type parseRawT = (text: string, inputs?: OptionsVariablesType, placeholder?: string) => string;
15
15
  export declare const parseRawWithVariables: parseRawT;
@@ -1,5 +1,5 @@
1
1
  import type { StateType } from "../types/State.type";
2
- export declare type OVC_TYPE = {
2
+ export declare type OptionsVariablesType = {
3
3
  options: {
4
4
  [key: string]: boolean[];
5
5
  };
@@ -11,7 +11,7 @@ export declare class IntputsInitiator {
11
11
  private inputs;
12
12
  private references;
13
13
  private ovc;
14
- constructor(references: StateType.References, ovc: OVC_TYPE | null);
14
+ constructor(references: StateType.References, ovc: OptionsVariablesType | null);
15
15
  getInputs(): StateType.Inputs;
16
16
  private setMultiples;
17
17
  private initOptionsInputs;
@@ -3,3 +3,4 @@ export * from "./routerHistory";
3
3
  export * from "./actions";
4
4
  export * from "./constants";
5
5
  export * from "./selectors";
6
+ export * from "./sagas";
@@ -3,3 +3,4 @@ export * from "./routerHistory";
3
3
  export * from "./actions";
4
4
  export * from "./constants";
5
5
  export * from "./selectors";
6
+ export * from "./sagas";
@@ -0,0 +1 @@
1
+ export * from "./middleware";
@@ -0,0 +1 @@
1
+ export * from "./middleware";
@@ -0,0 +1,2 @@
1
+ declare function initPluginsSaga(): Generator<import("redux-saga/effects").ForkEffect<never>, void, unknown>;
2
+ export default initPluginsSaga;
@@ -0,0 +1,24 @@
1
+ import { call, takeLeading } from "redux-saga/effects";
2
+ import { getPluginsStoreSagas } from "../../PluginLoader";
3
+ import { INIT_PLUGINS } from "../constants";
4
+ import { getSagaMiddleware } from "./middleware";
5
+ function* initPluginsDecorator() {
6
+ try {
7
+ const pluginsStoreSagas = getPluginsStoreSagas();
8
+ const sagaMiddleware = getSagaMiddleware();
9
+ yield call(() => {
10
+ Object.keys(pluginsStoreSagas).forEach((plugin) => {
11
+ pluginsStoreSagas[plugin].forEach((saga) => {
12
+ sagaMiddleware.run(saga);
13
+ });
14
+ });
15
+ });
16
+ }
17
+ catch (e) {
18
+ console.error(e);
19
+ }
20
+ }
21
+ function* initPluginsSaga() {
22
+ yield takeLeading(INIT_PLUGINS, initPluginsDecorator);
23
+ }
24
+ export default initPluginsSaga;
@@ -0,0 +1 @@
1
+ export declare const getSagaMiddleware: () => import("@redux-saga/core").SagaMiddleware<object>;
@@ -0,0 +1,3 @@
1
+ import createSagaMiddleware from "@redux-saga/core";
2
+ const sagaMiddleware = createSagaMiddleware();
3
+ export const getSagaMiddleware = () => sagaMiddleware;
@@ -4,6 +4,7 @@ import saveDataSaga from "./saveData";
4
4
  import homogeneousRadioInputsSaga from "./homogeneousRadioInputsSaga";
5
5
  import setUserEmailSaga from "./setUserEmail";
6
6
  import initInputsSaga from "./initInputs";
7
+ import initPluginsSaga from "./initPlugins";
7
8
  const sagas = [
8
9
  fetchModelSaga,
9
10
  setDefaultsSaga,
@@ -11,6 +12,7 @@ const sagas = [
11
12
  setUserEmailSaga,
12
13
  homogeneousRadioInputsSaga,
13
14
  initInputsSaga,
15
+ initPluginsSaga,
14
16
  ];
15
17
  export const sagasRunner = (sagaMiddleware) => {
16
18
  sagas.forEach((saga) => sagaMiddleware.run(saga));
@@ -1,7 +1,6 @@
1
1
  import { combineReducers, createStore, applyMiddleware } from "redux";
2
2
  import { connectRouter, routerMiddleware } from "connected-react-router";
3
3
  import { composeWithDevTools } from "redux-devtools-extension";
4
- import createSagaMiddleware from "@redux-saga/core";
5
4
  import { appReducer } from "./reducers/app";
6
5
  import { userReducer } from "./reducers/user";
7
6
  import { referencesReducer } from "./reducers/references";
@@ -25,6 +24,7 @@ import smartscriptMiddleware from "./middlewares/smartscriptMiddleware";
25
24
  import thirdPartyScriptsMiddleware from "./middlewares/thirdpartyScriptsMiddleware";
26
25
  import { pluginsStoreReducer } from "./reducers/pluginsStore";
27
26
  import { DANGEROUS_DESTROY_STORE } from "./constants/app";
27
+ import { getSagaMiddleware } from "./sagas/middleware";
28
28
  let store;
29
29
  let history = null;
30
30
  export const createAppStore = (historyType = "browser") => {
@@ -45,7 +45,7 @@ export const createAppStore = (historyType = "browser") => {
45
45
  return wizardxReducers(undefined, action);
46
46
  return wizardxReducers(state, action);
47
47
  };
48
- const sagaMiddleware = createSagaMiddleware();
48
+ const sagaMiddleware = getSagaMiddleware();
49
49
  const appliedMiddlewares = applyMiddleware(pluginsHookMiddleware, routerMiddleware(history), sagaMiddleware, paginationWatcherMiddleware, selectorsMiddleware, conditionsWatcherMiddleware, prefillerWatcherMiddleware, evaluationsWatcherMiddleware, multiplesActionsMiddleware, mandatoriesWatcherMiddleware, smartscriptMiddleware, thirdPartyScriptsMiddleware);
50
50
  const middlewares = Globals.appEnv !== "production"
51
51
  ? composeWithDevTools(appliedMiddlewares)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@legalplace/wizardx-core",
3
- "version": "3.1.4",
3
+ "version": "3.2.0",
4
4
  "author": "Moncef Hammou (moncef@legalplace.fr)",
5
5
  "license": "MIT",
6
6
  "files": [
@@ -95,5 +95,5 @@
95
95
  "*.test.ts",
96
96
  "*.test.tsx"
97
97
  ],
98
- "gitHead": "665da40e7a9220ce93647dd88d5897ca6b65e272"
98
+ "gitHead": "55c8c6eddf8ccf63912640693098bfa8f7ec45fb"
99
99
  }