@legalplace/wizardx-core 2.7.3 → 2.9.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,40 @@
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.9.0](https://git.legalplace.eu/legalplace/monorepo/compare/@legalplace/wizardx-core@2.8.0...@legalplace/wizardx-core@2.9.0) (2022-04-06)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * fix failing test api[#5256](https://git.legalplace.eu/legalplace/monorepo/issues/5256) ([19a60df](https://git.legalplace.eu/legalplace/monorepo/commits/19a60dfa4573a6a3d9709645291770e8d236d06d))
12
+
13
+
14
+ ### Features
15
+
16
+ * adding redirectOverride api[#5256](https://git.legalplace.eu/legalplace/monorepo/issues/5256) ([fc84961](https://git.legalplace.eu/legalplace/monorepo/commits/fc849615ad3ebbaebc147de2bc45092b10958db3))
17
+
18
+
19
+
20
+
21
+
22
+ # [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)
23
+
24
+
25
+ ### Bug Fixes
26
+
27
+ * 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)
28
+ * linting ([250d797](https://git.legalplace.eu/legalplace/monorepo/commits/250d797e7e19bbbbc0b2848a9654899ae1bd79d1)), closes [api#4892](https://git.legalplace.eu/legalplace/monorepo/issues/4892)
29
+ * 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)
30
+
31
+
32
+ ### Features
33
+
34
+ * 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)
35
+
36
+
37
+
38
+
39
+
6
40
  ## [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)
7
41
 
8
42
 
@@ -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);
@@ -7,7 +7,7 @@ export declare const actionsLibrary: {
7
7
  appStates: string[];
8
8
  enableShadowInstance: boolean;
9
9
  }, wizardConfig: import("../..").WizardConfigResponse) => import("../..").ActionsType.Sagas.Model.fetchModel;
10
- saveDataAction: (redirect?: boolean, confirmAnswer?: boolean | undefined, redirectFallback?: string | undefined, additionalProperties?: Record<string, string | number> | undefined) => import("../..").ActionsType.Sagas.Data.saveData;
10
+ saveDataAction: (redirect?: boolean, confirmAnswer?: boolean | undefined, redirectFallback?: string | undefined, redirectOverride?: string | undefined, additionalProperties?: Record<string, string | number> | undefined) => import("../..").ActionsType.Sagas.Data.saveData;
11
11
  initUserAction: (user: Omit<import("../..").StateType.User, "status">) => import("../..").ActionsType.User.initUser;
12
12
  setUserStatusAction: (status: "failed" | "authenticated" | "unauthenticated" | "inprogress") => import("../..").ActionsType.User.setUserStatus;
13
13
  setUserValidTokenAction: (validToken: boolean) => import("../..").ActionsType.User.setUserValidToken;
@@ -1,2 +1,2 @@
1
1
  import { ActionsType } from "../../../types/Actions.type";
2
- export declare const saveDataAction: (redirect?: boolean, confirmAnswer?: boolean | undefined, redirectFallback?: string | undefined, additionalProperties?: Record<string, string | number> | undefined) => ActionsType.Sagas.Data.saveData;
2
+ export declare const saveDataAction: (redirect?: boolean, confirmAnswer?: boolean | undefined, redirectFallback?: string | undefined, redirectOverride?: string | undefined, additionalProperties?: Record<string, string | number> | undefined) => ActionsType.Sagas.Data.saveData;
@@ -1,8 +1,9 @@
1
1
  import { SAVE_DATA } from "../../constants/sagas/data";
2
- export const saveDataAction = (redirect = false, confirmAnswer, redirectFallback, additionalProperties) => ({
2
+ export const saveDataAction = (redirect = false, confirmAnswer, redirectFallback, redirectOverride, additionalProperties) => ({
3
3
  type: SAVE_DATA,
4
4
  confirmAnswer,
5
5
  redirect,
6
6
  redirectFallback,
7
+ redirectOverride,
7
8
  additionalProperties,
8
9
  });
@@ -6,5 +6,6 @@ it('Returns saveData action properkt', () => {
6
6
  type: 'SAVE_DATA',
7
7
  redirect: false,
8
8
  redirectFallback: undefined,
9
+ redirectOverride: undefined,
9
10
  });
10
11
  });
@@ -15,13 +15,12 @@ function* saveDataDecorator(action) {
15
15
  const response = yield call(fetch, ...updateInstanceArguments(permalink, uniqid, OvcConverter.convertToOvc(selectInputs()), action.confirmAnswer ? 0 : 1, action.additionalProperties));
16
16
  const responseData = yield call([response, "json"]);
17
17
  if (action.redirect === true) {
18
- if (responseData.redirect_to) {
18
+ const redirectTo = action.redirectOverride ||
19
+ responseData.redirect_to ||
20
+ action.redirectFallback;
21
+ if (redirectTo) {
19
22
  window.onbeforeunload = () => { };
20
- window.location.href = responseData.redirect_to;
21
- }
22
- else if (action.redirectFallback) {
23
- window.onbeforeunload = () => { };
24
- window.location.href = action.redirectFallback;
23
+ window.location.href = redirectTo;
25
24
  }
26
25
  }
27
26
  yield put(setDataStatus("saved"));
@@ -304,6 +304,7 @@ export declare namespace ActionsType {
304
304
  type: typeof SAVE_DATA;
305
305
  confirmAnswer?: boolean;
306
306
  redirect: boolean;
307
+ redirectOverride?: string;
307
308
  redirectFallback?: string;
308
309
  additionalProperties?: Record<string, number | string>;
309
310
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@legalplace/wizardx-core",
3
- "version": "2.7.3",
3
+ "version": "2.9.0",
4
4
  "author": "Moncef Hammou (moncef@legalplace.fr)",
5
5
  "license": "MIT",
6
6
  "files": [
@@ -25,7 +25,7 @@
25
25
  "@legalplace/lplogic": "^2.1.6",
26
26
  "@legalplace/model-healthcheck": "^1.1.5",
27
27
  "@legalplace/referencesparser": "1.7.0",
28
- "@legalplace/storybook": "2.10.4",
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": "f4ea7039248325fe53657ed389811df632fb14a1"
95
+ "gitHead": "f3ed0ece014d034c7b0c4dd431ee979fb251be90"
96
96
  }