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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mod-build",
3
- "version": "4.0.60-beta.1",
3
+ "version": "4.0.60-beta.10",
4
4
  "description": "Share components for S3 sites.",
5
5
  "type": "module",
6
6
  "scripts": {
@@ -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 applyDefaultTradeConfigOnSteps(config, steps) {
6
+ function mergeDefaultTradeQuestionsConfigOnSteps(config, steps) {
7
7
  if (!config || typeof config !== 'object') return;
8
8
 
9
- if (data.steps && typeof data.steps === 'object' && data.steps.items) {
10
- mergeDefaultTradeQuestions(config, steps);
9
+ if (config.steps && typeof config.steps === 'object' && config.steps.items) {
10
+ mergeDefaultTradeQuestionsConfig(config, steps);
11
11
  }
12
- // Recursively go through all object properties
13
- for (const key in data) {
14
- if (data.hasOwnProperty(key)) {
15
- const value = data[key];
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
- applyDefaultTradeConfigOnSteps(value, steps);
17
+ mergeDefaultTradeQuestionsConfigOnSteps(value, steps);
18
18
  }
19
19
  }
20
20
  }
21
21
  }
22
22
 
23
- function mergeDefaultTradeQuestions(config, steps) {
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
- applyDefaultTradeConfigOnSteps(config, steps);
205
+ mergeDefaultTradeQuestionsConfigOnSteps(config, steps);
206
206
  resolve();
207
207
  })
208
208
  .catch(error => {
@@ -15,20 +15,18 @@ responseInterceptor(axiosInstance);
15
15
  responseInterceptor(tcpaAxiosInstance);
16
16
  responseInterceptor(consentCaptureAxiosInstance);
17
17
 
18
- async function applyDefaultConfigOnSteps(defaultConfig, data, parentConfig) {
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 applyDefaultConfigOnSteps(defaultConfig, value, parentConfig);
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
- applyDefaultConfigOnSteps(defaultConfig, config, config);
80
+ mergeDefaultFormFieldConfigOnSteps(defaultConfig, config, config);
83
81
  resolve();
84
82
  }).catch(error => {
85
83
  console.error(error);