mod-build 3.6.0-beta.1 → 3.6.1--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.5.7
4
+
5
+ - Making `maxRecursion` for our file include plugin in template.js a lot higher
6
+
3
7
  ## 3.5.6
4
8
 
5
9
  - Adding `inc` handlebars helper to template.js to increment a certain value by 1
@@ -21,7 +21,7 @@ function streamToDestination(gulp, siteSettings, inputPath, destPath, fileName)
21
21
  module.exports = function(gulp, gulpPlugins, siteSettings, siteData) {
22
22
  return function() {
23
23
  const { nodeEnv, isLocal } = siteSettings;
24
- const { isQSPage, isWhiteLabel, includeFaqLink, domain } = siteData;
24
+ const { isQSPage, isWhiteLabel, domain } = siteData;
25
25
  const isModWhiteLabel = isWhiteLabel && !isQSPage
26
26
  const domainHasModernize = domain.indexOf('modernize') > -1;
27
27
 
@@ -12,7 +12,9 @@ module.exports = function(gulp, gulpPlugins, siteSettings, siteData) {
12
12
  var qsFooterData = require('../src/data/components/qs-footer.js');
13
13
  var quoteFooterData = require('../src/data/components/quote-footer.js');
14
14
 
15
- var templatesData = Object.assign(commonData(), qsFooterData(siteData), quoteFooterData(siteData), siteData, { isLocal, nodeEnv, assetsPath, buildPath });
15
+ var makeSeasonalUpdates = require('../src/scripts/components/check-for-seasonal-updates.js');
16
+
17
+ var templatesData = Object.assign(commonData(), makeSeasonalUpdates(siteData), qsFooterData(siteData), quoteFooterData(siteData), siteData, { isLocal, nodeEnv, assetsPath, buildPath });
16
18
 
17
19
  // This is helper function to evaluate JS expressions
18
20
  // in Handlebars, e.g. for conditions
@@ -131,7 +133,7 @@ module.exports = function(gulp, gulpPlugins, siteSettings, siteData) {
131
133
  '!' + siteSettings.srcFolder + '/' + siteSettings.templatesSubfolder + '/_partials/**/*.html'
132
134
  ])
133
135
  .pipe(gulpPlugins.handlebarsFileInclude(templatesData, {
134
- maxRecursion: 125,
136
+ maxRecursion: 500,
135
137
  handlebarsHelpers: handlebarsHelpers
136
138
  }))
137
139
  .pipe(gulp.dest(siteSettings.tmpFolder));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mod-build",
3
- "version": "3.6.0-beta.1",
3
+ "version": "3.6.1--beta.1",
4
4
  "description": "Share components for S3 sites.",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1"
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Set Default Season Range
3
+ * @returns {Boolean} - if true = update verbiage
4
+ */
5
+
6
+ var makeSeasonalUpdates = function(siteData) {
7
+ const trade = siteData.primary_trade;
8
+ const today = new Date();
9
+ const year = today.getFullYear();
10
+ if (trade === 'HVAC') {
11
+ /* Default Hightlight Cooling Services; Highlight Heating Services from September 25 to March 14 */
12
+ const springDate = new Date(`03-14-${year}`);
13
+ const fallDate = new Date(`09-25-${year}`);
14
+
15
+ return !(today > springDate && today < fallDate);
16
+ }
17
+ }
@@ -1,122 +0,0 @@
1
- /* exported contactUs */
2
-
3
- var contactUs = {
4
- $form: $('.contact-us__form'),
5
- $thankyou: $('.contact-us__thankyou'),
6
- url: 'https://contact.formfetch.com/v2_submit',
7
- getFormData: function() {
8
- const date = new Date();
9
- const data = {};
10
- this.$form.serializeArray().forEach(function(input) {
11
- data[input.name] = input.value;
12
- });
13
-
14
- data.time = date.toLocaleTimeString();
15
- data.date = date.toLocaleDateString();
16
- return data;
17
- },
18
- validateData: function(data) {
19
- const _this = this;
20
- var isFormValid = true;
21
- const emailPattern = /^([\w\+-]+(?:\.[\w\+-]+)*)(@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$)/i;
22
-
23
- Object.keys(data).forEach(function(key) {
24
- var isValid = true;
25
- const value = data[key];
26
- switch (key) {
27
- case 'email':
28
- isValid = emailPattern.test(value);
29
- break;
30
- default:
31
- isValid = value !== '';
32
- break;
33
- }
34
-
35
- if (!isValid) {
36
- _this.markFieldAsInvalid(key);
37
- isFormValid = false;
38
- }
39
- });
40
-
41
- return isFormValid;
42
- },
43
- markFieldAsInvalid: function(fieldName) {
44
- this.$form.find('#' + fieldName).parent().addClass('has-error');
45
- },
46
- submit: function() {
47
- this.$form.addClass('form--loading');
48
-
49
- const _this = this;
50
- const data = this.getFormData();
51
- const isFormValid = this.validateData(data);
52
-
53
- if (isFormValid) {
54
- // Submit
55
- $.ajax({
56
- url: _this.url,
57
- dataType: 'json',
58
- type: 'post',
59
- crossDomain: true,
60
- data: data,
61
- success: function(response) {
62
- if (response.success) {
63
- _this.$form.hide();
64
- _this.$thankyou.show();
65
- } else {
66
- _this.$form.removeClass('form--loading');
67
- $('.step__error').html(response.message);
68
- }
69
- }
70
- });
71
- } else {
72
- _this.$form.removeClass('form--loading');
73
- }
74
- },
75
- changeStep: function(direction) {
76
- const $activeStep = this.$form.find('.step--active');
77
- const $nextStep = $activeStep.next();
78
- const $prevStep = $activeStep.prev();
79
-
80
- $activeStep.removeClass('step--active');
81
- if (direction === 'next') {
82
- $nextStep.addClass('step--active');
83
- } else {
84
- $prevStep.addClass('step--active');
85
- }
86
- },
87
- watch: function() {
88
- const _this = this;
89
-
90
- // Watch form submission
91
- _this.$form.on('submit', function(e) {
92
- e.preventDefault();
93
- if (!$(this).hasClass('form--loading')) {
94
- _this.submit();
95
- }
96
- });
97
-
98
- // Watch radio click
99
- $('input[type="radio"]').on('change', function() {
100
- _this.changeStep('next');
101
- });
102
-
103
- // Watch back button
104
- _this.$form.find('.btn-back').on('click', function() {
105
- _this.changeStep('prev');
106
- });
107
-
108
- // Remove error state when input/textarea changes
109
- _this.$form.find('input, textarea').on('change', function() {
110
- $(this).parent().removeClass('has-error');
111
- });
112
- },
113
- init: function() {
114
- this.watch();
115
- }
116
- };
117
-
118
- (function($) {
119
- $(document).ready(function() {
120
- contactUs.init();
121
- });
122
- })(jQuery);