mod-build 3.7.1 → 3.7.2-7.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.
Files changed (41) hide show
  1. package/CHANGELOG.md +96 -0
  2. package/gulp-tasks/build.js +4 -4
  3. package/gulp-tasks/get-default-trade-questions.js +155 -0
  4. package/gulp-tasks/grab-cdn.js +26 -21
  5. package/gulp-tasks/grab-mhsadmin-data.js +418 -0
  6. package/gulp-tasks/grab-section-deals-components.js +47 -0
  7. package/gulp-tasks/grab-shared-scripts.js +21 -5
  8. package/gulp-tasks/serve.js +5 -5
  9. package/gulp-tasks/tasks.js +36 -3
  10. package/gulp-tasks/templates.js +95 -12
  11. package/package.json +1 -1
  12. package/src/scripts/vendor/heap-addeventproperties-identify.js +1 -1
  13. package/src/scripts/vendor/heap-tracking.js +1 -1
  14. package/src/scripts/vendor/heap-vwo.js +1 -1
  15. package/src/scripts/vendor/visual-website-optimizer.js +7 -8
  16. package/src/templates/_partials/scripts/vwo-redirect-callback.html +20 -0
  17. package/src/trade-questions/alerts_medical.js +111 -0
  18. package/src/trade-questions/bathroom_refacing.js +96 -0
  19. package/src/trade-questions/cabinet_refacing.js +251 -0
  20. package/src/trade-questions/cabinets.js +35 -0
  21. package/src/trade-questions/concrete_foundation.js +57 -0
  22. package/src/trade-questions/door.js +143 -0
  23. package/src/trade-questions/flooring.js +185 -0
  24. package/src/trade-questions/garage_door.js +89 -0
  25. package/src/trade-questions/gutters.js +45 -0
  26. package/src/trade-questions/home_security.js +130 -0
  27. package/src/trade-questions/home_warranty.js +57 -0
  28. package/src/trade-questions/hot_tubs.js +92 -0
  29. package/src/trade-questions/hvac.js +179 -0
  30. package/src/trade-questions/index.js +26 -0
  31. package/src/trade-questions/insulation.js +118 -0
  32. package/src/trade-questions/plumbing.js +260 -0
  33. package/src/trade-questions/roofing.js +118 -0
  34. package/src/trade-questions/siding.js +150 -0
  35. package/src/trade-questions/solar.js +69 -0
  36. package/src/trade-questions/stair_lifts.js +47 -0
  37. package/src/trade-questions/tree_services.js +169 -0
  38. package/src/trade-questions/walk_in_tubs.js +47 -0
  39. package/src/trade-questions/water_treatment.js +48 -0
  40. package/src/trade-questions/windows.js +132 -0
  41. package/src/trade-questions-config.js +139 -0
package/CHANGELOG.md CHANGED
@@ -1,5 +1,101 @@
1
1
  # Changelog
2
2
 
