mod-build 3.6.94-beta.4 → 3.6.94-beta.5
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/gulp-tasks/templates.js +19 -8
- package/package.json +1 -1
package/gulp-tasks/templates.js
CHANGED
|
@@ -19,14 +19,16 @@ 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
|
|
23
|
-
const
|
|
22
|
+
const HVAC_INTEREST = 'HVACInterest';
|
|
23
|
+
const SEASON = 'warmerWeather';
|
|
24
|
+
const CENTRAL_AC = 'Central AC';
|
|
25
|
+
const CENTRAL_HEATING = 'Central Heating';
|
|
24
26
|
if (activeSeason.length !== 0) {
|
|
25
|
-
if (activeSeason.includes(
|
|
27
|
+
if (activeSeason.includes(SEASON)) {
|
|
26
28
|
const data = JSON.stringify(siteData, null, 4);
|
|
27
|
-
const heating = '(Heating|
|
|
28
|
-
const and = '(
|
|
29
|
-
const ac = '(AC|Cooling|
|
|
29
|
+
const heating = '(Heating|calentadores)';
|
|
30
|
+
const and = '(&|and|y)';
|
|
31
|
+
const ac = '(AC|Cooling|aires.*?acondicionados)';
|
|
30
32
|
const spaces = '.*?';
|
|
31
33
|
|
|
32
34
|
const regex = new RegExp(`${heating}${spaces}${and}${spaces}${ac}`, 'gm');
|
|
@@ -37,12 +39,21 @@ module.exports = function(gulp, gulpPlugins, siteSettings, siteData) {
|
|
|
37
39
|
// Find the HVACInterest step and reverse the options array
|
|
38
40
|
if (siteData.steps && (siteData.steps.items && siteData.steps.items.length)) {
|
|
39
41
|
siteData.steps.items.forEach(function(step) {
|
|
40
|
-
const isHvacInterestStep = step && (step.stepName && step.stepName ===
|
|
42
|
+
const isHvacInterestStep = step && (step.stepName && step.stepName === HVAC_INTEREST) || (step.attributes && step.attributes.data && step.attributes.data['step-name'] === HVAC_INTEREST);
|
|
41
43
|
if (isHvacInterestStep) {
|
|
42
44
|
const stepFields = step.fields || step.stepContent.fields;
|
|
43
45
|
if (stepFields && stepFields.length) {
|
|
44
46
|
stepFields.forEach(function(field) {
|
|
45
|
-
|
|
47
|
+
const firstOption = field.options[0];
|
|
48
|
+
const lastOption = field.options[field.options.length - 1];
|
|
49
|
+
const firstOptionIsCentralHeating = (firstOption.attributes && firstOption.attributes.value === CENTRAL_HEATING) || firstOption.value === CENTRAL_HEATING;
|
|
50
|
+
const lastOptionIsCentralAC = (lastOption.attributes && lastOption.attributes.value === CENTRAL_AC) || lastOption.value === CENTRAL_AC;
|
|
51
|
+
|
|
52
|
+
if (firstOptionIsCentralHeating && lastOptionIsCentralAC) {
|
|
53
|
+
field.options[0] = lastOption;
|
|
54
|
+
field.options[field.options.length - 1] = firstOption;
|
|
55
|
+
}
|
|
56
|
+
|
|
46
57
|
field.options.some(function(option) {
|
|
47
58
|
if (option.checked) {
|
|
48
59
|
option.checked = false;
|