mod-build 4.0.102 → 4.0.103

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 (110) hide show
  1. package/package.json +2 -2
  2. package/public/resources/scripts/abandonment/abandonment-a4bbb36fbc8ed64042b8.min.js +2 -0
  3. package/public/resources/scripts/abandonment/abandonment.min.js +2 -0
  4. package/public/resources/scripts/callrail/callrail-14011d73b50a928de4b4.min.js +2 -0
  5. package/public/resources/scripts/callrail/callrail.min.js +2 -0
  6. package/public/resources/scripts/footer/footer-component-46dc0d7ca6af4fc3b76b.min.js +2 -0
  7. package/public/resources/scripts/footer/footer-component.min.js +2 -0
  8. package/public/resources/scripts/geolocation/geolocation.min.js +2 -0
  9. package/public/resources/scripts/helpers/addVWOTestQueryParam.min.js +2 -0
  10. package/public/resources/scripts/helpers/addVWOTestQueryParam.min.js.map +1 -0
  11. package/public/resources/scripts/helpers/additionalOpts.min.js +2 -0
  12. package/public/resources/scripts/helpers/additionalOpts.min.js.map +1 -0
  13. package/public/resources/scripts/helpers/calls-only.min.js +2 -0
  14. package/public/resources/scripts/helpers/calls-only.min.js.map +1 -0
  15. package/public/resources/scripts/helpers/getPhoneAssignmentData.min.js +2 -0
  16. package/public/resources/scripts/helpers/getPhoneAssignmentData.min.js.map +1 -0
  17. package/public/resources/scripts/helpers/initNumericOnlyFields.min.js +2 -0
  18. package/public/resources/scripts/helpers/initNumericOnlyFields.min.js.map +1 -0
  19. package/public/resources/scripts/helpers/initQSForm.min.js +2 -0
  20. package/public/resources/scripts/helpers/initQSForm.min.js.map +1 -0
  21. package/public/resources/scripts/helpers/initQuadTransform.min.js +2 -0
  22. package/public/resources/scripts/helpers/initQuadTransform.min.js.map +1 -0
  23. package/public/resources/scripts/helpers/isZipCodeValid.min.js +2 -0
  24. package/public/resources/scripts/helpers/isZipCodeValid.min.js.map +1 -0
  25. package/public/resources/scripts/helpers/observeVWOVariation.min.js +2 -0
  26. package/public/resources/scripts/helpers/observeVWOVariation.min.js.map +1 -0
  27. package/public/resources/scripts/helpers/opts.min.js +2 -0
  28. package/public/resources/scripts/helpers/opts.min.js.map +1 -0
  29. package/public/resources/scripts/jornaya.hbs +35 -0
  30. package/public/resources/scripts/jornaya.html +35 -0
  31. package/public/resources/scripts/mod-alytics/modalytics-be44027508c0438f6709.min.js +2 -0
  32. package/public/resources/scripts/mod-alytics/modalytics.min.js +2 -0
  33. package/public/resources/scripts/mod-form/form/contractor-0918337caf3dfede1609.min.js +2 -0
  34. package/public/resources/scripts/mod-form/form/contractor.min.js +2 -0
  35. package/public/resources/scripts/mod-form/form/homeowner-19a121b0e596042326f4.min.js +2 -0
  36. package/public/resources/scripts/mod-form/form/homeowner.min.js +2 -0
  37. package/public/resources/scripts/mod-utils/modutils-bc275eb41af515f626ef.min.js +2 -0
  38. package/public/resources/scripts/mod-utils/modutils.min.js +2 -0
  39. package/public/resources/scripts/trusted-form.hbs +38 -0
  40. package/public/resources/scripts/trusted-form.html +38 -0
  41. package/public/resources/styles/components/abandonment/abandonment-8a673f060817db6cb7dc.min.css +1 -0
  42. package/public/resources/styles/components/abandonment/abandonment.min.css +1 -0
  43. package/public/resources/styles/components/footer/mod-footer-d233fa64b6c8297c70ec.min.css +1 -0
  44. package/public/resources/styles/components/footer/mod-footer.min.css +1 -0
  45. package/public/resources/styles/components/footer/qs-footer-926e67c28d10c729db46.min.css +1 -0
  46. package/public/resources/styles/components/footer/qs-footer.min.css +1 -0
  47. package/src/resources/templates/modals/privacy/index.hbs +88 -89
  48. package/src/resources/templates/modals/privacy/index.html +88 -89
  49. package/src/resources/templates/modals/terms/index.hbs +8 -7
  50. package/src/resources/templates/modals/terms/index.html +8 -7
  51. package/src/scripts/globals.js +1 -3
  52. package/src/scripts/plugins.js +0 -3
  53. package/tasks/templates.js +2 -4
  54. package/gulp-tasks/add-path-subdirectories.js +0 -34
  55. package/gulp-tasks/build-stat.js +0 -9
  56. package/gulp-tasks/build.js +0 -28
  57. package/gulp-tasks/cache-bust.js +0 -19
  58. package/gulp-tasks/check-seasonal-variations.js +0 -21
  59. package/gulp-tasks/clean.js +0 -10
  60. package/gulp-tasks/combine-files.js +0 -7
  61. package/gulp-tasks/compile.js +0 -44
  62. package/gulp-tasks/copy-files-to-build-path.js +0 -8
  63. package/gulp-tasks/copy-fonts.js +0 -6
  64. package/gulp-tasks/copy-json.js +0 -6
  65. package/gulp-tasks/copy-resources-to-dist.js +0 -6
  66. package/gulp-tasks/copy-videos.js +0 -6
  67. package/gulp-tasks/extras.js +0 -22
  68. package/gulp-tasks/grab-cdn.js +0 -74
  69. package/gulp-tasks/grab-form-helpers.js +0 -55
  70. package/gulp-tasks/grab-global-images.js +0 -121
  71. package/gulp-tasks/grab-images.js +0 -79
  72. package/gulp-tasks/grab-shared-components.js +0 -46
  73. package/gulp-tasks/grab-shared-scripts.js +0 -275
  74. package/gulp-tasks/grab-theme-json.js +0 -24
  75. package/gulp-tasks/grab-tooltips-json.js +0 -33
  76. package/gulp-tasks/js-lint-husky.js +0 -35
  77. package/gulp-tasks/js-lint.js +0 -24
  78. package/gulp-tasks/minify.js +0 -131
  79. package/gulp-tasks/sass-lint.js +0 -15
  80. package/gulp-tasks/serve.js +0 -74
  81. package/gulp-tasks/settings.js +0 -22
  82. package/gulp-tasks/styles.js +0 -42
  83. package/gulp-tasks/tasks.js +0 -475
  84. package/gulp-tasks/templates.js +0 -288
  85. package/src/data/footer.js +0 -119
  86. package/src/scripts/default/additional-assets.js +0 -60
  87. package/src/scripts/default/rage-clicking.js +0 -54
  88. package/src/scripts/default/show-utility-providers.js +0 -28
  89. package/src/scripts/url-cleaner.js +0 -8
  90. package/src/scripts/vendor/google-tag-manager-head.js +0 -6
  91. package/src/scripts/vendor/heap-addeventproperties-identify.js +0 -262
  92. package/src/scripts/vendor/heap-tracking.js +0 -9
  93. package/src/styles/partials/_contact-us.scss +0 -196
  94. package/src/styles/partials/_google-address-autocomplete.scss +0 -52
  95. package/src/styles/partials/_mixins.scss +0 -39
  96. package/src/styles/partials/_modal-pages.scss +0 -125
  97. package/src/styles/partials/_modernize-colors.scss +0 -128
  98. package/src/styles/partials/_qs-footer.scss +0 -68
  99. package/src/styles/partials/_quote-footer-v1.scss +0 -79
  100. package/src/styles/partials/_quote-footer-v2.scss +0 -64
  101. package/src/styles/partials/_quote-footer-v3.scss +0 -65
  102. package/src/templates/_partials/scripts/deferred-styles.html +0 -16
  103. package/src/templates/_partials/scripts/heap-bundle.html +0 -5
  104. package/src/templates/_partials/scripts/heap.html +0 -4
  105. package/src/templates/_partials/scripts/utm-params.html +0 -9
  106. package/src/templates/components/qs-footer.html +0 -55
  107. package/src/templates/components/quote-footer-v1.html +0 -148
  108. package/src/templates/components/quote-footer-v2.html +0 -169
  109. /package/tasks/{addSeasonalchanges.js → add-seasonal-changes.js} +0 -0
  110. /package/tasks/{setupDevOpsTrackingId.js → setup-dev-ops-tracking-id.js} +0 -0
