mod-build 3.6.1 → 3.6.2--beta.2
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.2
|
|
4
|
+
|
|
5
|
+
- Adding `check-seasonal-variations` to grab seasons json; loop through the siteData for `seasonalVariations: {}`; find any active seasons; merge the json objects and adjust json content accordingly;
|
|
6
|
+
|
|
3
7
|
## 3.5.7
|
|
4
8
|
|
|
5
9
|
- Making `maxRecursion` for our file include plugin in template.js a lot higher
|
package/gulp-tasks/cache-bust.js
CHANGED
|
@@ -3,7 +3,11 @@ module.exports = function(gulp, gulpPlugins, siteSettings) {
|
|
|
3
3
|
return gulp.src(siteSettings.distFolder + '/**')
|
|
4
4
|
.pipe(gulpPlugins.revAll.revision({
|
|
5
5
|
dontRenameFile: [/^\/favicon.ico$/g, '.html', '.txt', /modlogo([\w|\s|-])*\.(?:svg)/g],
|
|
6
|
-
dontUpdateReference: [/^\/favicon.ico$/g, '.html', '.txt', /modlogo([\w|\s|-])*\.(?:svg)/g]
|
|
6
|
+
dontUpdateReference: [/^\/favicon.ico$/g, '.html', '.txt', /modlogo([\w|\s|-])*\.(?:svg)/g],
|
|
7
|
+
transformFilename: function (file, hash) {
|
|
8
|
+
var ext = path.extname(file.path);
|
|
9
|
+
return path.basename(file.path, ext) + ext + "?v" + hash.substr(0, 8); // filename.ext?v099e1583
|
|
10
|
+
}
|
|
7
11
|
}))
|
|
8
12
|
.pipe(gulpPlugins.revDeleteOriginal())
|
|
9
13
|
.pipe(gulp.dest(siteSettings.distFolder))
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
function getActiveSeasons() {
|
|
2
|
+
var seasons = require(`../src/data/seasons.js`);
|
|
3
|
+
const today = new Date();
|
|
4
|
+
const year = today.getFullYear();
|
|
5
|
+
let activeSeason = [];
|
|
6
|
+
|
|
7
|
+
for (const key in seasons) {
|
|
8
|
+
var seasonName = key;
|
|
9
|
+
var dateRanges = seasons[key];
|
|
10
|
+
var startDate = new Date(`${Object.values(dateRanges)[0]}-${year}`);
|
|
11
|
+
var endDate = new Date(`${Object.values(dateRanges)[1]}-${year}`);
|
|
12
|
+
|
|
13
|
+
if (startDate < today && today < endDate) {
|
|
14
|
+
activeSeason.push(seasonName)
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
return activeSeason;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
module.exports = getActiveSeasons;
|
package/gulp-tasks/templates.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
var merge = require('lodash.merge');
|
|
2
|
+
|
|
1
3
|
module.exports = function(gulp, gulpPlugins, siteSettings, siteData) {
|
|
2
4
|
// Merge site's data with shared data
|
|
3
5
|
/* eslint brace-style: 0 */
|
|
@@ -12,6 +14,19 @@ module.exports = function(gulp, gulpPlugins, siteSettings, siteData) {
|
|
|
12
14
|
var qsFooterData = require('../src/data/components/qs-footer.js');
|
|
13
15
|
var quoteFooterData = require('../src/data/components/quote-footer.js');
|
|
14
16
|
|
|
17
|
+
// Checking for seasonal variations in the template.js + updating content
|
|
18
|
+
var checkSeasonalVariations = require('./check-seasonal-variations.js');
|
|
19
|
+
const activeSeason = checkSeasonalVariations();
|
|
20
|
+
if (activeSeason.length !== 0){
|
|
21
|
+
if (siteData.seasonalVariations) {
|
|
22
|
+
activeSeason.forEach(season => {
|
|
23
|
+
if (season in siteData.seasonalVariations) {
|
|
24
|
+
siteData = merge(siteData, siteData.seasonalVariations[season]);
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
15
30
|
var templatesData = Object.assign(commonData(), qsFooterData(siteData), quoteFooterData(siteData), siteData, { isLocal, nodeEnv, assetsPath, buildPath });
|
|
16
31
|
|
|
17
32
|
// This is helper function to evaluate JS expressions
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mod-build",
|
|
3
|
-
"version": "3.6.
|
|
3
|
+
"version": "3.6.2--beta.2",
|
|
4
4
|
"description": "Share components for S3 sites.",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"test": "echo \"Error: no test specified\" && exit 1"
|
|
@@ -51,6 +51,7 @@
|
|
|
51
51
|
"imagemin-webp": "^5.1.0",
|
|
52
52
|
"jquery": "^3.2.1",
|
|
53
53
|
"lodash": "^4.17.15",
|
|
54
|
+
"lodash.merge": "^4.6.2",
|
|
54
55
|
"nouislider": "^10.1.0",
|
|
55
56
|
"request": "^2.88.0",
|
|
56
57
|
"run-sequence": "^2.2.1",
|
package/src/scripts/thankyou.js
DELETED
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
/* global modUtils locationStr */
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Link this file into a TY page to render generic TYP and fire pixels
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
var thankyouPage = (function($) {
|
|
8
|
-
var getVars = modUtils.getUrlParamsToObject(),
|
|
9
|
-
apiUrl = modUtils.getApiDomain() + '/v1/';
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* Starts TY page
|
|
13
|
-
*/
|
|
14
|
-
var init = function() {
|
|
15
|
-
// Personalized intro copy (/thankyou page)
|
|
16
|
-
if (getVars.fName && getVars.lName) {
|
|
17
|
-
$('#intro').text(getVars.fName + ' ' + getVars.lName + ', thanks for your request.');
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
// Location
|
|
21
|
-
if (getVars.city && getVars.state) {
|
|
22
|
-
locationStr = getVars.city + ', ' + getVars.state;
|
|
23
|
-
}
|
|
24
|
-
if (locationStr) {
|
|
25
|
-
$('[data-bind="location"]').text(locationStr);
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
// leadToken
|
|
29
|
-
if (getVars.leadToken) {
|
|
30
|
-
$('#leadid_token').val(getVars.leadToken);
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
// Grab and fire the affiliate pixel if one exists and not a duplicate.
|
|
34
|
-
if (getVars.projectId && !getVars.isDupe) {
|
|
35
|
-
$.ajax({
|
|
36
|
-
url: apiUrl + 'tracking/get-typ-pixel/' + getVars.projectId,
|
|
37
|
-
type: 'GET',
|
|
38
|
-
dataType: 'json',
|
|
39
|
-
crossDomain: true,
|
|
40
|
-
success: function(response) {
|
|
41
|
-
if (!response || !response.data.pixel) {
|
|
42
|
-
return;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
$('body').append(response.data.pixel);
|
|
46
|
-
}
|
|
47
|
-
});
|
|
48
|
-
}
|
|
49
|
-
};
|
|
50
|
-
|
|
51
|
-
return {
|
|
52
|
-
init: init
|
|
53
|
-
};
|
|
54
|
-
})(jQuery);
|
|
55
|
-
|
|
56
|
-
$(document).ready(function() {
|
|
57
|
-
thankyouPage.init();
|
|
58
|
-
});
|