mod-build 4.0.0-beta.3b → 4.0.0-beta.4

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 (167) hide show
  1. package/package.json +2 -1
  2. package/src/scripts/utils.js +16 -15
  3. package/src/styles/home.scss +1 -5
  4. package/tasks/grab-cdn.js +5 -5
  5. package/tasks/grab-shared-scripts.js +62 -74
  6. package/tasks/serve.js +4 -3
  7. package/tasks/templates.js +3 -11
  8. package/vite.config.js +9 -2
  9. package/src/accessible-components/button/_button.scss +0 -308
  10. package/src/accessible-components/button/back-button.html +0 -8
  11. package/src/accessible-components/button/button.html +0 -17
  12. package/src/accessible-components/carousel/_carousel.scss +0 -112
  13. package/src/accessible-components/carousel/carousel.html +0 -25
  14. package/src/accessible-components/carousel/carousel.js +0 -3426
  15. package/src/accessible-components/carousel/carousel.js.map +0 -1
  16. package/src/accessible-components/carousel/carousel.min.js +0 -6
  17. package/src/accessible-components/carousel/carousel.min.js.map +0 -1
  18. package/src/accessible-components/checkbox/_checkbox.scss +0 -153
  19. package/src/accessible-components/checkbox/checkbox-group.html +0 -18
  20. package/src/accessible-components/checkbox/checkbox.html +0 -8
  21. package/src/accessible-components/expand-collapse/_expand-collapse.scss +0 -129
  22. package/src/accessible-components/expand-collapse/expand-collapse.html +0 -14
  23. package/src/accessible-components/expand-collapse/expand-collapse.js +0 -52
  24. package/src/accessible-components/expand-collapse/expand-collapse.min.js +0 -2
  25. package/src/accessible-components/expand-collapse/expand-collapse.min.js.map +0 -1
  26. package/src/accessible-components/featured-block/_featured-block.scss +0 -221
  27. package/src/accessible-components/featured-block/featured-block.html +0 -54
  28. package/src/accessible-components/foot-assets/foot-assets.html +0 -112
  29. package/src/accessible-components/footer/footer.html +0 -2
  30. package/src/accessible-components/gtm-body/gtm-body.html +0 -4
  31. package/src/accessible-components/head/head.html +0 -187
  32. package/src/accessible-components/header/_header.scss +0 -287
  33. package/src/accessible-components/header/header.html +0 -66
  34. package/src/accessible-components/hero/_hero.scss +0 -405
  35. package/src/accessible-components/hero/hero.html +0 -53
  36. package/src/accessible-components/how-it-works/_how-it-works.scss +0 -217
  37. package/src/accessible-components/how-it-works/how-it-works-carousel.html +0 -12
  38. package/src/accessible-components/how-it-works/how-it-works-static.html +0 -12
  39. package/src/accessible-components/how-it-works/how-it-works.html +0 -14
  40. package/src/accessible-components/information/_information.scss +0 -96
  41. package/src/accessible-components/information/information.html +0 -32
  42. package/src/accessible-components/input/_input.scss +0 -204
  43. package/src/accessible-components/input/input.html +0 -22
  44. package/src/accessible-components/input/textarea.html +0 -9
  45. package/src/accessible-components/partners/_partners.scss +0 -234
  46. package/src/accessible-components/partners/partners.html +0 -56
  47. package/src/accessible-components/picture/picture.html +0 -19
  48. package/src/accessible-components/preloader/_preloader.scss +0 -61
  49. package/src/accessible-components/preloader/preloader.html +0 -23
  50. package/src/accessible-components/progress-bar/_progress-bar.scss +0 -140
  51. package/src/accessible-components/progress-bar/progress-bar.html +0 -21
  52. package/src/accessible-components/progress-bar/progress-bar.js +0 -37
  53. package/src/accessible-components/progress-bar/progress-bar.min.js +0 -2
  54. package/src/accessible-components/progress-bar/progress-bar.min.js.map +0 -1
  55. package/src/accessible-components/radio-button/_radio-button.scss +0 -586
  56. package/src/accessible-components/radio-button/radio-button.html +0 -33
  57. package/src/accessible-components/reviews/_reviews.scss +0 -175
  58. package/src/accessible-components/reviews/reviews-carousel.html +0 -12
  59. package/src/accessible-components/reviews/reviews-static.html +0 -12
  60. package/src/accessible-components/reviews/reviews.html +0 -37
  61. package/src/accessible-components/select/_select.scss +0 -69
  62. package/src/accessible-components/select/select.html +0 -10
  63. package/src/accessible-components/steps/_steps.scss +0 -636
  64. package/src/accessible-components/steps/defaultFormFieldConfig.json +0 -109
  65. package/src/accessible-components/steps/step-fields.html +0 -38
  66. package/src/accessible-components/steps/steps.html +0 -160
  67. package/src/accessible-components/tcpa/_tcpa.scss +0 -49
  68. package/src/accessible-components/tcpa/tcpa.html +0 -9
  69. package/src/accessible-components/tile/_tile.scss +0 -117
  70. package/src/accessible-components/tile/tile.html +0 -14
  71. package/src/accessible-components/value-props/_value-props.scss +0 -102
  72. package/src/accessible-components/value-props/value-props.html +0 -17
  73. package/src/accessible-components/zip-control/_zip-control.scss +0 -79
  74. package/src/accessible-components/zip-control/zip-control.html +0 -10
  75. package/src/resources/data/tcpa.json +0 -3
  76. package/src/resources/scripts/abandonment/abandonment-e099a424bf17408f1db2.min.js +0 -2
  77. package/src/resources/scripts/abandonment/abandonment.min.js +0 -2
  78. package/src/resources/scripts/footer/footer-component-7b5e263f64568573ecc0.min.js +0 -2
  79. package/src/resources/scripts/footer/footer-component.min.js +0 -2
  80. package/src/resources/scripts/helpers/initNumericOnlyFields.min.js +0 -2
  81. package/src/resources/scripts/helpers/initNumericOnlyFields.min.js.map +0 -1
  82. package/src/resources/scripts/helpers/isZipCodeValid.min.js +0 -2
  83. package/src/resources/scripts/helpers/isZipCodeValid.min.js.map +0 -1
  84. package/src/resources/scripts/mod-alytics/modalytics-0ac7d7a5a72ea67a0f47.min.js +0 -2
  85. package/src/resources/scripts/mod-alytics/modalytics.min.js +0 -2
  86. package/src/resources/scripts/mod-form/form/homeowner-f395431201f7a6e56690.min.js +0 -2
  87. package/src/resources/scripts/mod-form/form/homeowner.min.js +0 -2
  88. package/src/resources/scripts/mod-utils/modutils-a08fecfbb83afad1a9f8.min.js +0 -2
  89. package/src/resources/scripts/mod-utils/modutils.min.js +0 -2
  90. package/src/resources/styles/components/abandonment/abandonment-a8571a9e32ed6ef9acb4.min.css +0 -1
  91. package/src/resources/styles/components/abandonment/abandonment.min.css +0 -1
  92. package/src/resources/styles/components/footer/mod-footer-1fb2cec3278f29df57d0.min.css +0 -1
  93. package/src/resources/styles/components/footer/mod-footer.min.css +0 -1
  94. package/src/resources/styles/components/footer/qs-footer-9a3b0ab00428b03e6e9e.min.css +0 -1
  95. package/src/resources/styles/components/footer/qs-footer.min.css +0 -1
  96. package/src/resources/templates/modals/about/index.hbs +0 -9
  97. package/src/resources/templates/modals/about/index.html +0 -9
  98. package/src/resources/templates/modals/contact-us/index.hbs +0 -348
  99. package/src/resources/templates/modals/contact-us/index.html +0 -348
  100. package/src/resources/templates/modals/faq/index.hbs +0 -9
  101. package/src/resources/templates/modals/faq/index.html +0 -9
  102. package/src/resources/templates/modals/privacy/index.hbs +0 -236
  103. package/src/resources/templates/modals/privacy/index.html +0 -236
  104. package/src/resources/templates/modals/terms/index.hbs +0 -166
  105. package/src/resources/templates/modals/terms/index.html +0 -166
  106. package/src/scripts/default/+.js +0 -3
  107. package/src/scripts/vendor/+.js +0 -5
  108. package/src/shared-components/card-button/_card-button.scss +0 -49
  109. package/src/shared-components/card-button/card-button.html +0 -9
  110. package/src/shared-components/carousel/_carousel.scss +0 -106
  111. package/src/shared-components/carousel/carousel.html +0 -22
  112. package/src/shared-components/carousel/carousel.js +0 -3427
  113. package/src/shared-components/carousel/carousel.js.map +0 -1
  114. package/src/shared-components/carousel/carousel.min.js +0 -6
  115. package/src/shared-components/carousel/carousel.min.js.map +0 -1
  116. package/src/shared-components/carousel/carousel.min.min.js +0 -6
  117. package/src/shared-components/carousel/carousel.min.min.js.map +0 -1
  118. package/src/shared-components/checkbox/_checkbox.scss +0 -104
  119. package/src/shared-components/checkbox/checkbox.html +0 -6
  120. package/src/shared-components/expand-collapse/_expand-collapse.scss +0 -93
  121. package/src/shared-components/expand-collapse/expand-collapse.html +0 -8
  122. package/src/shared-components/expand-collapse/expand-collapse.js +0 -40
  123. package/src/shared-components/expand-collapse/expand-collapse.min.js +0 -2
  124. package/src/shared-components/expand-collapse/expand-collapse.min.js.map +0 -1
  125. package/src/shared-components/featured-block/_featured-block.scss +0 -185
  126. package/src/shared-components/featured-block/featured-block.html +0 -62
  127. package/src/shared-components/foot-assets/foot-assets.html +0 -107
  128. package/src/shared-components/form-tcpa/form-tcpa.html +0 -12
  129. package/src/shared-components/gtm-body/gtm-body.html +0 -4
  130. package/src/shared-components/head/head.html +0 -192
  131. package/src/shared-components/header/_header.scss +0 -200
  132. package/src/shared-components/header/header.html +0 -71
  133. package/src/shared-components/hero/_hero.scss +0 -253
  134. package/src/shared-components/hero/hero.html +0 -126
  135. package/src/shared-components/how-it-works/_how-it-works.scss +0 -138
  136. package/src/shared-components/how-it-works/how-it-works.html +0 -19
  137. package/src/shared-components/input/_input.scss +0 -229
  138. package/src/shared-components/input/input.html +0 -30
  139. package/src/shared-components/preloader/_preloader.scss +0 -61
  140. package/src/shared-components/preloader/preloader.html +0 -49
  141. package/src/shared-components/progress-bar/_progress-bar.scss +0 -105
  142. package/src/shared-components/progress-bar/progress-bar.html +0 -20
  143. package/src/shared-components/progress-bar/progress-bar.js +0 -25
  144. package/src/shared-components/progress-bar/progress-bar.min.js +0 -2
  145. package/src/shared-components/progress-bar/progress-bar.min.js.map +0 -1
  146. package/src/shared-components/radio-button/_radio-button.scss +0 -554
  147. package/src/shared-components/radio-button/radio-button.html +0 -25
  148. package/src/shared-components/reviews/_reviews.scss +0 -79
  149. package/src/shared-components/reviews/reviews.html +0 -27
  150. package/src/shared-components/select/_select.scss +0 -61
  151. package/src/shared-components/select/select.html +0 -8
  152. package/src/shared-components/steps/_steps.scss +0 -334
  153. package/src/shared-components/steps/defaultFormFieldConfig.json +0 -64
  154. package/src/shared-components/steps/step-fields.html +0 -36
  155. package/src/shared-components/steps/steps.html +0 -131
  156. package/src/shared-components/textarea/_textarea.scss +0 -96
  157. package/src/shared-components/textarea/textarea.html +0 -13
  158. package/src/shared-components/theme-toggle/_theme-toggle.scss +0 -68
  159. package/src/shared-components/theme-toggle/theme-toggle.html +0 -34
  160. package/src/shared-components/tile/_tile.scss +0 -117
  161. package/src/shared-components/tile/tile.html +0 -27
  162. package/src/shared-components/value-props/_value-props.scss +0 -98
  163. package/src/shared-components/value-props/value-props.html +0 -17
  164. package/src/shared-components/zip-control/_zip-control.scss +0 -42
  165. package/src/shared-components/zip-control/zip-control.html +0 -21
  166. package/src/styles/partials/+.css +0 -9
  167. package/src/temp/scripts/maxmind-geoip2.js +0 -104
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mod-build",
3
- "version": "4.0.0-beta.3b",
3
+ "version": "4.0.0-beta.4",
4
4
  "description": "Share components for S3 sites.",