@@ -3,7 +3,6 @@ import path from "node:path";
3
3
  import merge from "lodash.merge";
4
4
  import gulpHandlebarsFileInclude from "gulp-handlebars-file-include";
5
5
  import { defaultSettings } from "../data/config.js";
6
- import footer from '../data/footer.js';
7
6
  import { handlebarsHelpers } from "./utils.js";
8
7
 
9
8
  /**
@@ -102,7 +101,6 @@ export const updateConfig = async (config) => {
102
101
 
103
102
  let mergedConfig = {
104
103
  ...config,
105
- ...footer(config),
106
104
  ...{ isLocal, nodeEnv, buildPath }
107
105
  };
108
106
 
@@ -151,7 +149,6 @@ export const updateHandlebarsOnWatch = async (config) => {
151
149
 
152
150
  let mergedConfig = {
153
151
  ...config,
154
- ...footer(config),
155
152
  ...{ isLocal, nodeEnv, buildPath }
156
153
  };
157
154
 
@@ -1,4 +1,3 @@
1
- import footer from '../src/data/footer.js';
2
1
  import fs from 'node:fs';
3
2
  import merge from 'lodash.merge';
4
3
  import cloneDeep from 'lodash.clonedeep';
@@ -6,8 +5,8 @@ import { createRetryFetch } from '../src/scripts/retry-fetch.js';
6
5
 
7
6
  import { defaultSettings } from '../src/data/config.js';
8
7
 
9
- import setupDevOpsTrackingId from './setupDevOpsTrackingId.js';
10
- import addSeasonalchanges from './addSeasonalchanges.js';
8
+ import setupDevOpsTrackingId from './setup-dev-ops-tracking-id.js';
9
+ import addSeasonalchanges from './add-seasonal-changes.js';
11
10
 
12
11
  const fetchWithRetryDefault = createRetryFetch();
13
12
  const fetchWithRetryTcpa = createRetryFetch();
@@ -272,7 +271,6 @@ export default async function(config) {
272
271
 
273
272
  let tempConfig = {
274
273
  ...config,
275
- ...footer(config),
276
274
  ...{ isLocal, nodeEnv, assetsPath, buildPath },
277
275
  };
278
276
 
@@ -1,34 +0,0 @@
1
- var replace = require('gulp-replace');
2
-
3
- module.exports = function(gulp, gulpPlugins, siteSettings, siteData) {
4
- return function() {
5
- const isPathSubdirectory = siteData.siteData && siteData.siteData.pathSubdirectory || siteData && siteData.pathSubdirectory;
6
- if (isPathSubdirectory) {
7
- const pathSubdirectory = isPathSubdirectory;
8
-
9
- return gulp.src(siteSettings.distFolder + '/**/*.html')
10
- .pipe(replace(/(href="favicon.ico")/g, function(match, path) {
11
- return `href="${pathSubdirectory}favicon.ico"`;
12
- }))
13
- .pipe(replace(/((src=")(images|scripts|shared-components)\/[^"]+")/g, function(match, path) {
14
- if (path.startsWith('src="images') || path.startsWith('src="scripts') || path.startsWith('src="shared-components') || path.startsWith('src="accessible-components')) {
15
- return `src="${pathSubdirectory}${path.slice(5)}`;
16
- }
17
- return match;
18
- }))
19
- .pipe(replace(/((srcset="images)\/[^"]+")/g, function(match, path) {
20
- if (path.startsWith('srcset="images')) {
21
- return `srcset="${pathSubdirectory}${path.slice(8)}`;
22
- }
23
- return match;
24
- }))
25
- .pipe(replace(/((href=")(images|styles|shared-components)\/[^"]+")/g, function(match, path) {
26
- if (path.startsWith('href="images') || path.startsWith('href="styles') || path.startsWith('href="shared-components') || path.startsWith('src="accessible-components')) {
27
- return `href="${pathSubdirectory}${path.slice(6)}`;
28
- }
29
- return match;
30
- }))
31
- .pipe(gulp.dest(siteSettings.distFolder));
32
- }
33
- }
34
- };
@@ -1,9 +0,0 @@
1
- module.exports = function(gulp, gulpPlugins, gulpSettings) {
2
- return function() {
3
- return gulp.src(gulpSettings.distFolder + '/**/*')
4
- .pipe(gulpPlugins.size({
5
- title: 'build',
6
- gzip: true
7
- }));
8
- };
9
- };
@@ -1,28 +0,0 @@
1
- module.exports = function(gulp, gulpPlugins, siteSettings, siteData) {
2
- var runSequence = require('run-sequence');
3
-
4
- return function() {
5
- var sequenceOpts;
6
-
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'];
9
- } else if (siteData.isWhiteLabel) {
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'];
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'];
14
- }
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'];
17
- }
18
-
19
- if (siteData.copyLocalFontFile) {
20
- sequenceOpts.push('copy-fonts');
21
- }
22
-
23
- runSequence(...sequenceOpts, function() {
24
- console.log('\x1b[42m%s\x1b[0m', '✔ Build completed!');
25
- console.log('You can run \'gulp serve:dist\' to see production version.');
26
- });
27
- };
28
- };
@@ -1,19 +0,0 @@
1
- module.exports = function(gulp, gulpPlugins, siteSettings) {
2
- var path = require('path');
3
- return function() {
4
- return gulp.src(siteSettings.distFolder + '/**')
5
- .pipe(gulpPlugins.revAll.revision({
6
- dontSearchFile: [/(resources)\/.*/, /(scripts\/components)\/.*/, /(fonts)\/.*/],
7
- dontRenameFile: [/^\/favicon.ico$/g, '.html', '.txt', /modlogo([\w|\s|-])*\.(?:svg)/g, /(resources)\/.*/, /(fonts)\/.*/],
8
- dontUpdateReference: [/^\/favicon.ico$/g, '.html', '.txt', /modlogo([\w|\s|-])*\.(?:svg)/g, /(resources)\/.*/, /(fonts)\/.*/],
9
- transformFilename: function (file, hash) {
10
- var ext = path.extname(file.path);
11
- return path.basename(file.path, ext) + '-' + hash.substr(0, 8) + ext;
12
- }
13
- }))
14
- .pipe(gulpPlugins.revDeleteOriginal())
15
- .pipe(gulp.dest(siteSettings.distFolder))
16
- .pipe(gulpPlugins.revAll.versionFile())
17
- .pipe(gulp.dest(siteSettings.distFolder));
18
- };
19
- };
@@ -1,21 +0,0 @@
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;
@@ -1,10 +0,0 @@
1
- module.exports = function(gulp, gulpPlugins, gulpSettings) {
2
- var del = require('del');
3
-
4
- return function() {
5
- return del.sync([
6
- gulpSettings.tmpFolder,
7
- gulpSettings.distFolder
8
- ]);
9
- };
10
- };
@@ -1,7 +0,0 @@
1
- module.exports = function(gulp, gulpPlugins, siteSettings) {
2
- return function() {
3
- return gulp.src(siteSettings.srcFolder + '/**/*.{html,scss}')
4
- .pipe(gulpPlugins.concat('all.txt'))
5
- .pipe(gulp.dest(siteSettings.tmpFolder));
6
- };
7
- };
@@ -1,44 +0,0 @@
1
- const webpack = require('webpack-stream');
2
- const glob = require('glob');
3
-
4
- const entry = glob.sync('./src/scripts/**.ts').reduce((entry, path) => {
5
- const pathName = path.replace(/(\.\/src\/scripts\/|\.ts)/g, ''); // remove `./src/scripts/`, `.ts`
6
- entry[pathName] = path;
7
- return entry;
8
- }, {});
9
-
10
- module.exports = function(gulp, gulpPlugins, siteSettings, mode) {
11
- let assetUrl = siteSettings.tmpFolder + '/scripts';
12
- if (mode === 'production') {
13
- assetUrl = siteSettings.distFolder + '/scripts';
14
- }
15
-
16
- return function() {
17
- return gulp.src('src/scripts/**.ts')
18
- .on('error', function() {
19
- this.end();
20
- })
21
- .pipe(webpack({
22
- mode: mode,
23
- entry,
24
- output: {
25
- filename: '[name].js'
26
- },
27
- resolve: {
28
- // Add `.ts` and `.tsx` as a resolvable extension.
29
- extensions: ['.ts', '.tsx', '.js']
30
- },
31
- module: {
32
- rules: [
33
- // all files with a `.ts` or `.tsx` extension will be handled by `ts-loader`
34
- { test: /\.ts?$/, loader: 'ts-loader' }
35
- ]
36
- }
37
- }))
38
- .on('error', function(err) {
39
- console.log('errors:',err);
40
- this.end();
41
- })
42
- .pipe(gulp.dest(assetUrl));
43
- };
44
- };
@@ -1,8 +0,0 @@
1
- module.exports = function(gulp, siteSettings) {
2
- return function() {
3
- if (siteSettings.buildPath) {
4
- return gulp.src(siteSettings.distFolder + '/**')
5
- .pipe(gulp.dest(siteSettings.distFolder + siteSettings.buildPath));
6
- }
7
- };
8
- };
@@ -1,6 +0,0 @@
1
- module.exports = function(gulp, siteSettings) {
2
- return function() {
3
- return gulp.src(siteSettings.srcFolder + '/fonts' + '/*.{otf,woff,woff2,ttf}')
4
- .pipe(gulp.dest(siteSettings.distFolder + '/fonts'));
5
- };
6
- };
@@ -1,6 +0,0 @@
1
- module.exports = function(gulp, siteSettings) {
2
- return function() {
3
- return gulp.src(siteSettings.srcFolder + '/' + siteSettings.dataSubfolder + '/*.json')
4
- .pipe(gulp.dest(siteSettings.distFolder + '/' + siteSettings.dataSubfolder));
5
- };
6
- };
@@ -1,6 +0,0 @@
1
- module.exports = function (gulp, siteSettings) {
2
- return function () {
3
- return gulp.src(siteSettings.srcFolder + '/resources/**/')
4
- .pipe(gulp.dest(siteSettings.distFolder + '/resources/'));
5
- };
6
- };
@@ -1,6 +0,0 @@
1
- module.exports = function(gulp, siteSettings) {
2
- return function() {
3
- return gulp.src(siteSettings.srcFolder + '/videos' + '/*.mp4')
4
- .pipe(gulp.dest(siteSettings.distFolder + '/videos'));
5
- };
6
- };
@@ -1,22 +0,0 @@
1
- module.exports = function(gulp, gulpPlugins, siteSettings) {
2
- var srcPaths = [];
3
-
4
- srcPaths.push(siteSettings.srcFolder + '/*.*');
5
- srcPaths.push('!' + siteSettings.srcFolder + '/**/*.html');
6
-
7
- for (var i = 0; i < siteSettings.browserSyncServeFolders.length; i ++) {
8
- srcPaths.push(siteSettings.browserSyncServeFolders[i] + '/**/*.otf');
9
- srcPaths.push(siteSettings.browserSyncServeFolders[i] + '/**/*.eot');
10
- srcPaths.push(siteSettings.browserSyncServeFolders[i] + '/**/*.svg');
11
- srcPaths.push(siteSettings.browserSyncServeFolders[i] + '/**/*.ttf');
12
- srcPaths.push(siteSettings.browserSyncServeFolders[i] + '/**/*.woff');
13
- srcPaths.push(siteSettings.browserSyncServeFolders[i] + '/**/*.woff2');
14
- }
15
-
16
- return function() {
17
- return gulp.src(srcPaths, {
18
- dot: true
19
- })
20
- .pipe(gulp.dest(siteSettings.distFolder));
21
- };
22
- };
@@ -1,74 +0,0 @@
1
- var request = require('request');
2
- var source = require('vinyl-source-stream');
3
-
4
- // helper to allow us to define an "end" event to multiple streams
5
- function streamToDestination(gulp, siteSettings, inputPath, destPath, fileName) {
6
- var url = `https://${siteSettings.nodeEnv}${inputPath}`;
7
-
8
- return new Promise(resolve => { // eslint-disable-line no-undef
9
- request(url)
10
- .on('response', resp => {
11
- if (resp.statusCode !== 200) {
12
- throw new Error(`Error fetching ${url}`);
13
- }
14
- })
15
- .pipe(source(fileName))
16
- .pipe(gulp.dest(`${siteSettings.srcFolder}/${destPath}`))
17
- .on('finish', resolve);
18
- });
19
- }
20
-
21
- module.exports = function(gulp, gulpPlugins, siteSettings, siteData) {
22
- return function() {
23
- const { nodeEnv, isLocal } = siteSettings;
24
- const { isQSPage, isWhiteLabel, domain } = siteData;
25
- const isModWhiteLabel = isWhiteLabel && !isQSPage
26
- const domainHasModernize = domain.indexOf('modernize') > -1;
27
-
28
- let externalResources;
29
- // listing of Static Resources sub-path and site destination paths
30
- // key: inputPath, value: destPath
31
-
32
- externalResources = {
33
- '/quote/resources/mod-site/templates/scripts/trusted-form.html': ['/templates/scripts/', 'trusted-form.html']
34
- };
35
-
36
- // grab footer modals and place under the resources
37
- Object.assign(externalResources, {
38
- '/quote/resources/shared-resources/templates/modals/about/': ['/resources/templates/modals/about/', 'index.html'],
39
- '/quote/resources/shared-resources/templates/modals/privacy/': ['/resources/templates/modals/privacy/', 'index.html'],
40
- '/quote/resources/shared-resources/templates/modals/terms/': ['/resources/templates/modals/terms/', 'index.html'],
41
- '/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']
43
- })
44
-
45
- Object.assign(externalResources, {'/quote/resources/mod-site/templates/scripts/jornaya.html': ['/templates/scripts/', 'jornaya.html']});
46
-
47
- if (isModWhiteLabel || domainHasModernize) {
48
- Object.assign(externalResources, {'/quote/resources/mod-site/templates/scripts/recaptcha.html': ['/templates/scripts/', 'recaptcha.html']});
49
- }
50
-
51
- // local dev files
52
- const remoteFilesForLocalDev = {
53
- '/quote/resources/mod-site/scripts/vendor/maxmind-geoip2.js': ['/temp/scripts/', 'maxmind-geoip2.js']
54
- };
55
-
56
- if (!nodeEnv) {
57
- throw new Error('Missing environment variables. Did you start with gulp instead of npm run...?');
58
- }
59
-
60
- // only save modform/utils if its local development
61
- if (isLocal) {
62
- externalResources = { ...externalResources, ...remoteFilesForLocalDev };
63
- }
64
-
65
- const filesPromiseMap = Object.keys(externalResources).map(key => {
66
- const destinationPath = externalResources[key][0];
67
- const fileName = externalResources[key][1];
68
- return streamToDestination(gulp, siteSettings, key, destinationPath, fileName);
69
- });
70
-
71
- // when Promise.all resolves, the streams are done and we can go to the next step
72
- return Promise.all(filesPromiseMap); // eslint-disable-line no-undef
73
- };
74
- };
@@ -1,55 +0,0 @@
1
- /* globals Promise */
2
- var request = require('request');
3
- var source = require('vinyl-source-stream');
4
-
5
- // helper to allow us to define an "end" event to multiple streams
6
- function streamToDestination(gulp, siteSettings, destPath, fileName) {
7
- if (!fileName) {
8
- return false;
9
- }
10
-
11
- var url = `https://${siteSettings.nodeEnv}/quote/resources/mod-form/form/${fileName}`;
12
- return new Promise(resolve => { // eslint-disable-line no-undef
13
- request(url)
14
- .on('response', (resp) => {
15
- if (resp.statusCode !== 200) {
16
- throw new Error(`Error fetching ${url}`);
17
- }
18
- })
19
- .pipe(source(fileName))
20
- .pipe(gulp.dest(`${siteSettings.srcFolder}/${destPath}`))
21
- .on('finish', resolve);
22
- });
23
- }
24
-
25
- async function getHelpers(siteSettings) {
26
- let helpers = [];
27
- await new Promise(resolve => {
28
- request(`https://${siteSettings.nodeEnv}/quote/resources/mod-form/form/chunks.txt`, function(err, response, body) {
29
- if (response.statusCode === 200) {
30
- helpers = body.split('\n');
31
- }
32
- resolve();
33
- });
34
- });
35
- return helpers;
36
- }
37
-
38
- module.exports = function(gulp, gulpPlugins, siteSettings, siteData) {
39
- return async function() {
40
- const { nodeEnv } = siteSettings;
41
- const helpers = await getHelpers(siteSettings);
42
-
43
- if (!nodeEnv) {
44
- throw new Error('Missing environment variables. Did you start with gulp instead of npm run...?');
45
- }
46
- const destinationPath = '/resources/scripts/helpers/';
47
- const filesPromiseMap = helpers.map(helper => {
48
- const fileName = helper;
49
- return streamToDestination(gulp, siteSettings, destinationPath, fileName);
50
- });
51
-
52
- // when Promise.all resolves, the streams are done and we can go to the next step
53
- return Promise.all(filesPromiseMap); // eslint-disable-line no-undef
54
- };
55
- };
@@ -1,121 +0,0 @@
1
- var fs = require('fs');
2
- var request = require('request');
3
- var source = require('vinyl-source-stream');
4
- var replace = require('gulp-replace');
5
- var path = require('path')
6
-
7
- var imagePaths = [];
8
-
9
- function getFilePathFromURL(url) {
10
- let pathName = new URL(url).pathname;
11
- pathName = pathName.substring(0, pathName.lastIndexOf('/'));
12
- pathName = pathName.replace('/quote/resources/', '');
13
-
14
- return pathName;
15
- }
16
-
17
- function streamToDestination(gulp, siteSettings, url) {
18
- let finalDestination;
19
- let fileName = path.basename(url);
20
- const filePath = getFilePathFromURL(url);
21
-
22
- if (!fs.existsSync(siteSettings.distFolder)) {
23
- finalDestination = siteSettings.srcFolder;
24
- } else {
25
- finalDestination = siteSettings.distFolder;
26
- }
27
-
28
- // fix for svg sprites
29
- if (fileName.includes(".svg#")) {
30
- const hashIndex = fileName.indexOf("#");
31
- const strippedFileName = fileName.substring(0, hashIndex);
32
- fileName = strippedFileName;
33
- }
34
-
35
- return new Promise(resolve => { // eslint-disable-line no-undef
36
- request(url)
37
- .on('response', resp => {
38
- if (resp.statusCode !== 200 && resp.statusCode !== 206) {
39
- throw new Error(`${resp.statusCode} Error while fetching ${fileName}`);
40
- } else {
41
- imagePaths.push(url);
42
- }
43
- })
44
- .pipe(source(fileName))
45
- .pipe(gulp.dest(`${finalDestination}/resources/${filePath}`))
46
- .on('finish', resolve);
47
- });
48
- }
49
-
50
- function replaceImagePath(gulp, siteSettings) {
51
- var finalDestination;
52
-
53
- if (!fs.existsSync(siteSettings.distFolder)) {
54
- finalDestination = siteSettings.tmpFolder;
55
- } else {
56
- finalDestination = siteSettings.distFolder;
57
- }
58
-
59
- var stream = gulp.src(`${finalDestination}/index.html`);
60
-
61
- if (imagePaths.length) {
62
- imagePaths.forEach(function(imagePath) {
63
- const fileName = path.basename(imagePath);
64
- const filePath = getFilePathFromURL(imagePath);
65
- stream = stream.pipe(replace(new RegExp(`"${imagePath}"`, 'gm'), `"/resources/${filePath}/${fileName}"`))
66
- });
67
- }
68
- return stream.pipe(gulp.dest(finalDestination))
69
- }
70
-
71
- const getTags = (string) => {
72
- const regExs = [/<img.*?src="(.*?)"[^\>]+>/g, /<use.*?href="(.*?)".*?>/g, /<source.*?srcset="(.*?)".*?>/g, /url\('#{\$path}.*?'\)/g];
73
- let tags = [];
74
-
75
- regExs.forEach((regEx) => {
76
- const match = string.match(regEx);
77
-
78
- if (match) {
79
- tags = [...tags, ...match];
80
- }
81
- });
82
-
83
- return tags;
84
- };
85
-
86
- const getUrls = (tags) => {
87
- const urls = [];
88
-
89
- tags.forEach((tag) => {
90
- if (tag) {
91
- let url = tag;
92
- url = url.match(/(https?:\/\/[^\s]+)/gim);
93
- if (url) {
94
- url = url[0];
95
- url = url.replace(/"/g, "")
96
- urls.push(url)
97
- }
98
- }
99
- });
100
-
101
- return [...new Set(urls)]; // eslint-disable-line no-undef
102
- };
103
-
104
- const parseImageSources = (gulp, siteSettings) => {
105
- const text = fs.readFileSync(`${siteSettings.tmpFolder}/index.html`, 'utf8');
106
- const textMatches = getTags(text);
107
- return getUrls(textMatches);
108
- };
109
-
110
- module.exports = function(gulp, siteSettings, siteData) {
111
- return async function() {
112
- const urls = parseImageSources(gulp, siteSettings);
113
- const urlsPromises = urls.map(async (url) => {
114
- return await streamToDestination(gulp, siteSettings, url);
115
- });
116
-
117
- return await Promise.all(urlsPromises).then(function() { // eslint-disable-line no-undef
118
- replaceImagePath(gulp, siteSettings)
119
- })
120
- };
121
- };
@@ -1,79 +0,0 @@
1
- var fs = require('fs');
2
- var request = require('request');
3
- var source = require('vinyl-source-stream');
4
-
5
- function streamToDestination(gulp, siteSettings, externalPath, fileName, destPath) {
6
- return new Promise(resolve => { // eslint-disable-line no-undef
7
- request(`https://${siteSettings.nodeEnv}/quote/resources/assets/images/${externalPath}`)
8
- .on('response', resp => {
9
- if (resp.statusCode !== 200 && resp.statusCode !== 206) {
10
- throw new Error(`${resp.statusCode} Error while fetching ${fileName}`);
11
- }
12
- })
13
- .pipe(source(fileName))
14
- .pipe(gulp.dest(`${siteSettings.srcFolder}/${destPath}`))
15
- .on('finish', resolve);
16
- });
17
- }
18
-
19
- const getTags = (string) => {
20
- const regExs = [/<img.*?src="(.*?)"[^\>]+>/g, /<use.*?href="(.*?)".*?>/g, /<source.*?srcset="(.*?)".*?>/g, /url\('#{\$path}.*?'\)/g];
21
- let tags = [];
22
-
23
- regExs.forEach((regEx) => {
24
- const match = string.match(regEx);
25
-
26
- if (match) {
27
- tags = [...tags, ...match];
28
- }
29
- });
30
-
31
- return tags;
32
- };
33
-
34
- const getUrls = (tags) => {
35
- const urls = [];
36
-
37
- tags.forEach((tag) => {
38
- const isHTML = tag.indexOf('{{assetsPath}}');
39
- const isCSS = tag.indexOf('url(\'#{$path}');
40
- const varName = isHTML > -1 ? '{{assetsPath}}' : 'url(\'#{$path}';
41
-
42
- if (isHTML > -1 || isCSS > -1) {
43
- let url = tag;
44
-
45
- if (isHTML > -1) {
46
- url = url.slice(tag.indexOf(varName));
47
- url = url.indexOf('#') > -1 ? url.slice(0, url.indexOf('#')) : url.slice(0, url.indexOf('"'));
48
- } else {
49
- url = url.replace('\')', '');
50
- }
51
-
52
- url = url.replace(`${varName}/images/`, '');
53
- urls.push(url);
54
- }
55
- });
56
-
57
- return [...new Set(urls)]; // eslint-disable-line no-undef
58
- };
59
-
60
- const parseImageSources = (gulp, siteSettings) => {
61
- const text = fs.readFileSync(`${siteSettings.tmpFolder}/all.txt`, 'utf8');
62
- const textMatches = getTags(text);
63
- return getUrls(textMatches);
64
- };
65
-
66
- module.exports = function(gulp, siteSettings, siteData) {
67
- return function() {
68
- const { isWhiteLabel } = siteData;
69
- const urls = parseImageSources(gulp, siteSettings);
70
- const ouputPath = isWhiteLabel ? 'images/' : 'temp/assets/images/';
71
- const urlsPromises = urls.map((url) => {
72
- const fileName = url.slice(url.lastIndexOf('/') + 1);
73
- const relativePath = ouputPath + url.replace(fileName, '');
74
- return streamToDestination(gulp, siteSettings, url, fileName, relativePath);
75
- });
76
-
77
- return Promise.all(urlsPromises); // eslint-disable-line no-undef
78
- };
79
- };
@@ -1,46 +0,0 @@
1
- var request = require('request');
2
- var source = require('vinyl-source-stream');
3
-
4
- function streamSharedCompsToDestination(gulp, siteSettings, folder, fileName) {
5
- return new Promise(resolve => {
6
- request(`https://${siteSettings.nodeEnv}/quote/resources/mod-site/${folder}/${fileName}`)
7
- .on('response', resp => {
8
- if (resp.statusCode !== 200) {
9
- throw new Error(`${resp.statusCode} Error while fetching ${fileName}`);
10
- }
11
- })
12
- .pipe(source(fileName))
13
- .pipe(gulp.dest(`${siteSettings.srcFolder}/${folder}/`))
14
- .on('finish', resolve);
15
- });
16
- }
17
-
18
- function getListOfSharedComponents(gulp, gulpPlugins, siteSettings, componentFolders) {
19
- return componentFolders.map(folder => {
20
- return new Promise(resolve => {
21
- request(`https://${siteSettings.nodeEnv}/quote/resources/mod-site/${folder}/all.json`, function(err, resp, body) {
22
- if (resp.statusCode !== 200) {
23
- throw new Error(`${resp.statusCode}: Error while fetching ${folder}/all.json`);
24
- }
25
- var listOfComponents = JSON.parse(body);
26
- const componentPromises = listOfComponents.map(function(resource) {
27
- return streamSharedCompsToDestination(gulp, siteSettings, folder, `${resource}`);
28
- });
29
- resolve(Promise.all(componentPromises));
30
- });
31
- });
32
- });
33
- }
34
-
35
- module.exports = function(gulp, gulpPlugins, siteSettings) {
36
- return function() {
37
- const { nodeEnv } = siteSettings;
38
- if (!nodeEnv) {
39
- throw new Error('Missing environment variables. Did you start with gulp instead of npm run...?');
40
- }
41
-
42
- const componentFolders = ['shared-components', 'accessible-components']
43
-
44
- return getListOfSharedComponents(gulp, gulpPlugins, siteSettings, componentFolders);
45
- };
46
- };