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
@@ -1,5 +1,9 @@
1
1
  # Changelog
2
2
 
3
+ ## 3.6.94
4
+
5
+ - Fixed bugs in seasonal updates
6
+
3
7
  ## 3.6.93
4
8
 
5
9
  - updated grab-cdn task to pull geolocation script
@@ -1,4 +1,4 @@
1
- module.exports = function(gulp, gulpPlugins, siteSettings) {
1
+ module.exports = function(gulp, _gulpPlugins, siteSettings) {
2
2
  var fs = require('fs');
3
3
  var gulpESLintNew = require('gulp-eslint-new');
4
4
 
@@ -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 (siteData.seasonalVariations) {
24
- activeSeason.forEach(season => {
25
- if (season in siteData.seasonalVariations) {
26
- siteData = merge(siteData, siteData.seasonalVariations[season]);
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(err, xhr, response) {
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(err, xhr, response) {
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mod-build",
3
- "version": "3.6.93-beta.1",
3
+ "version": "3.6.94-beta.1",
4
4
  "description": "Share components for S3 sites.",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1",
@@ -1,5 +1,4 @@
1
1
  var _vwo_clicks=25;
2
- var _vis_opt_cookieDays=1;
3
2
  var _vwo_code=(function(){
4
3
  var account_id=37264,
5
4
  settings_tolerance=4000,