@legalplace/wizardx-core 2.8.0 → 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,22 @@
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
+
6
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)
7
23
 
8
24
 
@@ -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.8.0",
3
+ "version": "2.9.0",
4
4
  "author": "Moncef Hammou (moncef@legalplace.fr)",
5
5
  "license": "MIT",
6
6
  "files": [
@@ -92,5 +92,5 @@
92
92
  "*.test.ts",
93
93
  "*.test.tsx"
94
94
  ],
95
- "gitHead": "1aa4f831d70b01f5749a2b6007b098239d9386d3"
95
+ "gitHead": "f3ed0ece014d034c7b0c4dd431ee979fb251be90"
96
96
  }