mod-build 4.0.0-alpha.1 → 4.0.0-alpha.10

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 (111) hide show
  1. package/gulp-tasks/add-path-subdirectories.js +2 -2
  2. package/gulp-tasks/grab-shared-scripts.js +16 -3
  3. package/{src/main.js → main.js} +11 -9
  4. package/package.json +13 -14
  5. package/public/images/logo.svg +4 -0
  6. package/siteconfig.js +3 -38
  7. package/src/data/config.js +16 -0
  8. package/src/{index.html → pages/index.hbs} +7 -7
  9. package/src/scripts/utils.js +15 -25
  10. package/src/scripts/vendor/+.js +5 -0
  11. package/src/styles/partials/+.css +9 -0
  12. package/src/templates/components/head.html +8 -12
  13. package/tasks/build.js +13 -0
  14. package/tasks/clean.js +2 -3
  15. package/tasks/grab-cdn.js +15 -10
  16. package/tasks/grab-form-helpers.js +5 -6
  17. package/tasks/grab-shared-components.js +12 -13
  18. package/tasks/grab-shared-scripts.js +14 -16
  19. package/tasks/serve.js +3 -9
  20. package/tasks/templates.js +71 -101
  21. package/template.js +2 -796
  22. package/vite.config.js +18 -31
  23. package/src/accessible-components/button/_button.scss +0 -195
  24. package/src/accessible-components/button/back-button.html +0 -4
  25. package/src/accessible-components/button/button.html +0 -17
  26. package/src/accessible-components/carousel/_carousel.scss +0 -112
  27. package/src/accessible-components/carousel/carousel.html +0 -25
  28. package/src/accessible-components/checkbox/_checkbox.scss +0 -96
  29. package/src/accessible-components/checkbox/checkbox.html +0 -8
  30. package/src/accessible-components/expand-collapse/_expand-collapse.scss +0 -122
  31. package/src/accessible-components/expand-collapse/expand-collapse.html +0 -8
  32. package/src/accessible-components/expand-collapse/expand-collapse.js +0 -52
  33. package/src/accessible-components/expand-collapse/expand-collapse.min.js +0 -2
  34. package/src/accessible-components/expand-collapse/expand-collapse.min.js.map +0 -1
  35. package/src/accessible-components/featured-block/_featured-block.scss +0 -219
  36. package/src/accessible-components/featured-block/featured-block.html +0 -54
  37. package/src/accessible-components/foot-assets/foot-assets.html +0 -92
  38. package/src/accessible-components/footer/footer.html +0 -2
  39. package/src/accessible-components/gtm-body/gtm-body.html +0 -4
  40. package/src/accessible-components/head/head.html +0 -188
  41. package/src/accessible-components/header/_header.scss +0 -289
  42. package/src/accessible-components/header/header.html +0 -66
  43. package/src/accessible-components/hero/_hero.scss +0 -371
  44. package/src/accessible-components/hero/hero.html +0 -53
  45. package/src/accessible-components/how-it-works/_how-it-works.scss +0 -217
  46. package/src/accessible-components/how-it-works/how-it-works-carousel.html +0 -12
  47. package/src/accessible-components/how-it-works/how-it-works-static.html +0 -12
  48. package/src/accessible-components/how-it-works/how-it-works.html +0 -14
  49. package/src/accessible-components/information/_information.scss +0 -92
  50. package/src/accessible-components/information/information.html +0 -26
  51. package/src/accessible-components/input/_input.scss +0 -202
  52. package/src/accessible-components/input/input.html +0 -22
  53. package/src/accessible-components/input/textarea.html +0 -9
  54. package/src/accessible-components/partners/_partners.scss +0 -232
  55. package/src/accessible-components/partners/partners.html +0 -56
  56. package/src/accessible-components/picture/picture.html +0 -19
  57. package/src/accessible-components/preloader/_preloader.scss +0 -61
  58. package/src/accessible-components/preloader/preloader.html +0 -23
  59. package/src/accessible-components/progress-bar/_progress-bar.scss +0 -119
  60. package/src/accessible-components/progress-bar/progress-bar.html +0 -21
  61. package/src/accessible-components/progress-bar/progress-bar.js +0 -37
  62. package/src/accessible-components/progress-bar/progress-bar.min.js +0 -2
  63. package/src/accessible-components/progress-bar/progress-bar.min.js.map +0 -1
  64. package/src/accessible-components/radio-button/_radio-button.scss +0 -537
  65. package/src/accessible-components/radio-button/radio-button.html +0 -34
  66. package/src/accessible-components/reviews/_reviews.scss +0 -175
  67. package/src/accessible-components/reviews/reviews-carousel.html +0 -12
  68. package/src/accessible-components/reviews/reviews-static.html +0 -12
  69. package/src/accessible-components/reviews/reviews.html +0 -37
  70. package/src/accessible-components/select/_select.scss +0 -69
  71. package/src/accessible-components/select/select.html +0 -10
  72. package/src/accessible-components/steps/_steps.scss +0 -524
  73. package/src/accessible-components/steps/defaultFormFieldConfig.json +0 -109
  74. package/src/accessible-components/steps/step-fields.html +0 -33
  75. package/src/accessible-components/steps/steps.html +0 -150
  76. package/src/accessible-components/tcpa/_tcpa.scss +0 -49
  77. package/src/accessible-components/tcpa/tcpa.html +0 -9
  78. package/src/accessible-components/tile/_tile.scss +0 -117
  79. package/src/accessible-components/tile/tile.html +0 -14
  80. package/src/accessible-components/value-props/_value-props.scss +0 -100
  81. package/src/accessible-components/value-props/value-props.html +0 -17
  82. package/src/accessible-components/zip-control/_zip-control.scss +0 -78
  83. package/src/accessible-components/zip-control/zip-control.html +0 -10
  84. package/src/data/theme.json +0 -164
  85. package/src/resources/scripts/abandonment/abandonment-1df90ee155f6c0893d90.min.js +0 -2
  86. package/src/resources/scripts/abandonment/abandonment.min.js +0 -2
  87. package/src/resources/scripts/footer/footer-component-7b5e263f64568573ecc0.min.js +0 -2
  88. package/src/resources/scripts/footer/footer-component.min.js +0 -2
  89. package/src/resources/scripts/helpers/initNumericOnlyFields.min.js +0 -2
  90. package/src/resources/scripts/helpers/initNumericOnlyFields.min.js.map +0 -1
  91. package/src/resources/scripts/helpers/isZipCodeValid.min.js +0 -2
  92. package/src/resources/scripts/helpers/isZipCodeValid.min.js.map +0 -1
  93. package/src/resources/scripts/mod-alytics/modalytics-0ac7d7a5a72ea67a0f47.min.js +0 -2
  94. package/src/resources/scripts/mod-alytics/modalytics.min.js +0 -2
  95. package/src/resources/scripts/mod-form/form/homeowner-77a4dd439b8db412678b.min.js +0 -2
  96. package/src/resources/scripts/mod-form/form/homeowner.min.js +0 -2
  97. package/src/resources/scripts/mod-utils/modutils-8ba40d21f559171ddd36.min.js +0 -2
  98. package/src/resources/scripts/mod-utils/modutils.min.js +0 -2
  99. package/src/resources/styles/components/abandonment/abandonment-ae63aca828944411eff7.min.css +0 -1
  100. package/src/resources/styles/components/abandonment/abandonment.min.css +0 -1
  101. package/src/resources/styles/components/footer/mod-footer-3717faf57147c62c1777.min.css +0 -1
  102. package/src/resources/styles/components/footer/mod-footer.min.css +0 -1
  103. package/src/resources/styles/components/footer/qs-footer-12bf078dc614ff221c3c.min.css +0 -1
  104. package/src/resources/styles/components/footer/qs-footer.min.css +0 -1
  105. package/src/resources/templates/modals/about/index.html +0 -9
  106. package/src/resources/templates/modals/contact-us/index.html +0 -348
  107. package/src/resources/templates/modals/faq/index.html +0 -9
  108. package/src/resources/templates/modals/privacy/index.html +0 -236
  109. package/src/resources/templates/modals/terms/index.html +0 -166
  110. package/src/scripts/mod-form-contractor.js +0 -522
  111. package/src/temp/scripts/maxmind-geoip2.js +0 -104