5
5
  "type": "module",
6
6
  "scripts": {
@@ -14,6 +14,7 @@
14
14
  "axios": "^1.6.2",
15
15
  "del": "^7.1.0",
16
16
  "eslint": "^8.55.0",
17
+ "glob": "^10.3.10",
17
18
  "gulp": "^4.0.2",
18
19
  "gulp-handlebars-file-include": "^1.0.0",
19
20
  "gulp-hash": "^4.2.2",
@@ -173,30 +173,31 @@ export const handlebarsHelpers = [
173
173
 
174
174
  export const updateConfig = async (config) => {
175
175
  const { isLocal, nodeEnv, buildPath } = defaultSettings;
176
- const tempConfigExists = fs.existsSync(`src/.tmp/config.json`);
177
- const localTCPAExists = fs.existsSync('src/resources/data/tcpa.json', 'utf8');
178
- let parsedTCPA = {};
179
-
180
- if (localTCPAExists) {
181
- parsedTCPA = JSON.parse(fs.readFileSync('src/resources/data/tcpa.json', 'utf8'));
182
- }
176
+ let tempConfigExists;
183
177
 
184
178
  let mergedConfig = {
185
179
  ...config,
186
180
  ...footer(config),
187
- ...{ isLocal, nodeEnv, buildPath },
188
- ...parsedTCPA
181
+ ...{ isLocal, nodeEnv, buildPath }
189
182
  };
190
183
 
191
- if (tempConfigExists) {
192
- const configData = fs.readFileSync('src/.tmp/config.json', 'utf8');
193
- const parsedConfig = JSON.parse(configData);
194
- mergedConfig = merge(parsedConfig, mergedConfig);
195
- }
184
+ const checkForTempConfig = () => {
185
+ return new Promise((resolve) => {
186
+ tempConfigExists = fs.existsSync(`src/.tmp/config.json`);
187
+
188
+ const configData = fs.readFileSync('src/.tmp/config.json', 'utf8');
189
+ const parsedConfig = JSON.parse(configData);
190
+ mergedConfig = merge(parsedConfig, mergedConfig);
191
+
192
+ resolve();
193
+ });
194
+ };
196
195
 
197
196
  return {
198
197
  name: 'update-config',
199
- configResolved({ configFileDependencies }) {
198
+ async configResolved({ configFileDependencies }) {
199
+ await checkForTempConfig();
200
+
200
201
  configFileDependencies.forEach((file) => {
201
202
  if (file.endsWith('siteconfig.js') || file.endsWith('template.js')) {
202
203
  console.log('siteconfig or template changed');
@@ -1,5 +1 @@
1
- // an example SCSS file to import
2
- body {
3
- background-color: red;
4
- color: #fff;
5
- }
1
+ // an example SCSS file to import
package/tasks/grab-cdn.js CHANGED
@@ -29,15 +29,15 @@ function streamToDestination(inputPath, destPath, fileName) {
29
29
  const url = `https://${defaultSettings.nodeEnv}${inputPath}`;
30
30
 
31
31
  return new Promise(resolve => {
32
- if (!fs.existsSync(`src/${destPath}`)) {
33
- fs.mkdirSync(`src/${destPath}`, { recursive: true });
32
+ if (!fs.existsSync(`src${destPath}`)) {
33
+ fs.mkdirSync(`src${destPath}`, { recursive: true });
34
34
  }
35
35
 
36
36
  // if file exists, do not create it again
37
- if (fs.existsSync(`src/${destPath}${fileName}`)) {
37
+ if (fs.existsSync(`src${destPath}${fileName}`)) {
38
38
  resolve();
39
39
  } else {
40
- const writer = createWriteStream(`src/${destPath}${fileName}`);
40
+ const writer = createWriteStream(`src${destPath}${fileName}`);
41
41
  const options = {
42
42
  url,
43
43
  method: 'get',
@@ -49,7 +49,7 @@ function streamToDestination(inputPath, destPath, fileName) {
49
49
  throw new Error(`${resp.status}: Error while fetching ${url}`);
50
50
  }
51
51
  resp.data.pipe(writer);
52
- console.log(`src/${destPath}${fileName} created...`);
52
+ console.log(`src${destPath}${fileName} created...`);
53
53
  return finished(writer);
54
54
  }).then(() => {
55
55
  resolve();
@@ -20,38 +20,39 @@ let fileNames = {
20
20
  homeownerFormFileName: ''
21
21
  };
22
22
 
23
- let isQuotePageOrUseRelativePath = false;
24
23
  let pathSubdirectory = '';
25
24
  let componentFolderPath = '';
26
25
 
27
26
  function replaceModalyticsSrc(gulp, defaultSettings) {
28
- const resourcePath = isQuotePageOrUseRelativePath ? `${pathSubdirectory}{{#if this.src}}{{this.src}}{{/if}}resources/scripts/mod-alytics/` : '/resources/scripts/mod-alytics/';
27
+ const resourcePath = '/resources/scripts/mod-alytics/';
29
28
  return gulp.src(`${defaultSettings.srcFolder}/${componentFolderPath}/head/head.html`)
30
29
  .pipe(replace(/".*(modalytics).*"/, `"${resourcePath}${fileNames.modAlyticsFileName}"`))
31
30
  .pipe(gulp.dest(`${defaultSettings.srcFolder}/${componentFolderPath}/head`));
32
31
  }
33
32
 
34
33
  function replaceFootAssetScripts(gulp, defaultSettings) {
35
- const resourcePath = isQuotePageOrUseRelativePath ? `${pathSubdirectory}{{#if this.nodeModulesPath}}{{this.nodeModulesPath}}{{/if}}resources/scripts` : '/resources/scripts';
34
+ const resourcePath = '/resources/scripts';
36
35
  return gulp.src(`${defaultSettings.srcFolder}/${componentFolderPath}/foot-assets/foot-assets.html`)
37
- .pipe(replace(/"(?:(?!"|js")[\s\S])+(modutils|mod-utils.*?)js"|"(?:(?!"|")[\s\S])+(footer\/footer-component.*?)js"|"(?:(?!"|")[\s\S])+(mod-form\/form.*?)js"/g, function(match) {
38
- if (match.includes('mod-form/form')) {
39
- return `"${resourcePath}/mod-form/form/${fileNames.homeownerFormFileName}"`;
40
- } else if (match.includes('modutils') || match.includes('mod-utils')) {
41
- return `"${resourcePath}/mod-utils/${fileNames.modUtilsFileName}"`;
42
- } else if (match.includes('footer-component')) {
43
- return `"${resourcePath}/footer/${fileNames.footerComponentJsFileName}"`;
44
- }
45
- }))
46
- .pipe(gulp.dest(`${defaultSettings.srcFolder}/${componentFolderPath}/foot-assets`))
47
- .on('end', function() {
48
- console.log('>> FINISHED replacing foot asset scripts');
49
- });
36
+ .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) {
37
+ if (match.includes('mod-form/form')) {
38
+ return `"${resourcePath}/mod-form/form/${fileNames.homeownerFormFileName}"`;
39
+ } else if (match.includes('callrail')) {
40
+ return `"${resourcePath}/callrail/${fileNames.callrailFileName}"`;
41
+ } else if (match.includes('modutils') || match.includes('mod-utils')) {
42
+ return `"${resourcePath}/mod-utils/${fileNames.modUtilsFileName}"`;
43
+ } else if (match.includes('footer-component')) {
44
+ return `"${resourcePath}/footer/${fileNames.footerComponentJsFileName}"`;
45
+ }
46
+ }))
47
+ .pipe(gulp.dest(`${defaultSettings.srcFolder}/${componentFolderPath}/foot-assets`))
48
+ .on('end', function() {
49
+ console.log('>> FINISHED replacing foot asset scripts');
50
+ });
50
51
  }
51
52
 
52
53
  function replaceAbandonmentJsCssSrc(gulp, defaultSettings) {
53
- const jsResourcePath = isQuotePageOrUseRelativePath ? `${pathSubdirectory}resources/scripts/abandonment/` : '/resources/scripts/abandonment/';
54
- const cssResourcePath = isQuotePageOrUseRelativePath ? `${pathSubdirectory}resources/styles/components/abandonment/` : '/resources/styles/components/abandonment/';
54
+ const jsResourcePath = '/resources/scripts/abandonment/';
55
+ const cssResourcePath = '/resources/styles/components/abandonment/';
55
56
  return gulp.src(defaultSettings.srcFolder + '/templates/abandonment/*.html')
56
57
  .pipe(replace(/"(?:(?!"|")[\s\S])+(abandonment\/abandonment.*?)js"/, `"${jsResourcePath}${fileNames.abandonmentJsFileName}"`))
57
58
  .pipe(replace(/"(?:(?!"|")[\s\S])+(components\/abandonment\/abandonment.*?)css"/, `"${cssResourcePath}${fileNames.abandonmentStylesFileName}"`))
@@ -72,100 +73,78 @@ function replaceFooterStylesReference(gulp, defaultSettings, siteData) {
72
73
  }
73
74
  }
74
75
 
75
- function replaceFooterStylesReferenceInMap(gulp, defaultSettings, siteData) {
76
- if (siteData.siteData && siteData.siteData.useRelativePathForResources === true) {
77
- return gulp.src(defaultSettings.srcFolder + '/resources/scripts/footer/footer-component.min.js.map')
78
- .pipe(replace(/`(?:(?!`|`)[\s\S])+(components\/footer\/mod.*?)`/, '`' + pathSubdirectory + 'resources/styles/components/footer/' + fileNames.modFooterStylesFileName + '`'))
79
- .pipe(replace(/`(?:(?!`|`)[\s\S])+(components\/footer\/mod.*?)`/, '`' + pathSubdirectory + 'resources/styles/components/footer/' + fileNames.qsFooterStylesFileName + '`'))
80
- .pipe(gulp.dest(defaultSettings.srcFolder + '/resources/scripts/footer'));
81
- } else if (!siteData.siteData || siteData.siteData && !siteData.siteData.isQuotePage) {
82
- return gulp.src(defaultSettings.srcFolder + '/resources/scripts/footer/footer-component.min.js.map')
83
- .pipe(replace(/`(?:(?!`|`)[\s\S])+(components\/footer\/mod.*?)`/, '`/resources/styles/components/footer/' + fileNames.modFooterStylesFileName + '`'))
84
- .pipe(replace(/`(?:(?!`|`)[\s\S])+(components\/footer\/mod.*?)`/, '`/resources/styles/components/footer/' + fileNames.qsFooterStylesFileName + '`'))
85
- .pipe(gulp.dest(defaultSettings.srcFolder + '/resources/scripts/footer'));
86
- }
87
- }
88
-
89
76
  const TASKS = {
90
77
  copyModutils: {
78
+ url: 'shared-resources/scripts/callrail/callrail.min.js',
79
+ config: {
80
+ fileName: 'callrailFileName',
81
+ dest: 'scripts/callrail',
82
+ },
83
+ srcReplaceFn: null,
84
+ },
85
+ copyCallrail: {
91
86
  url: 'mod-utils/modutils.min.js',
92
87
  config: {
93
88
  fileName: 'modUtilsFileName',
94
89
  dest: 'scripts/mod-utils',
95
- mapUrl: 'mod-utils/modutils.min.js.map'
96
90
  },
97
91
  srcReplaceFn: null,
98
- additionalSrcReplaceFns: []
99
92
  },
100
93
  copyFooterComponentJs: {
101
94
  url: 'shared-resources/scripts/footer/footer-component.min.js',
102
95
  config: {
103
96
  fileName: 'footerComponentJsFileName',
104
97
  dest: 'scripts/footer',
105
- mapUrl: 'shared-resources/scripts/footer/footer-component.min.js.map'
106
98
  },
107
99
  srcReplaceFn: null,
108
- additionalSrcReplaceFns: []
109
100
  },
110
101
  copyHomeownerForm: {
111
102
  url: 'mod-form/form/homeowner.min.js',
112
103
  config: {
113
104
  fileName: 'homeownerFormFileName',
114
105
  dest: 'scripts/mod-form/form',
115
- mapUrl: 'mod-form/form/homeowner.min.js.map'
116
106
  },
117
107
  srcReplaceFn: replaceFootAssetScripts,
118
- additionalSrcReplaceFns: []
119
108
  },
120
109
  copyModalytics: {
121
110
  url: 'mod-alytics/modalytics.min.js',
122
111
  config: {
123
112
  fileName: 'modAlyticsFileName',
124
113
  dest: 'scripts/mod-alytics',
125
- mapUrl: 'mod-alytics/modalytics.min.js.map'
126
114
  },
127
115
  srcReplaceFn: replaceModalyticsSrc,
128
- additionalSrcReplaceFns: []
129
116
  },
130
117
  copyAbandonmentComponentStyles: {
131
118
  url: 'shared-resources/styles/components/abandonment/abandonment.min.css',
132
119
  config: {
133
120
  fileName: 'abandonmentStylesFileName',
134
121
  dest: 'styles/components/abandonment',
135
- mapUrl: null
136
122
  },
137
123
  srcReplaceFn: null,
138
- additionalSrcReplaceFns: []
139
124
  },
140
125
  copyAbandonmentJs: {
141
126
  url: 'shared-resources/scripts/abandonment/abandonment.min.js',
142
127
  config: {
143
128
  fileName: 'abandonmentJsFileName',
144
129
  dest: 'scripts/abandonment',
145
- mapUrl: 'shared-resources/scripts/abandonment/abandonment.min.js.map'
146
130
  },
147
131
  srcReplaceFn: replaceAbandonmentJsCssSrc,
148
- additionalSrcReplaceFns: []
149
132
  },
150
133
  copyModFooterComponentStyles: {
151
134
  url: 'shared-resources/styles/components/footer/mod-footer.min.css',
152
135
  config: {
153
136
  fileName: 'modFooterStylesFileName',
154
137
  dest: 'styles/components/footer',
155
- mapUrl: null
156
138
  },
157
139
  srcReplaceFn: null,
158
- additionalSrcReplaceFns: []
159
140
  },
160
141
  copyQsFooterComponentStyles: {
161
142
  url: 'shared-resources/styles/components/footer/qs-footer.min.css',
162
143
  config: {
163
144
  fileName: 'qsFooterStylesFileName',
164
145
  dest: 'styles/components/footer',
165
- mapUrl: null
166
146
  },
167
- srcReplaceFn: null,
168
- additionalSrcReplaceFns: [replaceFooterStylesReference, replaceFooterStylesReferenceInMap]
147
+ srcReplaceFn: replaceFooterStylesReference,
169
148
  }
170
149
  };
171
150
 
@@ -177,7 +156,7 @@ function getResource(task, fileNames, resourcePath = 'quote/resources') {
177
156
  }
178
157
 
179
158
  const finished = promisify(stream.finished);
180
-
159
+
181
160
  return new Promise(resolve => {
182
161
  const file = getFileFromURL(url);
183
162
 
@@ -186,7 +165,7 @@ function getResource(task, fileNames, resourcePath = 'quote/resources') {
186
165
  }
187
166
 
188
167
  // if file exists, do not create it again
189
- if (fs.existsSync(`${task.config.defaultSettings.srcFolder}/resources/${config.dest}/${file}`)) {
168
+ if (fs.existsSync(`${task.config.defaultSettings.srcFolder}/resources/${config.dest}/${file}`)) {
190
169
  resolve();
191
170
  } else {
192
171
  const options = {
@@ -198,41 +177,51 @@ function getResource(task, fileNames, resourcePath = 'quote/resources') {
198
177
  if (resp.status !== 200) {
199
178
  throw new Error(`${resp.status}: Error while fetching ${url}`);
200
179
  }
201
-
180
+
202
181
  const writer = createWriteStream(`${task.config.defaultSettings.srcFolder}/resources/${config.dest}/${file}`);
203
182
  resp.data.pipe(writer);
204
183
  console.log(`${task.config.defaultSettings.srcFolder}/resources/${config.dest}/${file} created...`);
205
184
  return finished(writer);
206
185
  })
207
186
  .then(() => {
208
- gulp.src(`${task.config.defaultSettings.srcFolder}/resources/${config.dest}/${file}`)
209
- .pipe(hash({
210
- hashLength: 20,
211
- algorithm: 'md5',
212
- template: file.replace(/^([^.]*)\.(.*)$/, '$1-<%= hash %>.$2')
213
- }))
214
- .pipe(tap(function(file) {
215
- file = JSON.stringify(file);
216
- file = JSON.parse(file).history[1];
217
- fileNames[task.config.fileName] = file.split('/').pop();
218
- }))
219
- .pipe(gulp.dest(`${task.config.defaultSettings.srcFolder}/resources/${config.dest}`));
220
- resolve();
187
+ return new Promise((resolve) => {
188
+ gulp.src(`${task.config.defaultSettings.srcFolder}/resources/${config.dest}/${file}`)
189
+ .pipe(hash({
190
+ hashLength: 20,
191
+ algorithm: 'md5',
192
+ template: file.replace(/^([^.]*)\.(.*)$/, '$1-<%= hash %>.$2')
193
+ }))
194
+ .pipe(tap(function(file) {
195
+ file = JSON.stringify(file);
196
+ file = JSON.parse(file).history[1];
197
+ file = file.split('/').pop();
198
+ fileNames[task.config.fileName] = file;
199
+
200
+ console.log(file);
201
+ }))
202
+ .pipe(gulp.dest(`${task.config.defaultSettings.srcFolder}/resources/${config.dest}`))
203
+ .on('finish', function(){
204
+ console.log('DONE HASHING');
205
+ resolve();
206
+ })
207
+ });
221
208
  })
222
209
  .then(() => {
223
- if (!config.mapUrl) {
210
+ if (!srcReplaceFn) {
224
211
  return false;
225
212
  }
226
- // do we really need to separately get sourcemaps??
227
- resolve();
213
+
214
+ if (typeof srcReplaceFn === 'function') {
215
+ srcReplaceFn(gulp, task.config.defaultSettings, task.config.config);
216
+ }
217
+ return true
228
218
  })
229
219
  .then(() => {
230
- if (!srcReplaceFn) {
231
- return false;
232
- }
233
- // we should update the mod/qs footer components to inject their own CSS instead of hardcoding the file path & then renaming it here!
234
220
  resolve();
235
221
  })
222
+ .catch((error) => {
223
+ console.error('Error:', error);
224
+ });
236
225
  }
237
226
  })
238
227
  }
@@ -252,7 +241,6 @@ export default async function(config) {
252
241
  const getAllResources = tasks.map(async function(task) {
253
242
  if (useAccessibleComponents && task.url.includes('abandonment.min.js')) {
254
243
  task.url = 'shared-resources/scripts/abandonment/accessible/abandonment.min.js';
255
- task.config.mapUrl = 'shared-resources/scripts/abandonment/accessible/abandonment.min.js.map';
256
244
  }
257
245
  Object.assign(task.config, { defaultSettings, config });
258
246
  await getResource(task, fileNames);
@@ -260,4 +248,4 @@ export default async function(config) {
260
248
 
261
249
  await Promise.all(getAllResources);
262
250
  }
263
- }
251
+ }
package/tasks/serve.js CHANGED
@@ -9,9 +9,10 @@ export async function startModBuild(config) {
9
9
  await grabCdn(config);
10
10
  await Promise.all([
11
11
  grabSharedComponents(config),
12
- grabSharedScripts(config),
13
12
  grabFormHelpers(config),
14
13
  templates(config)
15
- ]);
14
+ ]).then(async () => {
15
+ await grabSharedScripts(config);
16
+ });
16
17
  await updateConfig(config);
17
- }
18
+ }
@@ -104,17 +104,9 @@ const fetchTcpaFromSitegenie = async (config, tempConfig) => {
104
104
  console.log('Response error...using default TCPA language');
105
105
  }
106
106
 
107
- reject(error);
108
- });
109
- }).then(async (finalTCPA) => {
110
- if (!finalTCPA) {
111
- return Promise.resolve();
112
- }
113
-
114
- // write the TCPA to src/resources/data/tcpa.json
115
- await new Promise((resolve) => {
116
- fs.writeFileSync('src/resources/data/tcpa.json', JSON.stringify({ tcpaText: `${finalTCPA}` }, null, 2));
117
- resolve();
107
+ defaultTcpa = JSON.parse(fs.readFileSync('src/resources/data/tcpa.json', 'utf8'));
108
+ tempConfig.tcpaText = defaultTcpa.tcpaText;
109
+ resolve(error);
118
110
  });
119
111
  });
120
112
  };
package/vite.config.js CHANGED
@@ -56,7 +56,7 @@ export default defineConfig((config) => ({
56
56
  ...eslint(),
57
57
  apply: 'build',
58
58
  },
59
- {
59
+ {
60
60
  ...eslint({
61
61
  failOnWarning: false,
62
62
  failOnError: false,
@@ -67,7 +67,14 @@ export default defineConfig((config) => ({
67
67
  {
68
68
  name: 'replace-src-paths',
69
69
  transformIndexHtml: (html) => {
70
- return html.replace(/(src|data-load)="\/?src\//g, '$1="/');
70
+ if (config.pathSubdirectory && config.pathSubdirectory.length > 0) {
71
+ return html
72
+ .replace(/(src|data-load)="\/?src\//g, `$1="${config.pathSubdirectory}`)
73
+ .replace(/(src|data-load|href)="\/?assets\//g, `$1="${config.pathSubdirectory}assets/`)
74
+ .replace(/(src|data-load|href)="\/?resources\//g, `$1="${config.pathSubdirectory}resources/`)
75
+ } else {
76
+ return html.replace(/(src|data-load)="\/?src\//g, '$1="/');
77
+ }
71
78
  },
72
79
  apply: 'build',
73
80
  }