mod-build 4.0.76-beta.7 → 4.0.78-beta.1
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 +4 -0
- package/package.json +1 -1
- package/tasks/templates.js +29 -27
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 4.0.78
|
|
4
|
+
|
|
5
|
+
- Updating `mergeDefaultFormFieldConfig` to be recursive and merge to nested fields (so we can wrap multiple fields in a `fieldset`).
|
|
6
|
+
|
|
3
7
|
## 4.0.76
|
|
4
8
|
|
|
5
9
|
- Discarded usage of qs_gtm_container_id and has-qs-params function, which is no longer necessary and we will only rely on gtm_container_id that is set in site config
|
package/package.json
CHANGED
package/tasks/templates.js
CHANGED
|
@@ -18,7 +18,9 @@ responseInterceptor(tcpaAxiosInstance);
|
|
|
18
18
|
responseInterceptor(consentCaptureAxiosInstance);
|
|
19
19
|
|
|
20
20
|
async function mergeDefaultFormFieldConfigOnSteps(defaultConfig, data, parentConfig) {
|
|
21
|
-
if (!data || typeof data !== 'object')
|
|
21
|
+
if (!data || typeof data !== 'object') {
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
22
24
|
|
|
23
25
|
if (data.steps && typeof data.steps === 'object') {
|
|
24
26
|
data.steps = await mergeDefaultFormFieldConfig(defaultConfig, data, parentConfig);
|
|
@@ -42,31 +44,35 @@ function mergeDefaultFormFieldConfig(defaultConfig, config, parentConfig) {
|
|
|
42
44
|
return steps;
|
|
43
45
|
}
|
|
44
46
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
field = Object.assign(cloneDeep(defaultConfig[field.name]), field);
|
|
62
|
-
}
|
|
63
|
-
return field;
|
|
64
|
-
});
|
|
47
|
+
steps.items.forEach(item => {
|
|
48
|
+
processFieldsInObject(defaultConfig, item);
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
return steps;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
function processFieldsInObject(defaultConfig, obj) {
|
|
55
|
+
if (!obj || typeof obj !== 'object') {
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
if (obj.fields && Array.isArray(obj.fields)) {
|
|
60
|
+
obj.fields = obj.fields.map(field => {
|
|
61
|
+
if (field.attributes && field.attributes.name && defaultConfig[field.attributes.name]) {
|
|
62
|
+
field = merge(cloneDeep(defaultConfig[field.attributes.name]), field);
|
|
65
63
|
}
|
|
64
|
+
return field;
|
|
66
65
|
});
|
|
67
66
|
}
|
|
68
67
|
|
|
69
|
-
|
|
68
|
+
for (const key in obj) {
|
|
69
|
+
if (obj.hasOwnProperty(key)) {
|
|
70
|
+
const value = obj[key];
|
|
71
|
+
if (typeof value === 'object' && value !== null) {
|
|
72
|
+
processFieldsInObject(defaultConfig, value);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|
|
70
76
|
}
|
|
71
77
|
|
|
72
78
|
const getDefaultFormFieldConfig = async (config, folder = 'accessible-components') => {
|
|
@@ -283,11 +289,7 @@ export default async function(config) {
|
|
|
283
289
|
|
|
284
290
|
if (Object.keys(config).length > 0) {
|
|
285
291
|
if (!config.doNotUseDefaultFieldConfig && !tempConfigCreated) {
|
|
286
|
-
|
|
287
|
-
await getDefaultFormFieldConfig(config, 'accessible-components');
|
|
288
|
-
} else {
|
|
289
|
-
await getDefaultFormFieldConfig(config, 'shared-components');
|
|
290
|
-
}
|
|
292
|
+
await getDefaultFormFieldConfig(config, 'accessible-components');
|
|
291
293
|
}
|
|
292
294
|
if (!config.tcpaText && config.primary_trade && !tempConfigCreated) {
|
|
293
295
|
await fetchTcpaFromSitegenie(config, tempConfig, pathSubdirectory);
|