@@ -11,7 +11,7 @@ module.exports = function(gulp, gulpPlugins, siteSettings, siteData) {
11
11
  return `href="${pathSubdirectory}favicon.ico"`;
12
12
  }))
13
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')) {
14
+ if (path.startsWith('src="images') || path.startsWith('src="scripts') || path.startsWith('src="shared-components') || path.startsWith('src="accessible-components')) {
15
15
  return `src="${pathSubdirectory}${path.slice(5)}`;
16
16
  }
17
17
  return match;
@@ -23,7 +23,7 @@ module.exports = function(gulp, gulpPlugins, siteSettings, siteData) {
23
23
  return match;
24
24
  }))
25
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')) {
26
+ if (path.startsWith('href="images') || path.startsWith('href="styles') || path.startsWith('href="shared-components') || path.startsWith('src="accessible-components')) {
27
27
  return `href="${pathSubdirectory}${path.slice(6)}`;
28
28
  }
29
29
  return match;
@@ -13,7 +13,8 @@ const fileNames = {
13
13
  footerComponentJsFileName: '',
14
14
  modFooterStylesFileName: '',
15
15
  qsFooterStylesFileName: '',
16
- homeownerFormFileName: ''
16
+ homeownerFormFileName: '',
17
+ callrailFileName: ''
17
18
  };
18
19
  var isQuotePageOrUseRelativePath = false;
19
20
  var resourceURL = '';