3
+ ## 3.7.27
4
+
5
+ - Adding VWO variation ID to the body tag as an attribute `data-vwo-test-id`.
6
+
7
+ ## 3.7.26
8
+
9
+ - Added jacuzzi in the sites that should have tcpa below the cta.
10
+
11
+ ## 3.7.25
12
+
13
+ - Upgraded to new VWO smart code.
14
+
15
+ ## 3.7.24
16
+
17
+ - Removed `GUTTERS`, `GUTTER_COVERS`, & `SOLAR` from the TCPA placement configurations.
18
+
19
+ ## 3.7.23
20
+
21
+ - Added `geolocation.min.js` to the `grab-shared-scripts` task to grab & hash that file during build (leaving the file in `grab-cdn` task to not break what is currently there).
22
+
23
+ ## 3.7.22
24
+
25
+ - Added extra conditions for `addTcpaAboveCta` and `addTcpaBelowCta` helper functions to not break when required data is not passed.
26
+
27
+ ## 3.7.21
28
+
29
+ - Added `GUTTERS` & `GUTTER_COVERS` to the `addTcpaAboveCta` and `addTcpaBelowCta` configurations.
30
+
31
+ ## 3.7.20
32
+
33
+ - Added `addTcpaAboveCta` and `addTcpaBelowCta` helper functions to determine where tcpa should be placed based on trade/branded conditions.
34
+
35
+ ## 3.7.19
36
+
37
+ - Added missed attributes in global questions config of siding and tree services.
38
+
39
+ ## 3.7.18
40
+
41
+ - Fixing console log
42
+
43
+ ## 3.7.17
44
+
45
+ - Added in the outer `ServiceType` missing object for Water Treatment trade questions config.
46
+
47
+ ## 3.7.16
48
+
49
+ - Added the new `getDataAttributeValue` helper function; Also updated the generic error language in `get-default-trade-questions`.
50
+
51
+ ## 3.7.15
52
+
53
+ - Added the Clients List modal to be grabbed as part of the `grab-cdn` task.
54
+
55
+ ## 3.7.14
56
+
57
+ - Added trade steps configs.
58
+
59
+ ## 3.7.13
60
+
61
+ - An enhancement has been added to the `getConsentCaptureLanguage()` function to replace the subdirectory path throughout the response object.
62
+
63
+ ## 3.7.12
64
+
65
+ - Added the E-Sign Consent modal to be grabbed as part of the `grab-cdn` task.
66
+
67
+ ## 3.7.11
68
+
69
+ - Added branded name to `brandedIncludeExclusivelyConsentCapture` object in consent capture.
70
+
71
+ ## 3.7.10
72
+
73
+ - Included an option for `service` to be appended to the `brandedIncludeServiceConsentCapture` for consent capture.
74
+
75
+ ## 3.7.9
76
+
77
+ - Updated `isBranded` sites to grab the display name from HS Form Service API to add to the `brandedConsentLanguage`.
78
+
79
+ ## 3.7.8
80
+
81
+ - removed race condition from grab-cdn task.
82
+
83
+ ## 3.7.6
84
+
85
+ - Removing all the `!window.Modalytics.privacyPreferencesDetected` conditionals (as we are no longer moving forward with this integration).
86
+
87
+ ## 3.7.5
88
+
89
+ - fixed trade directory name issue for section deals pages
90
+
91
+ ## 3.7.4
92
+
93
+ - Added small enhancements in `grab-mhsadmin-data`
94
+
95
+ ## 3.7.3
96
+
97
+ - Added `grab-section-deals-components` and `grab-mhsadmin-data` tasks for section deals pages.
98
+
3
99
  ## 3.7.1
4
100
 
5
101
  - updated clean task.
