@legalplace/wizardx-core 2.1.0-alpha.7 → 2.1.0-alpha.8
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,17 @@
|
|
|
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.1.0-alpha.8](https://git.legalplace.eu/legalplace/monorepo/compare/@legalplace/wizardx-core@2.1.0-alpha.7...@legalplace/wizardx-core@2.1.0-alpha.8) (2021-11-24)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* fixing issue with smartscript not getting executed after init_inputs api[#3338](https://git.legalplace.eu/legalplace/monorepo/issues/3338) ([2c96fd6](https://git.legalplace.eu/legalplace/monorepo/commits/2c96fd63a6d2e7685e75ee9125a4759831548139))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
6
17
|
# [2.1.0-alpha.7](https://git.legalplace.eu/legalplace/monorepo/compare/@legalplace/wizardx-core@2.1.0-alpha.6...@legalplace/wizardx-core@2.1.0-alpha.7) (2021-11-24)
|
|
7
18
|
|
|
8
19
|
**Note:** Version bump only for package @legalplace/wizardx-core
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import cloneDeep from 'lodash/cloneDeep';
|
|
2
2
|
import { generatePath } from 'react-router-dom';
|
|
3
3
|
import { getConfig } from '../../config';
|
|
4
|
-
import { ADD_MULTIPLE_OCCURENCY, DELETE_MULTIPLE_OCCURENCY, UPDATE_OPTION_INPUT, UPDATE_VARIABLE_INPUT, } from '../constants/inputs';
|
|
4
|
+
import { INIT_INPUTS, ADD_MULTIPLE_OCCURENCY, DELETE_MULTIPLE_OCCURENCY, UPDATE_OPTION_INPUT, UPDATE_VARIABLE_INPUT, } from '../constants/inputs';
|
|
5
5
|
import { ENABLE_SMARTSCRIPT } from '../constants/smartscript';
|
|
6
6
|
import { PathReader } from '../../libs/PathReader';
|
|
7
7
|
import { initSmartscriptTriggersAction } from '../actions/smartscript';
|
|
8
|
+
import { updateOptionAction, updateVariableAction } from '../actions/inputs';
|
|
8
9
|
let iframe = null;
|
|
9
10
|
const watchEnableSmartScript = (mpi, next, action) => {
|
|
10
11
|
next(action);
|
|
@@ -77,12 +78,29 @@ const watchUpdateVariableInput = (mpi, next, action) => {
|
|
|
77
78
|
}
|
|
78
79
|
}
|
|
79
80
|
};
|
|
81
|
+
const watchInitInputs = (mpi, next, action) => {
|
|
82
|
+
next(action);
|
|
83
|
+
if (!iframe)
|
|
84
|
+
return;
|
|
85
|
+
const { inputs } = action;
|
|
86
|
+
Object.keys(inputs.options).forEach((id) => {
|
|
87
|
+
inputs.options[id].forEach((value, index) => {
|
|
88
|
+
watchUpdateOptionInput(mpi, next, updateOptionAction(parseInt(id, 10), value, index));
|
|
89
|
+
});
|
|
90
|
+
});
|
|
91
|
+
Object.keys(inputs.variables).forEach((id) => {
|
|
92
|
+
inputs.variables[id].forEach((value, index) => {
|
|
93
|
+
watchUpdateVariableInput(mpi, next, updateVariableAction(parseInt(id, 10), value, index));
|
|
94
|
+
});
|
|
95
|
+
});
|
|
96
|
+
};
|
|
80
97
|
const watchersEnum = {
|
|
81
98
|
[ENABLE_SMARTSCRIPT]: watchEnableSmartScript,
|
|
82
99
|
[UPDATE_OPTION_INPUT]: watchUpdateOptionInput,
|
|
83
100
|
[UPDATE_VARIABLE_INPUT]: watchUpdateVariableInput,
|
|
84
101
|
[ADD_MULTIPLE_OCCURENCY]: watchUpdateOptionInput,
|
|
85
102
|
[DELETE_MULTIPLE_OCCURENCY]: watchUpdateOptionInput,
|
|
103
|
+
[INIT_INPUTS]: watchInitInputs,
|
|
86
104
|
};
|
|
87
105
|
const smartscriptMiddleware = (mpi) => (next) => (action) => {
|
|
88
106
|
if (Object.prototype.hasOwnProperty.call(watchersEnum, action.type)) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@legalplace/wizardx-core",
|
|
3
|
-
"version": "2.1.0-alpha.
|
|
3
|
+
"version": "2.1.0-alpha.8",
|
|
4
4
|
"author": "Moncef Hammou (moncef@legalplace.fr)",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -82,5 +82,5 @@
|
|
|
82
82
|
"*.test.ts",
|
|
83
83
|
"*.test.tsx"
|
|
84
84
|
],
|
|
85
|
-
"gitHead": "
|
|
85
|
+
"gitHead": "0a4659362a7638da0f383cb340626b6beba60e72"
|
|
86
86
|
}
|
|
@@ -14,6 +14,7 @@ import {
|
|
|
14
14
|
import { ENABLE_SMARTSCRIPT } from '../constants/smartscript';
|
|
15
15
|
import { PathReader } from '../../libs/PathReader';
|
|
16
16
|
import { initSmartscriptTriggersAction } from '../actions/smartscript';
|
|
17
|
+
import { updateOptionAction, updateVariableAction } from '../actions/inputs';
|
|
17
18
|
|
|
18
19
|
let iframe: HTMLIFrameElement | null = null;
|
|
19
20
|
|
|
@@ -154,6 +155,44 @@ const watchUpdateVariableInput = (
|
|
|
154
155
|
}
|
|
155
156
|
};
|
|
156
157
|
|
|
158
|
+
/**
|
|
159
|
+
* Watches inputs init
|
|
160
|
+
* @param mpi MiddlewareAPI
|
|
161
|
+
* @param next Dispatch function
|
|
162
|
+
* @param action INIT_INPUT action
|
|
163
|
+
*/
|
|
164
|
+
const watchInitInputs = (
|
|
165
|
+
mpi: MiddlewareAPI<Dispatch, StateType>,
|
|
166
|
+
next: Dispatch,
|
|
167
|
+
action: ActionsType.Inputs.initInputs
|
|
168
|
+
) => {
|
|
169
|
+
next(action);
|
|
170
|
+
|
|
171
|
+
if (!iframe) return;
|
|
172
|
+
|
|
173
|
+
const { inputs } = action;
|
|
174
|
+
|
|
175
|
+
Object.keys(inputs.options).forEach((id) => {
|
|
176
|
+
inputs.options[id].forEach((value, index) => {
|
|
177
|
+
watchUpdateOptionInput(
|
|
178
|
+
mpi,
|
|
179
|
+
next,
|
|
180
|
+
updateOptionAction(parseInt(id, 10), value, index)
|
|
181
|
+
);
|
|
182
|
+
});
|
|
183
|
+
});
|
|
184
|
+
|
|
185
|
+
Object.keys(inputs.variables).forEach((id) => {
|
|
186
|
+
inputs.variables[id].forEach((value, index) => {
|
|
187
|
+
watchUpdateVariableInput(
|
|
188
|
+
mpi,
|
|
189
|
+
next,
|
|
190
|
+
updateVariableAction(parseInt(id, 10), value, index)
|
|
191
|
+
);
|
|
192
|
+
});
|
|
193
|
+
});
|
|
194
|
+
};
|
|
195
|
+
|
|
157
196
|
export type WatcherActions =
|
|
158
197
|
| ActionsType.SmartScript.enableSmartScript
|
|
159
198
|
| ActionsType.Inputs.updateOptionInput
|
|
@@ -169,6 +208,7 @@ const watchersEnum: Record<
|
|
|
169
208
|
[UPDATE_VARIABLE_INPUT]: watchUpdateVariableInput,
|
|
170
209
|
[ADD_MULTIPLE_OCCURENCY]: watchUpdateOptionInput,
|
|
171
210
|
[DELETE_MULTIPLE_OCCURENCY]: watchUpdateOptionInput,
|
|
211
|
+
[INIT_INPUTS]: watchInitInputs,
|
|
172
212
|
};
|
|
173
213
|
|
|
174
214
|
/**
|