@@ -29,9 +30,11 @@ function replaceModalyticsSrc(gulp, gulpPlugins, siteSettings, siteData) {
29
30
  function replaceFootAssetScripts(gulp, gulpPlugins, siteSettings, siteData) {
30
31
  const resourcePath = isQuotePageOrUseRelativePath ? `${pathSubdirectory}{{#if this.nodeModulesPath}}{{this.nodeModulesPath}}{{/if}}resources/scripts` : '/resources/scripts';
31
32
  return gulp.src(`${siteSettings.srcFolder}/${componentFolderPath}/foot-assets/foot-assets.html`)
32
- .pipe(replace(/"(?:(?!"|js")[\s\S])+(modutils|mod-utils.*?)js"|"(?:(?!"|")[\s\S])+(footer\/footer-component.*?)js"|"(?:(?!"|")[\s\S])+(mod-form\/form.*?)js"/g, function(match) {
33
- if (match.includes('mod-form/form')) {
33
+ .pipe(replace(/"(?:(?!"|js")[\s\S])+(modutils|mod-utils.*?)js"|"(?:(?!"|")[\s\S])+(callrail.*?)js"|"(?:(?!"|")[\s\S])+(footer\/footer-component.*?)js"|"(?:(?!"|")[\s\S])+(mod-form\/form.*?)js"/g, function(match) {
34
+ if (match.includes('mod-form/form')) {
34
35
  return `"${resourcePath}/mod-form/form/${fileNames.homeownerFormFileName}"`;
36
+ } else if (match.includes('callrail')) {
37
+ return `"${resourcePath}/callrail/${fileNames.callrailFileName}"`;
35
38
  } else if (match.includes('modutils') || match.includes('mod-utils')) {
36
39
  return `"${resourcePath}/mod-utils/${fileNames.modUtilsFileName}"`;
37
40
  } else if (match.includes('footer-component')) {
@@ -140,6 +143,16 @@ function getResource(url, config = {}, fn, fnArray) {
140
143
  });
141
144
  }
142
145
  const TASKS = {
146
+ copyCallrail: {
147
+ url: 'shared-resources/scripts/callrail/callrail.min.js',
148
+ config: {
149
+ fileName: 'callrailFileName',
150
+ dest: 'scripts/callrail',
151
+ mapUrl: 'shared-resources/scripts/callrail/callrail.min.js.map',
152
+ },
153
+ srcReplaceFn: null,
154
+ additionalSrcReplaceFns: []
155
+ },
143
156
  copyModutils: {
144
157
  url: 'mod-utils/modutils.min.js',
145
158
  config: {
@@ -1,17 +1,19 @@
1
- import './styles/home.scss';
2
- import { templateData } from '../template.js';
3
- import { defaultSettings, siteData } from '../siteconfig.js';
1
+ import './src/styles/home.scss';
2
+ import { templateData } from './template.js';
3
+ import { siteData } from './siteconfig.js';
4
+ import { defaultSettings } from './src/data/config.js';
4
5
 
5
6
  const { page } = templateData();
6
-
7
+
7
8
  if (page.headConfig.useDynamicGtm || typeof window.isQSPage === 'undefined') {
8
- import('./scripts/has-qs-params.js').then((qs) => {
9
+ import('./src/scripts/has-qs-params.js').then((qs) => {
9
10
  qs.default();
10
11
  window.gtm_container_ID = window.isQSPage ? siteData.qs_gtm_container_ID : siteData.gtm_container_ID;
11
12
  });
12
13
  }
13
-
14
+
14
15
  const { additionalAssets } = page.headConfig;
16
+
15
17
  if (additionalAssets) {
16
18
  const { afterBegin, beforeEnd } = additionalAssets;
17
19
 
@@ -28,7 +30,7 @@ if (additionalAssets) {
28
30
  const { type, src, isLocal, localSrc, useModCdn, defer, async } = asset;
29
31
  if (type === 'script') {
30
32
  const script = document.createElement(type);
31
- script.src = (isLocal ? localSrc : (useModCdn ? `https://${defaultSettings.resourceDomain}/${src}` : src));
33
+ script.src = (isLocal ? localSrc : (useModCdn ? `https://${defaultSettings.nodeEnv}/${src}` : src));
32
34
  script.async = async;
33
35
  script.defer = defer;
34
36
  document.head.appendChild(script);
@@ -37,9 +39,9 @@ if (additionalAssets) {
37
39
  if (type === 'style') {
38
40
  const link = document.createElement('link');
39
41
  link.rel = 'stylesheet';
40
- link.href = (isLocal ? localSrc : (useModCdn ? `https://${defaultSettings.resourceDomain}/${src}` : src));
42
+ link.href = (isLocal ? localSrc : (useModCdn ? `https://${defaultSettings.nodeEnv}/${src}` : src));
41
43
  document.head.appendChild(link);
42
44
  }
43
45
  });
44
46
  }
45
- }
47
+ }
package/package.json CHANGED
@@ -1,31 +1,30 @@
1
1
  {
2
2
  "name": "mod-build",
3
- "version": "4.0.0-alpha.1",
3
+ "version": "4.0.0-alpha.10",
4
4
  "description": "Share components for S3 sites.",
5
5
  "type": "module",
6
6
  "scripts": {
7
- "dev": "export NODE_ENV=qa.modernize.com IS_LOCAL=true && vite",
8
- "build": "vite build",
9
- "preview": "vite preview"
7
+ "dev": "export NODE_ENV=modernize.com IS_LOCAL=true && vite",
8
+ "build": "export NODE_ENV=modernize.com && vite build",
9
+ "preview": "export NODE_ENV=modernize.com && vite preview"
10
10
  },
11
- "devDependencies": {
11
+ "dependencies": {
12
12
  "@rollup/plugin-inject": "^5.0.5",
13
+ "@vituum/vite-plugin-handlebars": "^1.1.0",
14
+ "axios": "^1.6.2",
15
+ "del": "^7.1.0",
13
16
  "eslint": "^8.55.0",
14
17
  "gulp": "^4.0.2",
18
+ "gulp-handlebars-file-include": "^1.0.0",
15
19
  "gulp-hash": "^4.2.2",
20
+ "gulp-replace": "^1.1.4",
16
21
  "gulp-tap": "^2.0.0",
17
22
  "husky": "^8.0.3",
23
+ "lodash.merge": "^4.6.2",
18
24
  "sass": "^1.69.5",
19
25
  "vite": "^5.0.0",
20
26
  "vite-plugin-eslint": "^1.8.1",
21
- "vite-plugin-handlebars": "^1.6.0",
22
- "vite-plugin-static-copy": "^1.0.0"
23
- },
24
- "dependencies": {
25
- "axios": "^1.6.2",
26
- "del": "^7.1.0",
27
- "gulp-handlebars-file-include": "^1.0.0",
28
- "gulp-replace": "^1.1.4",
29
- "jquery": "^3.7.1"
27
+ "vite-plugin-static-copy": "^1.0.0",
28
+ "vituum": "^1.1.0"
30
29
  }
31
30
  }
@@ -0,0 +1,4 @@
1
+ <svg width="245" height="45" viewBox="0 0 245 45" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <path d="M74.94 27.036C74.628 27.504 74.2467 27.946 73.796 28.362C73.3627 28.778 72.8513 29.142 72.262 29.454C71.69 29.766 71.0487 30.0087 70.338 30.182C69.6447 30.3727 68.882 30.468 68.05 30.468C66.6633 30.468 65.3807 30.2253 64.202 29.74C63.0233 29.2547 62.0093 28.5873 61.16 27.738C60.3107 26.8713 59.6433 25.8487 59.158 24.67C58.69 23.4913 58.456 22.2 58.456 20.796C58.456 19.392 58.6987 18.1007 59.184 16.922C59.6693 15.7433 60.3367 14.7293 61.186 13.88C62.0527 13.0133 63.0667 12.3373 64.228 11.852C65.4067 11.3667 66.6807 11.124 68.05 11.124C68.726 11.124 69.3847 11.1933 70.026 11.332C70.6847 11.4707 71.3 11.67 71.872 11.93C72.444 12.1727 72.964 12.476 73.432 12.84C73.9 13.1867 74.29 13.5853 74.602 14.036L73.042 15.18C72.8513 14.8853 72.5913 14.5907 72.262 14.296C71.95 14.0013 71.5773 13.7413 71.144 13.516C70.7107 13.2907 70.234 13.1087 69.714 12.97C69.2113 12.8313 68.6653 12.762 68.076 12.762C66.88 12.762 65.8053 12.9787 64.852 13.412C63.916 13.8453 63.1187 14.4347 62.46 15.18C61.8013 15.908 61.2987 16.7573 60.952 17.728C60.6053 18.6987 60.432 19.7213 60.432 20.796C60.432 21.8707 60.6053 22.8933 60.952 23.864C61.316 24.8347 61.8273 25.6927 62.486 26.438C63.1447 27.166 63.942 27.7467 64.878 28.18C65.8313 28.6133 66.8973 28.83 68.076 28.83C69.1333 28.83 70.1387 28.6133 71.092 28.18C72.0453 27.7467 72.8427 27.0533 73.484 26.1L74.94 27.036ZM91.4242 23.058C91.4242 24.1153 91.2335 25.086 90.8522 25.97C90.4882 26.854 89.9769 27.6167 89.3182 28.258C88.6769 28.8993 87.9055 29.402 87.0042 29.766C86.1202 30.13 85.1582 30.312 84.1182 30.312C83.0782 30.312 82.1162 30.13 81.2322 29.766C80.3482 29.402 79.5769 28.8993 78.9182 28.258C78.2769 27.6167 77.7742 26.854 77.4102 25.97C77.0462 25.086 76.8642 24.1153 76.8642 23.058C76.8642 22.0007 77.0462 21.03 77.4102 20.146C77.7742 19.262 78.2769 18.508 78.9182 17.884C79.5769 17.2427 80.3482 16.7487 81.2322 16.402C82.1162 16.0553 83.0782 15.882 84.1182 15.882C85.1582 15.882 86.1202 16.0553 87.0042 16.402C87.9055 16.7487 88.6769 17.2427 89.3182 17.884C89.9769 18.508 90.4882 19.262 90.8522 20.146C91.2335 21.03 91.4242 22.0007 91.4242 23.058ZM89.4482 23.058C89.4482 22.2953 89.3182 21.576 89.0582 20.9C88.8155 20.224 88.4602 19.6347 87.9922 19.132C87.5415 18.612 86.9869 18.2047 86.3282 17.91C85.6695 17.6153 84.9329 17.468 84.1182 17.468C83.3035 17.468 82.5669 17.6153 81.9082 17.91C81.2669 18.2047 80.7122 18.612 80.2442 19.132C79.7935 19.6347 79.4469 20.224 79.2042 20.9C78.9615 21.576 78.8402 22.2953 78.8402 23.058C78.8402 23.8207 78.9615 24.5487 79.2042 25.242C79.4642 25.918 79.8195 26.516 80.2702 27.036C80.7209 27.5387 81.2669 27.9373 81.9082 28.232C82.5669 28.5267 83.3035 28.674 84.1182 28.674C84.9329 28.674 85.6695 28.5267 86.3282 28.232C86.9869 27.9373 87.5415 27.5387 87.9922 27.036C88.4602 26.516 88.8155 25.918 89.0582 25.242C89.3182 24.5487 89.4482 23.8207 89.4482 23.058ZM102.315 26.958H102.367L106.527 16.194H109.361V30H107.541V18.378H107.489L102.835 30H101.717L97.063 18.378H97.037V30H95.217V16.194H98.077L102.315 26.958ZM114.031 16.194H118.321C119.795 16.194 120.973 16.5407 121.857 17.234C122.741 17.91 123.183 18.924 123.183 20.276C123.183 20.952 123.053 21.55 122.793 22.07C122.551 22.5727 122.204 22.9973 121.753 23.344C121.32 23.6907 120.8 23.9507 120.193 24.124C119.587 24.2973 118.928 24.384 118.217 24.384H115.851V30H114.031V16.194ZM115.851 22.85H118.113C119.084 22.85 119.864 22.642 120.453 22.226C121.043 21.7927 121.337 21.1427 121.337 20.276C121.337 19.392 121.034 18.7593 120.427 18.378C119.838 17.9967 119.067 17.806 118.113 17.806H115.851V22.85ZM125.502 30H123.578L129.532 16.194H131.222L137.15 30H135.096L133.666 26.542H126.958L125.502 30ZM127.608 24.956H133.016L130.338 18.3L127.608 24.956ZM149.037 27.348H149.089V16.194H150.909V30H148.621L141.497 18.612H141.471V30H139.651V16.194H142.017L149.037 27.348ZM160.224 30H158.404V24.02L153.256 16.194H155.44L159.34 22.512L163.24 16.194H165.424L160.224 24.02V30ZM185.516 30L178.106 17.962H178.028L178.132 30H173.816V11.592H178.886L186.27 23.604H186.348L186.244 11.592H190.56V30H185.516ZM198.569 15.362H203.093L209.177 30H204.471L203.483 27.348H198.023L197.009 30H192.407L198.569 15.362ZM200.753 19.756L199.089 24.228H202.391L200.753 19.756ZM215.095 21.004H215.017L215.095 30H210.935V15.362H216.785L219.671 23.89H219.775L222.531 15.362H228.329V30H224.039L224.117 21.004H224.039L221.049 30H218.007L215.095 21.004ZM231.959 15.362H242.333V18.664H236.197V21.004H241.995V24.176H236.197V26.672H242.697V30H231.959V15.362Z" fill="#212021"/>
3
+ <rect width="45" height="45" rx="22.5" fill="#DCDCDC"/>
4
+ </svg>
package/siteconfig.js CHANGED
@@ -1,38 +1,3 @@
1
- export let siteData = {
2
- primary_trade: 'Medical Alerts',
3
- service: 'alerts_medical', // required to fetch the correct tcpa blurb
4
- gtm_container_ID: 'GTM-TBJV3H', // e.g. GTM-N23VMDW
5
- qs_gtm_container_ID: 'GTM-TBJV3H',
6
- email: 'support@emedicalalerts.com', // e.g. // e.g. support@homesolarsurvey.com
7
- email_unsub: 'unsubscribe@emedicalalerts.com', // e.g. unsubscribe@homesolarsurvey.com
8
- domain: 'emedicalalerts.com', // e.g. homesolarsurvey.com
9
- company_name: 'eMedicalAlerts', // e.g. Home Solar Survey
10
- website_name: 'eMedicalAlerts.com', // e.g. HomeSolarSurvey.com
11
- useCDN: true,
12
- isWhiteLabel: true,
13
- isQSPage: true,
14
- useAccessibleConfig: true
15
- };
16
-
17
- export function setSiteData(newSiteData) {
18
- siteData = newSiteData;
19
- }
20
-
21
- export const defaultSettings = {
22
- tmpFolder: '.tmp',
23
- srcFolder: 'src',
24
- browserSyncServeFolders: ['.tmp', 'src', 'node_modules/mod-style-bootstrap/src', 'node_modules/mod-base/src'],
25
- distFolder: 'dist',
26
- fontsSubfolder: 'fonts',
27
- imagesSubfolder: 'images',
28
- stylesSubfolder: 'styles',
29
- scriptsSubfolder: 'scripts',
30
- scriptsCompiledFolder: 'scripts/compiled',
31
- templatesSubfolder: 'templates',
32
- dataSubfolder: 'data',
33
- modBuild: '',
34
- resourceDomain: process.env.IS_LOCAL ? 'qa.modernize.com' : 'modernize.com',
35
- nodeEnv: process.env.NODE_ENV,
36
- isLocal: process.env.IS_LOCAL || import.meta?.env?.DEV,
37
- buildPath: process.env.BUILD_PATH
38
- }
1
+ export const siteData = () => {
2
+ return {};
3
+ };
@@ -0,0 +1,16 @@
1
+ export const defaultSettings = {
2
+ tmpFolder: '.tmp',
3
+ srcFolder: 'src',
4
+ distFolder: 'dist',
5
+ fontsSubfolder: 'fonts',
6
+ imagesSubfolder: 'images',
7
+ stylesSubfolder: 'styles',
8
+ scriptsSubfolder: 'scripts',
9
+ scriptsCompiledFolder: 'scripts/compiled',
10
+ templatesSubfolder: 'templates',
11
+ dataSubfolder: 'data',
12
+ modBuild: '',
13
+ nodeEnv: process.env.NODE_ENV,
14
+ isLocal: process.env.IS_LOCAL || import.meta?.env?.DEV,
15
+ buildPath: process.env.BUILD_PATH
16
+ }
@@ -4,15 +4,15 @@
4
4
  {{ fileInclude 'src/templates/components/head.html'
5
5
  page = this
6
6
  path = 'home'
7
- }}
8
- </head>
7
+ }}
8
+ </head>
9
9
  <body>
10
+ {{ log this }}
10
11
  {{#header}}
11
- {{ fileInclude 'src/accessible-components/header/header.html'
12
- header = this
13
- }}
14
- {{/header}}
15
- <h1>Hello</h1>
12
+ {{ fileInclude 'src/accessible-components/header/header.html'
13
+ header = this
14
+ }}
15
+ {{/header}}
16
16
  <script type="module" src="/main.js"></script>
17
17
  </body>
18
18
  </html>
@@ -1,5 +1,4 @@
1
1
  import { seasons } from "../data/seasons.js";
2
- import { defaultSettings } from "../../siteconfig.js";
3
2
  import gulpHandlebarsFileInclude from "gulp-handlebars-file-include";
4
3
 
5
4
  export function getFileFromURL(url) {
@@ -140,35 +139,26 @@ export const handlebarsHelpers = [
140
139
  fn: function(obj) {
141
140
  var output = '';
142
141
  var ignoreKeys = Array.prototype.slice.call(arguments, 1, -1);
143
-
144
- for (var key in obj.attributes) {
145
- if (ignoreKeys.indexOf(key) === -1) {
146
- if (typeof obj.attributes[key] !== 'object') {
147
- output += key + '="' + obj.attributes[key] + '" ';
148
- } else if (key === 'data') {
149
- for (var dataKey in obj.attributes[key]) {
150
- output += 'data-' + dataKey + '="' + obj.attributes[key][dataKey] + '" ';
151
- }
152
- } else if (key === 'aria') {
153
- for (var ariaKey in obj.attributes[key]) {
154
- output += 'aria-' + ariaKey + '="' + obj.attributes[key][ariaKey] + '" ';
155
- }
156
- }
142
+ if (obj && typeof obj.attributes === 'object') {
143
+ for (var key in obj.attributes) {
144
+ if (ignoreKeys.indexOf(key) === -1) {
145
+ if (typeof obj.attributes[key] !== 'object') {
146
+ output += key + '="' + obj.attributes[key] + '" ';
147
+ } else if (key === 'data') {
148
+ for (var dataKey in obj.attributes[key]) {
149
+ output += 'data-' + dataKey + '="' + obj.attributes[key][dataKey] + '" ';
150
+ }
151
+ } else if (key === 'aria') {
152
+ for (var ariaKey in obj.attributes[key]) {
153
+ output += 'aria-' + ariaKey + '="' + obj.attributes[key][ariaKey] + '" ';
154
+ }
155
+ }
156
+ }
157
157
  }
158
158
  }
159
159
  return output.trim();
160
160
  }
161
161
  },
162
- {
163
- name: 'resolveAlias',
164
- fn: function(input) {
165
- if (input.includes('@')) {
166
- const resolvedValue = defaultSettings.modBuild || '';
167
- return input.replace('@', resolvedValue);
168
- }
169
- return input;
170
- }
171
- },
172
162
  {
173
163
  name: 'fileInclude',
174
164
  fn: function(input) {
@@ -0,0 +1,5 @@
1
+ import './google-tag-manager-head.js'
2
+ import './heap-addeventproperties-identify.js'
3
+ import './heap-tracking.js'
4
+ import './heap-vwo.js'
5
+ import './visual-website-optimizer.js'
@@ -0,0 +1,9 @@
1
+ @import "_contact-us.scss";
2
+ @import "_google-address-autocomplete.scss";
3
+ @import "_mixins.scss";
4
+ @import "_modal-pages.scss";
5
+ @import "_modernize-colors.scss";
6
+ @import "_qs-footer.scss";
7
+ @import "_quote-footer-v1.scss";
8
+ @import "_quote-footer-v2.scss";
9
+ @import "_quote-footer-v3.scss";
@@ -1,20 +1,16 @@
1
1
  <!-- an example of the head component for v4.0.0 -->
2
2
  <meta charset="UTF-8" />
3
- <link rel="icon" type="image/svg+xml" href="/{{#if page.headConfig.faviconPath}}{{page.headConfig.faviconPath}}{{else}}favicon.svg"{{/if}} />
3
+ <link rel="icon" type="image/svg+xml" href="{{#if page.headConfig.faviconPath}}{{page.headConfig.faviconPath}}{{else}}favicon.svg"{{/if}} />
4
4
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
5
5
 
6
- <!-- assets links afterBegin -->
7
- {{#if page.headConfig.useModAnalytics}}
8
- <script src="https://{{this.resourceDomain}}/quote/resources/mod-alytics/modalytics.min.js" {{#if page.headConfig.deferModAnalytics}}defer{{/if}} {{#if page.headConfig.asyncModAnalytics}}async{{/if}}></script>
6
+ {{#if this.page.headConfig.useModAnalytics}}
7
+ <script src="https://{{this.page.nodeEnv}}/quote/resources/mod-alytics/modalytics.min.js" {{#if page.headConfig.deferModAnalytics}}defer{{/if}} {{#if page.headConfig.asyncModAnalytics}}async{{/if}}></script>
9
8
  {{/if}}
10
-
11
- <!-- Include vwo setup -->
12
- {{#xif "this.page.headConfig.vwoSetup.vwoPathArray.indexOf(this.path) > -1" }}
9
+ {{#xif "this.page.headConfig.vwoSetup.vwoPathArray.includes(this.path)" }}
13
10
  <link rel="preconnect" href="https://dev.visualwebsiteoptimizer.com">
14
- <!-- Do not double hit our analytical resources (Heap/Google Analytics) if the page is going to be redirected by a VWO a/b test-->
15
- <script src="{{ resolveAlias '@/scripts/vendor/visual-website-optimizer.js'}}"></script>
11
+ <script type="module" src="../scripts/vendor/visual-website-optimizer.js"></script>
16
12
  {{else}}
17
- <script src="{{ resolveAlias '@/scripts/url-cleaner.js'}}"></script>
13
+ <script type="module" src="../scripts/url-cleaner.js'"></script>
18
14
  {{/xif}}
19
15
 
20
16
  {{#unless page.headConfig.disableRobots}}
@@ -48,13 +44,13 @@
48
44
 
49
45
  <!-- site title -->
50
46
  <title>
51
- {{#if page.headConfig.inverseTitle}}
47
+ {{#if this.headConfig.inverseTitle}}
52
48
  {{#unless page.headConfig.hideTitleCompanyName}}{{company_name}} | {{/unless}}
53
49
  {{#if this.pageTitle}}
54
50
  {{this.pageTitle}}
55
51
  {{else}}
56
52
  {{#if page.headConfig.title}}
57
- {{page.headConfig.title}}
53
+ {{this.headConfig.title}}
58
54
  {{/if}}
59
55
  {{/if}}
60
56
  {{else}}
package/tasks/build.js ADDED
@@ -0,0 +1,13 @@
1
+ import gulp from 'gulp';
2
+ import grabSharedComponents from './grab-shared-components.js';
3
+ import grabSharedScripts from './grab-shared-scripts.js';
4
+ import clean from './clean.js';
5
+ import grabCdn from './grab-cdn.js';
6
+ import grabFormHelpers from './grab-form-helpers.js';
7
+ import templates from './templates.js';
8
+
9
+ export function done() {
10
+ console.log('build done');
11
+ }
12
+
13
+ export default gulp.series(clean, grabCdn, grabSharedComponents, grabSharedScripts, grabFormHelpers, templates, done);
package/tasks/clean.js CHANGED
@@ -1,10 +1,9 @@
1
1
  import { deleteSync } from 'del';
2
- import { defaultSettings } from '../siteconfig';
2
+ import { defaultSettings } from '../src/data/config.js';
3
3
 
4
4
  const clean = (done) => {
5
5
  deleteSync([
6
- `src/${defaultSettings.tmpFolder}/`,
7
- `${defaultSettings.distFolder}/`
6
+ `src/${defaultSettings.tmpFolder}/`
8
7
  ]);
9
8
  console.log('clean finished');
10
9
  done();
package/tasks/grab-cdn.js CHANGED
@@ -1,5 +1,4 @@
1
- import { defaultSettings, siteData } from '../siteconfig.js'
2
- import { templateData } from '../template.js';
1
+ import { defaultSettings } from '../src/data/config.js';
3
2
  import axios from 'axios';
4
3
  import { createWriteStream } from 'node:fs';
5
4
  import * as stream from 'node:stream';
@@ -8,7 +7,7 @@ import fs from 'node:fs';
8
7
 
9
8
  function streamToDestination(inputPath, destPath, fileName) {
10
9
  const finished = promisify(stream.finished);
11
- const url = `https://${defaultSettings.resourceDomain}${inputPath}`;
10
+ const url = `https://${defaultSettings.nodeEnv}${inputPath}`;
12
11
 
13
12
  return new Promise(resolve => {
14
13
  if (!fs.existsSync(`src/${destPath}`)) {
@@ -44,11 +43,10 @@ function streamToDestination(inputPath, destPath, fileName) {
44
43
  });
45
44
  }
46
45
 
47
- export default async function(done) {
46
+ export default async function(config) {
48
47
  const { nodeEnv, isLocal } = defaultSettings;
49
- const { isQSPage, isWhiteLabel, domain } = siteData;
50
- const { page } = templateData();
51
- const { themeFile } = page;
48
+ const { isQSPage, isWhiteLabel, domain, page } = config;
49
+ const { themeFile, cssThemes } = page;
52
50
  const isModWhiteLabel = isWhiteLabel && !isQSPage
53
51
  const domainHasModernize = domain.indexOf('modernize') > -1;
54
52
 
@@ -75,13 +73,21 @@ export default async function(done) {
75
73
  Object.assign(externalResources, {'/quote/resources/mod-site/templates/scripts/recaptcha.html': ['/templates/scripts/', 'recaptcha.html']});
76
74
  }
77
75
 
76
+ if (cssThemes && cssThemes.length > 0) {
77
+ cssThemes.forEach(theme => {
78
+ const themeFileName = `_${theme}.scss`;
79
+ const themePath = `/quote/resources/shared-resources/styles/themes/${themeFileName}`;
80
+ Object.assign(externalResources, {[themePath]: ['/resources/styles/themes/', themeFileName]});
81
+ });
82
+ }
83
+
78
84
  // local dev files
79
85
  const remoteFilesForLocalDev = {
80
86
  '/quote/resources/mod-site/scripts/vendor/maxmind-geoip2.js': ['/temp/scripts/', 'maxmind-geoip2.js']
81
87
  };
82
88
 
83
89
  // theme JSON
84
- if (isQSPage) {
90
+ if (isQSPage && themeFile) {
85
91
  Object.assign(externalResources, {
86
92
  [`/quote/resources/data/themes/${themeFile}.json`]: ['/data/', 'theme.json']
87
93
  });
@@ -103,5 +109,4 @@ export default async function(done) {
103
109
  });
104
110
 
105
111
  await Promise.all(filesPromiseMap);
106
- done();
107
- };
112
+ }
@@ -1,4 +1,4 @@
1
- import { defaultSettings } from '../siteconfig.js'
1
+ import { defaultSettings } from '../src/data/config.js';
2
2
  import axios from 'axios';
3
3
  import { createWriteStream } from 'node:fs';
4
4
  import * as stream from 'node:stream';
@@ -14,7 +14,7 @@ const streamToDestination = (destPath, fileName) => {
14
14
  }
15
15
 
16
16
  const finished = promisify(stream.finished);
17
- const url = `https://${defaultSettings.resourceDomain}/${resourcePath}/${fileName}`;
17
+ const url = `https://${defaultSettings.nodeEnv}/${resourcePath}/${fileName}`;
18
18
 
19
19
  return new Promise(resolve => {
20
20
  const folderPath = `${defaultSettings.srcFolder}/${destPath}`;
@@ -55,13 +55,13 @@ async function getHelpers() {
55
55
  let helpers = [];
56
56
  await new Promise(resolve => {
57
57
  const options = {
58
- url: `https://${defaultSettings.resourceDomain}/${resourcePath}/chunks.txt`,
58
+ url: `https://${defaultSettings.nodeEnv}/${resourcePath}/chunks.txt`,
59
59
  method: 'get'
60
60
  }
61
61
 
62
62
  axios(options).then(resp => {
63
63
  if (resp.status !== 200) {
64
- throw new Error(`${resp.status}: Error while fetching ${url}`);
64
+ throw new Error(`${resp.status}: Error while fetching ${options.url}`);
65
65
  }
66
66
  helpers = resp.data.split('\n');
67
67
  resolve();
@@ -76,7 +76,7 @@ async function getHelpers() {
76
76
  return helpers;
77
77
  }
78
78
 
79
- export default async function(done) {
79
+ export default async function() {
80
80
  const { nodeEnv } = defaultSettings;
81
81
  const helpers = await getHelpers(defaultSettings);
82
82
 
@@ -90,5 +90,4 @@ export default async function(done) {
90
90
  });
91
91
 
92
92
  await Promise.all(filesPromiseMap);
93
- done();
94
93
  }
@@ -1,4 +1,4 @@
1
- import { defaultSettings, siteData } from '../siteconfig.js'
1
+ import { defaultSettings } from '../src/data/config.js'
2
2
  import axios from 'axios';
3
3
  import { createWriteStream } from 'node:fs';
4
4
  import * as stream from 'node:stream';
@@ -6,7 +6,6 @@ import { promisify } from 'node:util';
6
6
  import fs from 'node:fs';
7
7
 
8
8
  const resourcePath = 'quote/resources/mod-site';
9
- const componentFolders = ['accessible-components'];
10
9
 
11
10
  const streamSharedCompsToDestination = (defaultSettings, folder, fileName) => {
12
11
  const finished = promisify(stream.finished);
@@ -15,10 +14,6 @@ const streamSharedCompsToDestination = (defaultSettings, folder, fileName) => {
15
14
  const folderPath = `${defaultSettings.srcFolder}/${folder}`;
16
15
  const componentFolderPath = fileName.split('/')[0];
17
16
 
18
- if (!fs.existsSync(folderPath)) {
19
- fs.mkdirSync(folderPath, { recursive: true });
20
- }
21
-
22
17
  if (!fs.existsSync(`${folderPath}/${componentFolderPath}`)) {
23
18
  fs.mkdirSync(`${folderPath}/${componentFolderPath}`, { recursive: true });
24
19
  }
@@ -29,14 +24,14 @@ const streamSharedCompsToDestination = (defaultSettings, folder, fileName) => {
29
24
  } else {
30
25
  const writer = createWriteStream(`${folderPath}/${fileName}`)
31
26
  const options = {
32
- url: `https://${defaultSettings.resourceDomain}/${resourcePath}/${folder}/${fileName}`,
27
+ url: `https://${defaultSettings.nodeEnv}/${resourcePath}/${folder}/${fileName}`,
33
28
  method: 'get',
34
29
  responseType: 'stream'
35
30
  };
36
31
 
37
32
  axios(options).then(resp => {
38
33
  if (resp.status !== 200) {
39
- throw new Error(`${resp.status}: Error while fetching ${url}`);
34
+ throw new Error(`${resp.status}: Error while fetching ${options.url}`);
40
35
  }
41
36
  console.log(`${folderPath}/${fileName} created...`);
42
37
  resp.data.pipe(writer);
@@ -53,15 +48,20 @@ const streamSharedCompsToDestination = (defaultSettings, folder, fileName) => {
53
48
 
54
49
  const getListOfSharedComponents = (defaultSettings, componentFolders) => {
55
50
  return componentFolders.map(folder => {
51
+ const folderPath = `${defaultSettings.srcFolder}/${folder}`;
52
+ if (fs.existsSync(`${folderPath}/`)) {
53
+ return;
54
+ }
55
+
56
56
  return new Promise(resolve => {
57
- axios.get(`https://${defaultSettings.resourceDomain}/${resourcePath}/${folder}/all.json`)
57
+ axios.get(`https://${defaultSettings.nodeEnv}/${resourcePath}/${folder}/all.json`)
58
58
  .then(resp => {
59
59
  if (resp.status !== 200) {
60
60
  throw new Error(`${resp.status}: Error while fetching ${folder}/all.json`);
61
61
  }
62
62
  const listOfComponents = resp.data;
63
63
  const componentPromises = listOfComponents.map(resource => {
64
- return streamSharedCompsToDestination(defaultSettings, folder, `${resource}`);
64
+ return streamSharedCompsToDestination(defaultSettings, folder, `${resource}`);
65
65
  });
66
66
 
67
67
  resolve(Promise.all(componentPromises));
@@ -74,8 +74,7 @@ const getListOfSharedComponents = (defaultSettings, componentFolders) => {
74
74
  });
75
75
  }
76
76
 
77
- export default function(done) {
78
- console.log('running grab-shared-components');
77
+ export default function(config) {
78
+ const componentFolders = config.useAccessibleConfig ? ['accessible-components'] : ['shared-components'];
79
79
  getListOfSharedComponents(defaultSettings, componentFolders);
80
- done();
81
80
  }