@@ -5,15 +5,15 @@ module.exports = function(gulp, gulpPlugins, siteSettings, siteData) {
5
5
  var sequenceOpts;
6
6
 
7
7
  if (siteData.useTypescript) {
8
- sequenceOpts = ['clean', 'grab-cdn', 'grab-shared-components', 'grab-shared-scripts', 'grab-form-helpers', 'templates', 'styles', 'compile-prod', 'js-lint', 'html-min', 'css-min', 'js-min', 'img-min', 'extras', 'cache-bust', 'add-path-subdirectories', 'copy-resources-to-dist', 'build-stat'];
8
+ sequenceOpts = ['clean', 'grab-cdn', 'grab-shared-components', 'grab-shared-scripts', 'get-default-trade-questions', 'grab-form-helpers', 'templates', 'styles', 'compile-prod', 'js-lint', 'html-min', 'css-min', 'js-min', 'img-min', 'extras', 'cache-bust', 'add-path-subdirectories', 'copy-resources-to-dist', 'build-stat'];
9
9
  } else if (siteData.isWhiteLabel) {
10
10
  if (siteData.isQSPage) {
11
- sequenceOpts = ['clean', 'grab-cdn', 'grab-shared-components', 'grab-shared-scripts', 'grab-form-helpers', 'templates', 'styles', 'copy-videos', 'grab-theme-json', 'combine-files', 'grab-images', 'copy-json', 'js-lint', 'html-min', 'css-min', 'js-min', 'img-min', 'extras', 'copy-files-to-build-path', 'cache-bust', 'add-path-subdirectories', 'grab-tooltips-json', 'copy-resources-to-dist', 'build-stat'];
11
+ sequenceOpts = ['clean', 'grab-cdn', 'grab-shared-components', 'grab-shared-scripts', 'get-default-trade-questions', 'grab-form-helpers', 'templates', 'styles', 'copy-videos', 'grab-theme-json', 'combine-files', 'grab-images', 'copy-json', 'js-lint', 'html-min', 'css-min', 'js-min', 'img-min', 'extras', 'copy-files-to-build-path', 'cache-bust', 'add-path-subdirectories', 'grab-tooltips-json', 'copy-resources-to-dist', 'build-stat'];
12
12
  } else {
13
- sequenceOpts = ['clean', 'grab-cdn', 'grab-shared-components', 'grab-shared-scripts', 'grab-form-helpers', 'templates', 'styles', 'copy-videos', 'combine-files', 'grab-images', 'js-lint', 'html-min','grab-global-images', 'css-min', 'js-min', 'img-min', 'extras', 'cache-bust', 'add-path-subdirectories', 'grab-tooltips-json', 'copy-resources-to-dist', 'build-stat'];
13
+ sequenceOpts = ['clean', 'grab-cdn', 'grab-shared-components', 'grab-shared-scripts', 'get-default-trade-questions', 'grab-form-helpers', 'templates', 'styles', 'copy-videos', 'combine-files', 'grab-images', 'js-lint', 'html-min', 'grab-global-images', 'css-min', 'js-min', 'img-min', 'extras', 'cache-bust', 'add-path-subdirectories', 'grab-tooltips-json', 'copy-resources-to-dist', 'build-stat'];
14
14
  }
15
15
  } else {
16
- sequenceOpts = ['clean', 'grab-cdn', 'grab-shared-components', 'grab-shared-scripts', 'grab-form-helpers', 'templates', 'styles', 'copy-videos', 'js-lint', 'html-min', 'css-min', 'js-min', 'img-min', 'extras', 'cache-bust', 'add-path-subdirectories', 'copy-resources-to-dist', 'build-stat'];
16
+ sequenceOpts = ['clean', 'grab-cdn', 'grab-shared-components', 'grab-shared-scripts', 'get-default-trade-questions', 'grab-form-helpers', 'templates', 'styles', 'copy-videos', 'js-lint', 'html-min', 'css-min', 'js-min', 'img-min', 'extras', 'cache-bust', 'add-path-subdirectories', 'copy-resources-to-dist', 'build-stat'];
17
17
  }
18
18
 
19
19
  if (siteData.copyLocalFontFile) {
@@ -0,0 +1,155 @@
1
+ /* globals Promise */
2
+ var merge = require('lodash.merge');
3
+ var tradeQuestionsConfig = require('../src/trade-questions-config.js');
4
+
5
+ module.exports = function(gulp, gulpPlugins, siteSettings, siteData) {
6
+ if (siteData.useStepsConfig) {
7
+ console.log('Running trade question config...');
8
+ return async function() {
9
+ return await new Promise((resolve) => {
10
+ const trade = siteData.primary_trade.toLowerCase();
11
+ const steps = tradeQuestionsConfig.tradeQuestions[trade];
12
+
13
+ steps.OwnHome = tradeQuestionsConfig.OwnHome;
14
+ steps.BuyTimeframe = tradeQuestionsConfig.BuyTimeframe;
15
+
16
+ siteData.steps.items.forEach((item) => {
17
+ const stepName = item.attributes.data['step-name'];
18
+ if (steps[stepName]) {
19
+ if (!item.stepContent) {
20
+ item.stepContent = {};
21
+ }
22
+
23
+ if (!item.stepContent.fields) {
24
+ item.stepContent.fields = [];
25
+ }
26
+ const defaultStepFields = steps[stepName].fields;
27
+ let defaultStepOptions = [];
28
+ let defaultQuestionLegend = {};
29
+ defaultStepFields.forEach((defaultField) => {
30
+ defaultStepOptions = defaultField.options;
31
+ defaultQuestionLegend = defaultField.legend;
32
+ });
33
+
34
+ item.stepContent.fields.forEach((field) => {
35
+ if (field.legend) {
36
+ field.legend = merge(defaultQuestionLegend, field.legend);
37
+ } else {
38
+ field.legend = defaultQuestionLegend;
39
+ }
40
+
41
+ if (field && field.remove) {
42
+ if (field.remove.includes('all')) {
43
+ defaultStepOptions = [];
44
+ } else {
45
+ defaultStepOptions = defaultStepOptions.filter((_, i) => !field.remove.includes(i));
46
+ }
47
+ }
48
+
49
+ if (field.fieldType === 'radio') {
50
+ if (!field.errorMessage) {
51
+ field.errorMessage = 'Professionals need this info to generate a quote.';
52
+ }
53
+
54
+ if (field.options && Array.isArray(field.options) && field.options.length) {
55
+ field.options.forEach((option) => {
56
+ if (typeof option.update === 'number') {
57
+ merge(defaultStepOptions[option.update], option);
58
+ } else {
59
+ if (typeof option.insertAt === 'number') {
60
+ defaultStepOptions.splice(option.insertAt, 0, option);
61
+ } else {
62
+ defaultStepOptions.push(option);
63
+ }
64
+ }
65
+ });
66
+ }
67
+ field.options = defaultStepOptions;
68
+ } else {
69
+ if (field && Array.isArray(field) && field.length) {
70
+ if (typeof field.update === 'number') {
71
+ merge(defaultStepFields[field.update], field);
72
+ } else {
73
+ if (typeof field.insertAt === 'number') {
74
+ defaultStepFields.splice(field.insertAt, 0, field);
75
+ } else {
76
+ defaultStepFields.push(field);
77
+ }
78
+ }
79
+ }
80
+
81
+ field = defaultStepFields;
82
+ }
83
+ });
84
+
85
+ // extra question block
86
+ if (item.stepContent.extraQuestionBlock) {
87
+ if (!item.stepContent.extraQuestionBlock.fields) {
88
+ item.stepContent.extraQuestionBlock.fields = [];
89
+ }
90
+
91
+ const defaultExtraQuestionFields = steps[stepName].extraQuestionBlock.fields;
92
+ let defaultExtraQuestionOptions = [];
93
+ let defaultExtraQuestionLegend = {};
94
+ defaultExtraQuestionFields.forEach((defaultExtraQuestionField) => {
95
+ defaultExtraQuestionOptions = defaultExtraQuestionField.options;
96
+ defaultExtraQuestionLegend = defaultExtraQuestionField.legend;
97
+ });
98
+ item.stepContent.extraQuestionBlock.fields.forEach((field) => {
99
+
100
+ if (field.legend) {
101
+ field.legend = merge(defaultExtraQuestionLegend, field.legend);
102
+ } else {
103
+ field.legend = defaultExtraQuestionLegend;
104
+ }
105
+
106
+ if (field && field.remove) {
107
+ if (field.remove.includes('all')) {
108
+ defaultExtraQuestionOptions = [];
109
+ } else {
110
+ defaultExtraQuestionOptions = defaultExtraQuestionOptions.filter((_, i) => !field.remove.includes(i));
111
+ }
112
+ }
113
+
114
+ if (field.fieldType === 'radio') {
115
+ if (!field.errorMessage) {
116
+ field.errorMessage = 'Professionals need this info to generate a quote.';
117
+ }
118
+
119
+ if (field.options && Array.isArray(field.options) && field.options.length) {
120
+ field.options.forEach((option) => {
121
+ if (typeof option.update === 'number') {
122
+ merge(defaultExtraQuestionOptions[option.update], option);
123
+ } else {
124
+ if (typeof option.insertAt === 'number') {
125
+ defaultExtraQuestionOptions.splice(option.insertAt, 0, option);
126
+ } else {
127
+ defaultExtraQuestionOptions.push(option);
128
+ }
129
+ }
130
+ });
131
+ }
132
+ field.options = defaultExtraQuestionOptions;
133
+ } else {
134
+ if (field && Array.isArray(field) && field.length) {
135
+ if (typeof field.update === 'number') {
136
+ merge(defaultExtraQuestionFields[field.update], field);
137
+ } else {
138
+ if (typeof field.insertAt === 'number') {
139
+ defaultExtraQuestionFields.splice(field.insertAt, 0, field);
140
+ } else {
141
+ defaultExtraQuestionFields.push(field);
142
+ }
143
+ }
144
+ }
145
+ field = defaultExtraQuestionFields;
146
+ }
147
+ });
148
+ }
149
+ }
150
+ });
151
+ resolve();
152
+ });
153
+ };
154
+ }
155
+ };
@@ -1,16 +1,19 @@
1
+ /* globals Promise */
1
2
  var request = require('request');
2
3
  var source = require('vinyl-source-stream');
3
4
 
4
5
  // helper to allow us to define an "end" event to multiple streams
5
- function streamToDestination(gulp, siteSettings, inputPath, destPath, fileName) {
6
+ async function streamToDestination(gulp, siteSettings, inputPath, destPath, fileName, index) {
6
7
  var url = `https://${siteSettings.nodeEnv}${inputPath}`;
7
-
8
- return new Promise(resolve => { // eslint-disable-line no-undef
8
+ return await new Promise(async function(resolve) { // eslint-disable-line no-undef
9
+ console.time(`${index + 1} Finished after`);
10
+ console.log(`${index + 1} Starting:`, url);
9
11
  request(url)
10
- .on('response', resp => {
12
+ .on('response', async function(resp) {
11
13
  if (resp.statusCode !== 200) {
12
14
  throw new Error(`Error fetching ${url}`);
13
15
  }
16
+ console.timeEnd(`${index + 1} Finished after`);
14
17
  })
15
18
  .pipe(source(fileName))
16
19
  .pipe(gulp.dest(`${siteSettings.srcFolder}/${destPath}`))
@@ -19,7 +22,7 @@ function streamToDestination(gulp, siteSettings, inputPath, destPath, fileName)
19
22
  }
20
23
 
21
24
  module.exports = function(gulp, _gulpPlugins, siteSettings, siteData) {
22
- return function() {
25
+ return async function() {
23
26
  const { nodeEnv, isLocal } = siteSettings;
24
27
  const { isQSPage, isWhiteLabel, domain } = siteData;
25
28
  const isModWhiteLabel = isWhiteLabel && !isQSPage;
@@ -30,7 +33,8 @@ module.exports = function(gulp, _gulpPlugins, siteSettings, siteData) {
30
33
  // key: inputPath, value: destPath
31
34
 
32
35
  externalResources = {
33
- '/quote/resources/mod-site/templates/scripts/trusted-form.html': ['/templates/scripts/', 'trusted-form.html']
36
+ '/quote/resources/mod-site/templates/scripts/trusted-form.html': ['/templates/scripts/', 'trusted-form.html'],
37
+ '/quote/resources/shared-resources/scripts/geolocation/geolocation.min.js': ['resources/scripts/geolocation/', 'geolocation.min.js']
34
38
  };
35
39
 
36
40
  // grab footer modals and place under the resources
@@ -39,11 +43,13 @@ module.exports = function(gulp, _gulpPlugins, siteSettings, siteData) {
39
43
  '/quote/resources/shared-resources/templates/modals/privacy/': ['/resources/templates/modals/privacy/', 'index.html'],
40
44
  '/quote/resources/shared-resources/templates/modals/terms/': ['/resources/templates/modals/terms/', 'index.html'],
41
45
  '/quote/resources/shared-resources/templates/modals/contact-us/': ['/resources/templates/modals/contact-us/', 'index.html'],
42
- '/quote/resources/shared-resources/templates/modals/faq/': ['/resources/templates/modals/faq/', 'index.html']
46
+ '/quote/resources/shared-resources/templates/modals/faq/': ['/resources/templates/modals/faq/', 'index.html'],
47
+ '/quote/resources/shared-resources/templates/modals/e-sign-consent/': ['/resources/templates/modals/e-sign-consent/', 'index.html'],
48
+ '/quote/resources/shared-resources/templates/modals/clients/': [`/resources/templates/modals/clients/`, 'index.html']
43
49
  });
44
50
 
45
51
  if (isModWhiteLabel || domainHasModernize) {
46
- Object.assign(externalResources, {'/quote/resources/mod-site/templates/scripts/recaptcha.html': ['/templates/scripts/', 'recaptcha.html']});
52
+ Object.assign(externalResources, { '/quote/resources/mod-site/templates/scripts/recaptcha.html': ['/templates/scripts/', 'recaptcha.html'] });
47
53
  }
48
54
 
49
55
  // local dev files
@@ -60,20 +66,19 @@ module.exports = function(gulp, _gulpPlugins, siteSettings, siteData) {
60
66
  externalResources = { ...externalResources, ...remoteFilesForLocalDev };
61
67
  }
62
68
 
63
- // Geolocation js
64
- Object.assign(externalResources, {
65
- '/quote/resources/shared-resources/scripts/geolocation/geolocation.min.js': [
66
- 'resources/scripts/geolocation/', 'geolocation.min.js'
67
- ]
68
- });
69
+ const totalRequests = Object.keys(externalResources).length;
70
+ return await new Promise(async function(resolve) {
71
+ const sequentialRequests = async function(key, index) {
72
+ if (index === totalRequests) {
73
+ resolve();
74
+ return;
75
+ }
76
+ const destinationPath = externalResources[key][0];
77
+ const fileName = externalResources[key][1];
78
+ return await streamToDestination(gulp, siteSettings, key, destinationPath, fileName, index).then(() => sequentialRequests(Object.keys(externalResources)[index + 1], index + 1));
79
+ };
69
80
 
70
- const filesPromiseMap = Object.keys(externalResources).map(key => {
71
- const destinationPath = externalResources[key][0];
72
- const fileName = externalResources[key][1];
73
- return streamToDestination(gulp, siteSettings, key, destinationPath, fileName);
81
+ sequentialRequests(Object.keys(externalResources)[0], 0);
74
82
  });
75
-
76
- // when Promise.all resolves, the streams are done and we can go to the next step
77
- return Promise.all(filesPromiseMap); // eslint-disable-line no-undef
78
83
  };
79
84
  };