@legalplace/wizardx-core 2.7.2 → 2.8.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,37 @@
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
+ # [2.8.0](https://git.legalplace.eu/legalplace/monorepo/compare/@legalplace/wizardx-core@2.7.3...@legalplace/wizardx-core@2.8.0) (2022-03-04)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * add NB_CHAR function to eval ([39c3337](https://git.legalplace.eu/legalplace/monorepo/commits/39c33373e3834173382475b117b056a15c8df36d)), closes [api#DEV-4892](https://git.legalplace.eu/legalplace/monorepo/issues/DEV-4892)
12
+ * linting ([250d797](https://git.legalplace.eu/legalplace/monorepo/commits/250d797e7e19bbbbc0b2848a9654899ae1bd79d1)), closes [api#4892](https://git.legalplace.eu/legalplace/monorepo/issues/4892)
13
+ * update all package storybook ([98c9166](https://git.legalplace.eu/legalplace/monorepo/commits/98c9166ec319682922e509560e37229d3dbeb57a)), closes [api#DEV-4871](https://git.legalplace.eu/legalplace/monorepo/issues/DEV-4871)
14
+
15
+
16
+ ### Features
17
+
18
+ * add nb char function to eval ([c9f49f2](https://git.legalplace.eu/legalplace/monorepo/commits/c9f49f2c0195631e8ea1b676a6f32b97ada58615)), closes [api#4892](https://git.legalplace.eu/legalplace/monorepo/issues/4892) [api#4892](https://git.legalplace.eu/legalplace/monorepo/issues/4892)
19
+
20
+
21
+
22
+
23
+
24
+ ## [2.7.3](https://git.legalplace.eu/legalplace/monorepo/compare/@legalplace/wizardx-core@2.7.2...@legalplace/wizardx-core@2.7.3) (2022-02-04)
25
+
26
+
27
+ ### Bug Fixes
28
+
29
+ * deleting iframe on when enabling smartscript if it already exists ([eef02e9](https://git.legalplace.eu/legalplace/monorepo/commits/eef02e915648fe380bca8c5b95fd490966c051c7)), closes [api#4819](https://git.legalplace.eu/legalplace/monorepo/issues/4819)
30
+ * fix typo ([501d8e7](https://git.legalplace.eu/legalplace/monorepo/commits/501d8e738233496f72aea2e2f6d99f3d89a4afad)), closes [api#4819](https://git.legalplace.eu/legalplace/monorepo/issues/4819)
31
+ * fixing bug with smartscript not reinitiating after store destoying api[#4819](https://git.legalplace.eu/legalplace/monorepo/issues/4819) ([e388116](https://git.legalplace.eu/legalplace/monorepo/commits/e3881168e27774289f313a499c607216b50700da))
32
+
33
+
34
+
35
+
36
+
6
37
  ## [2.7.2](https://git.legalplace.eu/legalplace/monorepo/compare/@legalplace/wizardx-core@2.7.1...@legalplace/wizardx-core@2.7.2) (2022-01-26)
7
38
 
8
39
 
package/dist/App.js CHANGED
@@ -14,7 +14,7 @@ import PluginRoute from "./components/PluginRoute";
14
14
  import SmartScriptComponent from "./components/SmartScript";
15
15
  import { clearPlugins } from "./PluginLoader";
16
16
  import { PathReader } from "./libs/PathReader";
17
- import { DANGEROUS_DESTORY_STORE } from "./redux/constants/app";
17
+ import { DANGEROUS_DESTROY_STORE } from "./redux/constants/app";
18
18
  class WizardXCore extends React.Component {
19
19
  constructor(props) {
20
20
  var _a;
@@ -43,7 +43,7 @@ class WizardXCore extends React.Component {
43
43
  createAppStore(historyType);
44
44
  }
45
45
  else {
46
- getStore().dispatch({ type: DANGEROUS_DESTORY_STORE });
46
+ getStore().dispatch({ type: DANGEROUS_DESTROY_STORE });
47
47
  }
48
48
  }
49
49
  componentDidMount() {
@@ -23,4 +23,5 @@ export declare class EvalFunctions extends EvalBase {
23
23
  today: () => string;
24
24
  somme: (varRef: string) => number;
25
25
  lettres: (varRef: string) => string;
26
+ nbChar: (varRef: string) => number;
26
27
  }
@@ -470,6 +470,14 @@ export class EvalFunctions extends EvalBase {
470
470
  }
471
471
  return `D=${result}`;
472
472
  };
473
+ this.nbChar = (varRef) => {
474
+ if (!varTagRegex.test(varRef))
475
+ return 0;
476
+ const variableValue = this.getVariableValue(varRef, false);
477
+ if (!variableValue)
478
+ return 0;
479
+ return `${variableValue}`.trim().length;
480
+ };
473
481
  }
474
482
  parseVariableArgumentDate(varRef) {
475
483
  let result = varRef;
@@ -72,6 +72,7 @@ export class EvalVariable extends EvalFunctions {
72
72
  TODAY: this.today,
73
73
  SOMME: this.somme,
74
74
  LETTRES: this.lettres,
75
+ NB_CHAR: this.nbChar,
75
76
  };
76
77
  const regex = /([a-z_]+)\(([^()]*)\)/gi;
77
78
  let formulas = this.evaluation.match(regex);
@@ -20,5 +20,5 @@ export declare const UPDATE_CURRENT_SECTION_ID = "UPDATE_CURRENT_SECTION_ID";
20
20
  export declare const UPDATE_AVAILABLE_SECTIONS = "UPDATE_AVAILABLE_SECTIONS";
21
21
  export declare const INIT_CUSTOMIZATION_META = "INIT_CUSTOMIZATION_META";
22
22
  export declare const INIT_CUSTOMIZATION_AUTO_DEFAULT = "INIT_CUSTOMIZATION_AUTO_DEFAULT";
23
- export declare const DANGEROUS_DESTORY_STORE = "DANGEROUS_DESTORY_STORE";
23
+ export declare const DANGEROUS_DESTROY_STORE = "DANGEROUS_DESTROY_STORE";
24
24
  export declare const INIT_PLUGINS = "@@INIT_PLUGINS";
@@ -20,5 +20,5 @@ export const UPDATE_CURRENT_SECTION_ID = "UPDATE_CURRENT_SECTION_ID";
20
20
  export const UPDATE_AVAILABLE_SECTIONS = "UPDATE_AVAILABLE_SECTIONS";
21
21
  export const INIT_CUSTOMIZATION_META = "INIT_CUSTOMIZATION_META";
22
22
  export const INIT_CUSTOMIZATION_AUTO_DEFAULT = "INIT_CUSTOMIZATION_AUTO_DEFAULT";
23
- export const DANGEROUS_DESTORY_STORE = "DANGEROUS_DESTORY_STORE";
23
+ export const DANGEROUS_DESTROY_STORE = "DANGEROUS_DESTROY_STORE";
24
24
  export const INIT_PLUGINS = "@@INIT_PLUGINS";
@@ -14,8 +14,7 @@ const watchEnableSmartScript = (mpi, next, action) => {
14
14
  }
15
15
  const iframeElement = document.querySelector("#lp-smartscript");
16
16
  if (iframeElement) {
17
- iframe = iframeElement;
18
- return;
17
+ iframeElement.remove();
19
18
  }
20
19
  iframe = document.createElement("iframe");
21
20
  iframe.id = "lp-smartscript";
@@ -1,4 +1,4 @@
1
- import { DANGEROUS_DESTORY_STORE } from "../constants/app";
1
+ import { DANGEROUS_DESTROY_STORE } from "../constants/app";
2
2
  import selectorsCache from "./cache";
3
3
  let SelectorsStateTrack = -1;
4
4
  let globalMPI;
@@ -31,7 +31,7 @@ export function createSelector(selector, cacheKey) {
31
31
  }
32
32
  export const selectorsMiddleware = (mpi) => (next) => (action) => {
33
33
  const result = next(action);
34
- if (action.type === DANGEROUS_DESTORY_STORE) {
34
+ if (action.type === DANGEROUS_DESTROY_STORE) {
35
35
  selectorsCache.clear();
36
36
  }
37
37
  globalMPI = mpi;
@@ -24,7 +24,7 @@ import { smartscriptReducer } from "./reducers/smartscript";
24
24
  import smartscriptMiddleware from "./middlewares/smartscriptMiddleware";
25
25
  import thirdPartyScriptsMiddleware from "./middlewares/thirdpartyScriptsMiddleware";
26
26
  import { pluginsStoreReducer } from "./reducers/pluginsStore";
27
- import { DANGEROUS_DESTORY_STORE } from "./constants/app";
27
+ import { DANGEROUS_DESTROY_STORE } from "./constants/app";
28
28
  let store;
29
29
  let history = null;
30
30
  export const createAppStore = (historyType = "browser") => {
@@ -41,7 +41,7 @@ export const createAppStore = (historyType = "browser") => {
41
41
  pluginsStore: pluginsStoreReducer,
42
42
  });
43
43
  const rootReducer = (state, action) => {
44
- if (action.type === DANGEROUS_DESTORY_STORE)
44
+ if (action.type === DANGEROUS_DESTROY_STORE)
45
45
  return wizardxReducers(undefined, action);
46
46
  return wizardxReducers(state, action);
47
47
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@legalplace/wizardx-core",
3
- "version": "2.7.2",
3
+ "version": "2.8.0",
4
4
  "author": "Moncef Hammou (moncef@legalplace.fr)",
5
5
  "license": "MIT",
6
6
  "files": [
@@ -24,8 +24,8 @@
24
24
  "@legalplace/lp-events": "1.9.0",
25
25
  "@legalplace/lplogic": "^2.1.6",
26
26
  "@legalplace/model-healthcheck": "^1.1.5",
27
- "@legalplace/referencesparser": "^1.7.0",
28
- "@legalplace/storybook": "2.10.4",
27
+ "@legalplace/referencesparser": "1.7.0",
28
+ "@legalplace/storybook": "2.15.2",
29
29
  "@loadable/component": "^5.15.0",
30
30
  "@redux-saga/core": "^1.1.3",
31
31
  "connected-react-router": "^6.8.0",
@@ -92,5 +92,5 @@
92
92
  "*.test.ts",
93
93
  "*.test.tsx"
94
94
  ],
95
- "gitHead": "8a4945798d82bf0d74385db926c568d6a65bc89b"
95
+ "gitHead": "1aa4f831d70b01f5749a2b6007b098239d9386d3"
96
96
  }