mod-build 4.0.60-beta.1 → 4.0.60-beta.10
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/package.json
CHANGED
|
@@ -3,24 +3,24 @@ import merge from 'lodash.merge';
|
|
|
3
3
|
import axios from 'axios';
|
|
4
4
|
import { defaultSettings } from '../src/data/config.js';
|
|
5
5
|
|
|
6
|
-
function
|
|
6
|
+
function mergeDefaultTradeQuestionsConfigOnSteps(config, steps) {
|
|
7
7
|
if (!config || typeof config !== 'object') return;
|
|
8
8
|
|
|
9
|
-
if (
|
|
10
|
-
|
|
9
|
+
if (config.steps && typeof config.steps === 'object' && config.steps.items) {
|
|
10
|
+
mergeDefaultTradeQuestionsConfig(config, steps);
|
|
11
11
|
}
|
|
12
|
-
|
|
13
|
-
for (const key in
|
|
14
|
-
if (
|
|
15
|
-
const value =
|
|
12
|
+
|
|
13
|
+
for (const key in config) {
|
|
14
|
+
if (config.hasOwnProperty(key)) {
|
|
15
|
+
const value = config[key];
|
|
16
16
|
if (typeof value === 'object' && value !== null) {
|
|
17
|
-
|
|
17
|
+
mergeDefaultTradeQuestionsConfigOnSteps(value, steps);
|
|
18
18
|
}
|
|
19
19
|
}
|
|
20
20
|
}
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
-
function
|
|
23
|
+
function mergeDefaultTradeQuestionsConfig(config, steps) {
|
|
24
24
|
if (!config || !config.steps || !config.steps.items || !Array.isArray(config.steps.items)) {
|
|
25
25
|
return;
|
|
26
26
|
}
|
|
@@ -202,7 +202,7 @@ export default async function(config) {
|
|
|
202
202
|
steps.OwnHome = commonQuestions.OwnHome;
|
|
203
203
|
steps.BuyTimeframe = commonQuestions.BuyTimeframe;
|
|
204
204
|
|
|
205
|
-
|
|
205
|
+
mergeDefaultTradeQuestionsConfigOnSteps(config, steps);
|
|
206
206
|
resolve();
|
|
207
207
|
})
|
|
208
208
|
.catch(error => {
|
package/tasks/templates.js
CHANGED
|
@@ -15,20 +15,18 @@ responseInterceptor(axiosInstance);
|
|
|
15
15
|
responseInterceptor(tcpaAxiosInstance);
|
|
16
16
|
responseInterceptor(consentCaptureAxiosInstance);
|
|
17
17
|
|
|
18
|
-
async function
|
|
18
|
+
async function mergeDefaultFormFieldConfigOnSteps(defaultConfig, data, parentConfig) {
|
|
19
19
|
if (!data || typeof data !== 'object') return;
|
|
20
20
|
|
|
21
|
-
// If "steps" is an object, merge its config
|
|
22
21
|
if (data.steps && typeof data.steps === 'object') {
|
|
23
22
|
data.steps = await mergeDefaultFormFieldConfig(defaultConfig, data, parentConfig);
|
|
24
23
|
}
|
|
25
24
|
|
|
26
|
-
// Recursively go through all object properties
|
|
27
25
|
for (const key in data) {
|
|
28
26
|
if (data.hasOwnProperty(key)) {
|
|
29
27
|
const value = data[key];
|
|
30
28
|
if (typeof value === 'object' && value !== null) {
|
|
31
|
-
await
|
|
29
|
+
await mergeDefaultFormFieldConfigOnSteps(defaultConfig, value, parentConfig);
|
|
32
30
|
}
|
|
33
31
|
}
|
|
34
32
|
}
|
|
@@ -79,7 +77,7 @@ const getDefaultFormFieldConfig = async (config, folder = 'accessible-components
|
|
|
79
77
|
throw new Error(`${resp.status}: Error while fetching ${folder}/defaultFormFieldConfig.json`);
|
|
80
78
|
}
|
|
81
79
|
const defaultConfig = resp.data;
|
|
82
|
-
|
|
80
|
+
mergeDefaultFormFieldConfigOnSteps(defaultConfig, config, config);
|
|
83
81
|
resolve();
|
|
84
82
|
}).catch(error => {
|
|
85
83
|
console.error(error);
|