mod-build 3.6.93-beta.1 → 3.6.94-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
CHANGED
package/gulp-tasks/js-lint.js
CHANGED
package/gulp-tasks/templates.js
CHANGED
|
@@ -19,13 +19,42 @@ module.exports = function(gulp, gulpPlugins, siteSettings, siteData) {
|
|
|
19
19
|
// Checking for seasonal variations in the template.js + updating content
|
|
20
20
|
var checkSeasonalVariations = require('./check-seasonal-variations.js');
|
|
21
21
|
const activeSeason = checkSeasonalVariations();
|
|
22
|
+
const HVACInterestStepName = 'HVACInterest';
|
|
23
|
+
const season = 'warmerWeather';
|
|
22
24
|
if (activeSeason.length !== 0) {
|
|
23
|
-
if (
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
25
|
+
if (activeSeason.includes(season)) {
|
|
26
|
+
const data = JSON.stringify(siteData, null, 4);
|
|
27
|
+
const heating = '(Heating|calentadores)';
|
|
28
|
+
const and = '(&|and|y)';
|
|
29
|
+
const ac = '(AC|Cooling|aires.*?acondicionados)';
|
|
30
|
+
const spaces = '.*?';
|
|
31
|
+
|
|
32
|
+
const regex = new RegExp(`${heating}${spaces}${and}${spaces}${ac}`, 'gm');
|
|
33
|
+
// Find and reverse the required words in the string using regex group capture
|
|
34
|
+
const processedData = data.replaceAll(regex, '$3 $2 $1');
|
|
35
|
+
// console.log('processedData', processedData);
|
|
36
|
+
// Convert data into JSON
|
|
37
|
+
siteData = JSON.parse(processedData);
|
|
38
|
+
// Find the HVACInterest step and reverse the options array
|
|
39
|
+
if (siteData.steps && (siteData.steps.items && siteData.steps.items.length)) {
|
|
40
|
+
siteData.steps.items.forEach(function(step) {
|
|
41
|
+
const isHvacInterestStep = step && (step.stepName && step.stepName === HVACInterestStepName) || (step.attributes && step.attributes.data && step.attributes.data['step-name'] === HVACInterestStepName);
|
|
42
|
+
if (isHvacInterestStep) {
|
|
43
|
+
const stepFields = step.fields || step.stepContent.fields;
|
|
44
|
+
if (stepFields && stepFields.length) {
|
|
45
|
+
stepFields.forEach(function(field) {
|
|
46
|
+
field.options = field.options.reverse();
|
|
47
|
+
field.options.some(function(option) {
|
|
48
|
+
if (option.checked) {
|
|
49
|
+
option.checked = false;
|
|
50
|
+
field.options[0].checked = true;
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
}
|
|
29
58
|
}
|
|
30
59
|
}
|
|
31
60
|
|
|
@@ -214,7 +243,7 @@ module.exports = function(gulp, gulpPlugins, siteSettings, siteData) {
|
|
|
214
243
|
console.time('Finished fetch-default-form-config after');
|
|
215
244
|
console.log('Starting fetch-default-form-config: ');
|
|
216
245
|
await new Promise((resolve) => {
|
|
217
|
-
request(`https://${siteSettings.nodeEnv}/quote/resources/mod-site/${folder}/steps/defaultFormFieldConfig.json`, async function(
|
|
246
|
+
request(`https://${siteSettings.nodeEnv}/quote/resources/mod-site/${folder}/steps/defaultFormFieldConfig.json`, async function(_err, xhr, response) {
|
|
218
247
|
if (xhr.statusCode !== 200) {
|
|
219
248
|
throw new Error(`${xhr.statusCode}: Error while fetching ${folder}/defaultFormFieldConfig.json`);
|
|
220
249
|
}
|
|
@@ -253,7 +282,7 @@ module.exports = function(gulp, gulpPlugins, siteSettings, siteData) {
|
|
|
253
282
|
console.time('Finished fetch-tcpa-from-sitegenie after');
|
|
254
283
|
console.log('Starting fetch-tcpa-from-sitegenie: ',url);
|
|
255
284
|
await new Promise(function(resolve) {
|
|
256
|
-
request(reqConfig, async function(
|
|
285
|
+
request(reqConfig, async function(_err, xhr, response) {
|
|
257
286
|
if (xhr.statusCode !== 200) {
|
|
258
287
|
throw new Error(`${xhr.statusCode}: Error while fetching TCPA`);
|
|
259
288
|
}
|
package/package.json
CHANGED