mod-build 3.6.61 → 3.6.62
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +4 -0
- package/gulp-tasks/grab-shared-components.js +19 -15
- package/gulp-tasks/grab-shared-scripts.js +16 -5
- package/gulp-tasks/templates.js +19 -11
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 3.6.62
|
|
4
|
+
|
|
5
|
+
- Adding the accessible components to the `grab-shared-components` task; As well as pulling the accessible `defaultFormFieldConfig` for the new template.js configuration (& merging to the new template stucture appropriately); As well as updating the `grab-shared-scripts` to pull in / edit the necessary accessible components (including the accessible abandonment JS file);
|
|
6
|
+
|
|
3
7
|
## 3.6.61
|
|
4
8
|
|
|
5
9
|
- added functionality to increase the fileInclude maxRecursion value from site level
|
|
@@ -1,31 +1,33 @@
|
|
|
1
1
|
var request = require('request');
|
|
2
2
|
var source = require('vinyl-source-stream');
|
|
3
3
|
|
|
4
|
-
function streamSharedCompsToDestination(gulp, siteSettings, fileName) {
|
|
5
|
-
return new Promise(resolve => {
|
|
6
|
-
request(`https://${siteSettings.nodeEnv}/quote/resources/mod-site
|
|
4
|
+
function streamSharedCompsToDestination(gulp, siteSettings, folder, fileName) {
|
|
5
|
+
return new Promise(resolve => {
|
|
6
|
+
request(`https://${siteSettings.nodeEnv}/quote/resources/mod-site/${folder}/${fileName}`)
|
|
7
7
|
.on('response', resp => {
|
|
8
8
|
if (resp.statusCode !== 200) {
|
|
9
9
|
throw new Error(`${resp.statusCode} Error while fetching ${fileName}`);
|
|
10
10
|
}
|
|
11
11
|
})
|
|
12
12
|
.pipe(source(fileName))
|
|
13
|
-
.pipe(gulp.dest(`${siteSettings.srcFolder}
|
|
13
|
+
.pipe(gulp.dest(`${siteSettings.srcFolder}/${folder}/`))
|
|
14
14
|
.on('finish', resolve);
|
|
15
15
|
});
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
-
function getListOfSharedComponents(gulp, gulpPlugins, siteSettings) {
|
|
19
|
-
return
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
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));
|
|
27
30
|
});
|
|
28
|
-
resolve(Promise.all(componentPromises)); // eslint-disable-line no-undef
|
|
29
31
|
});
|
|
30
32
|
});
|
|
31
33
|
}
|
|
@@ -37,6 +39,8 @@ module.exports = function(gulp, gulpPlugins, siteSettings) {
|
|
|
37
39
|
throw new Error('Missing environment variables. Did you start with gulp instead of npm run...?');
|
|
38
40
|
}
|
|
39
41
|
|
|
40
|
-
|
|
42
|
+
const componentFolders = ['shared-components', 'accessible-components']
|
|
43
|
+
|
|
44
|
+
return getListOfSharedComponents(gulp, gulpPlugins, siteSettings, componentFolders);
|
|
41
45
|
};
|
|
42
46
|
};
|
|
@@ -18,18 +18,19 @@ const fileNames = {
|
|
|
18
18
|
var isQuotePageOrUseRelativePath = false;
|
|
19
19
|
var resourceURL = '';
|
|
20
20
|
var pathSubdirectory = '';
|
|
21
|
+
var componentFolderPath = '';
|
|
21
22
|
|
|
22
23
|
function replaceModalyticsSrc(gulp, gulpPlugins, siteSettings, siteData) {
|
|
23
24
|
const resourcePath = isQuotePageOrUseRelativePath ? `${pathSubdirectory}{{#if this.src}}{{this.src}}{{/if}}resources/scripts/mod-alytics/` : '/resources/scripts/mod-alytics/';
|
|
24
25
|
console.log(`>> VARIABLE modAlyticsFileName = ${fileNames.modAlyticsFileName}`)
|
|
25
|
-
return gulp.src(siteSettings.srcFolder
|
|
26
|
+
return gulp.src(`${siteSettings.srcFolder}/${componentFolderPath}/head/head.html`)
|
|
26
27
|
.pipe(replace(/".*(modalytics).*"/, `"${resourcePath}${fileNames.modAlyticsFileName}"`))
|
|
27
|
-
.pipe(gulp.dest(siteSettings.srcFolder
|
|
28
|
+
.pipe(gulp.dest(`${siteSettings.srcFolder}/${componentFolderPath}/head`));
|
|
28
29
|
}
|
|
29
30
|
function replaceFootAssetScripts(gulp, gulpPlugins, siteSettings, siteData) {
|
|
30
31
|
console.log('>> STARTING replacing foot asset scripts');
|
|
31
32
|
const resourcePath = isQuotePageOrUseRelativePath ? `${pathSubdirectory}{{#if this.nodeModulesPath}}{{this.nodeModulesPath}}{{/if}}resources/scripts` : '/resources/scripts';
|
|
32
|
-
return gulp.src(siteSettings.srcFolder
|
|
33
|
+
return gulp.src(`${siteSettings.srcFolder}/${componentFolderPath}/foot-assets/foot-assets.html`)
|
|
33
34
|
.pipe(replace(/"(?:(?!"|js")[\s\S])+(modutils|mod-utils.*?)js"|"(?:(?!"|")[\s\S])+(footer\/footer-component.*?)js"|"(?:(?!"|")[\s\S])+(mod-form\/form.*?)js"/g, function(match) {
|
|
34
35
|
if (match.includes('mod-form/form')) {
|
|
35
36
|
console.log(`>> VARIABLE homeownerFormFileName = ${fileNames.homeownerFormFileName}`);
|
|
@@ -42,7 +43,7 @@ function replaceFootAssetScripts(gulp, gulpPlugins, siteSettings, siteData) {
|
|
|
42
43
|
return `"${resourcePath}/footer/${fileNames.footerComponentJsFileName}"`;
|
|
43
44
|
}
|
|
44
45
|
}))
|
|
45
|
-
.pipe(gulp.dest(siteSettings.srcFolder
|
|
46
|
+
.pipe(gulp.dest(`${siteSettings.srcFolder}/${componentFolderPath}/foot-assets`))
|
|
46
47
|
.on('end', function() {
|
|
47
48
|
console.log('>> FINISHED replacing foot asset scripts');
|
|
48
49
|
});
|
|
@@ -234,11 +235,14 @@ const TASKS = {
|
|
|
234
235
|
module.exports = function(gulp, gulpPlugins, siteSettings, siteData) {
|
|
235
236
|
const { isLocal } = siteSettings
|
|
236
237
|
const isQuotePage = siteData.siteData && siteData.siteData.isQuotePage || siteData && siteData.isQuotePage;
|
|
238
|
+
const useAccessibleComponents = siteData.siteData && siteData.siteData.useAccessibleConfig || siteData && siteData.useAccessibleConfig;
|
|
237
239
|
const useRelativePathForResources = siteData.siteData && siteData.siteData.useRelativePathForResources || siteData && siteData.useRelativePathForResources;
|
|
240
|
+
componentFolderPath = useAccessibleComponents === true ? 'accessible-components' : 'shared-components';
|
|
238
241
|
isQuotePageOrUseRelativePath = isQuotePage === true || useRelativePathForResources === true;
|
|
239
242
|
resourceURL = `https://${siteSettings.nodeEnv}/quote/resources`;
|
|
240
243
|
const isPathSubdirectory = siteData.siteData && siteData.siteData.pathSubdirectory || siteData && siteData.pathSubdirectory;
|
|
241
244
|
pathSubdirectory = !isLocal && isPathSubdirectory ? isPathSubdirectory : '';
|
|
245
|
+
|
|
242
246
|
return function() {
|
|
243
247
|
const { nodeEnv } = siteSettings;
|
|
244
248
|
if (!nodeEnv) {
|
|
@@ -246,8 +250,15 @@ module.exports = function(gulp, gulpPlugins, siteSettings, siteData) {
|
|
|
246
250
|
}
|
|
247
251
|
return (function() {
|
|
248
252
|
const tasks = Object.values(TASKS)
|
|
253
|
+
|
|
249
254
|
if (tasks.length) {
|
|
250
255
|
var getAllResources = tasks.map(function(task) {
|
|
256
|
+
if (useAccessibleComponents === true) {
|
|
257
|
+
if (task.url.includes('abandonment.min.js')) {
|
|
258
|
+
task.url = 'shared-resources/scripts/abandonment/accessible/abandonment.min.js';
|
|
259
|
+
task.config.mapUrl = 'shared-resources/scripts/abandonment/accessible/abandonment.min.js.map';
|
|
260
|
+
}
|
|
261
|
+
}
|
|
251
262
|
Object.assign(task.config, { gulp, gulpPlugins, siteSettings, siteData });
|
|
252
263
|
return getResource(task.url, task.config, task.srcReplaceFn, task.additionalSrcReplaceFns)
|
|
253
264
|
});
|
|
@@ -256,7 +267,7 @@ module.exports = function(gulp, gulpPlugins, siteSettings, siteData) {
|
|
|
256
267
|
return Promise.all(getAllResources)
|
|
257
268
|
.then(() => {
|
|
258
269
|
console.log(`>> FILENAMES object = ${JSON.stringify(fileNames)}`);
|
|
259
|
-
return gulp.src(siteSettings.srcFolder
|
|
270
|
+
return gulp.src(`${siteSettings.srcFolder}/${componentFolderPath}/foot-assets/foot-assets.html`)
|
|
260
271
|
.on('data', function (file) {
|
|
261
272
|
console.log(`>> FOOT ASSETS HTML = ${file.contents.toString()}`);
|
|
262
273
|
});
|
package/gulp-tasks/templates.js
CHANGED
|
@@ -167,7 +167,7 @@ module.exports = function(gulp, gulpPlugins, siteSettings, siteData) {
|
|
|
167
167
|
}
|
|
168
168
|
];
|
|
169
169
|
|
|
170
|
-
var mergeDefaultFormFieldConfig = function(steps, defaultConfig) {
|
|
170
|
+
var mergeDefaultFormFieldConfig = function(steps, defaultConfig, folder) {
|
|
171
171
|
if (!steps.items) {
|
|
172
172
|
console.error('No items[ ] found in steps{}!');
|
|
173
173
|
return steps;
|
|
@@ -175,9 +175,12 @@ module.exports = function(gulp, gulpPlugins, siteSettings, siteData) {
|
|
|
175
175
|
steps.items.forEach(item => {
|
|
176
176
|
if (item.fields) {
|
|
177
177
|
item.fields = item.fields.map(field => {
|
|
178
|
-
if (field.name && defaultConfig[field.name]) {
|
|
178
|
+
if (folder === 'shared-components' && field.name && defaultConfig[field.name]) {
|
|
179
179
|
field = Object.assign(defaultConfig[field.name], field);
|
|
180
180
|
}
|
|
181
|
+
if (folder === 'accessible-components' && field.attributes && field.attributes.name && defaultConfig[field.attributes.name]) {
|
|
182
|
+
field = merge(defaultConfig[field.attributes.name], field);
|
|
183
|
+
}
|
|
181
184
|
return field;
|
|
182
185
|
});
|
|
183
186
|
}
|
|
@@ -186,25 +189,25 @@ module.exports = function(gulp, gulpPlugins, siteSettings, siteData) {
|
|
|
186
189
|
return steps;
|
|
187
190
|
};
|
|
188
191
|
|
|
189
|
-
var getDefaultFormFieldConfig = async function() {
|
|
192
|
+
var getDefaultFormFieldConfig = async function(folder) {
|
|
190
193
|
console.time('Finished fetch-default-form-config after');
|
|
191
194
|
console.log('Starting fetch-default-form-config: ');
|
|
192
195
|
await new Promise((resolve) => {
|
|
193
|
-
request(`https://${siteSettings.nodeEnv}/quote/resources/mod-site/
|
|
196
|
+
request(`https://${siteSettings.nodeEnv}/quote/resources/mod-site/${folder}/steps/defaultFormFieldConfig.json`, async function(err, xhr, response) {
|
|
194
197
|
if (xhr.statusCode !== 200) {
|
|
195
|
-
throw new Error(`${xhr.statusCode}: Error while fetching
|
|
198
|
+
throw new Error(`${xhr.statusCode}: Error while fetching ${folder}/defaultFormFieldConfig.json`);
|
|
196
199
|
}
|
|
197
200
|
|
|
198
201
|
const defaultConfig = await JSON.parse(response);
|
|
199
202
|
|
|
200
203
|
if (templatesData.steps) {
|
|
201
|
-
templatesData.steps = await mergeDefaultFormFieldConfig(templatesData.steps, defaultConfig);
|
|
204
|
+
templatesData.steps = await mergeDefaultFormFieldConfig(templatesData.steps, defaultConfig, folder);
|
|
202
205
|
}
|
|
203
206
|
if (templatesData.qsSteps) {
|
|
204
|
-
templatesData.qsSteps = await mergeDefaultFormFieldConfig(templatesData.qsSteps, defaultConfig);
|
|
207
|
+
templatesData.qsSteps = await mergeDefaultFormFieldConfig(templatesData.qsSteps, defaultConfig, folder);
|
|
205
208
|
}
|
|
206
209
|
if (templatesData.modSteps) {
|
|
207
|
-
templatesData.modSteps = await mergeDefaultFormFieldConfig(templatesData.modSteps, defaultConfig);
|
|
210
|
+
templatesData.modSteps = await mergeDefaultFormFieldConfig(templatesData.modSteps, defaultConfig, folder);
|
|
208
211
|
}
|
|
209
212
|
|
|
210
213
|
templatesData.defaultConfigCompleted = true;
|
|
@@ -231,8 +234,9 @@ module.exports = function(gulp, gulpPlugins, siteSettings, siteData) {
|
|
|
231
234
|
throw new Error(`${xhr.statusCode}: Error while fetching TCPA`);
|
|
232
235
|
}
|
|
233
236
|
const responseJson = await JSON.parse(response);
|
|
234
|
-
|
|
235
|
-
|
|
237
|
+
let finalTCPA = await (company === 'Modernize' || templatesData.useModernizeInTCPA) ? responseJson.tcpa.replace(/QuinStreet/g, 'Modernize') : responseJson.tcpa;
|
|
238
|
+
const removeInlineStyleRegex = / style="[^"]*"/g;
|
|
239
|
+
finalTCPA = finalTCPA.replace(removeInlineStyleRegex, '');
|
|
236
240
|
templatesData.tcpaText = await finalTCPA;
|
|
237
241
|
|
|
238
242
|
resolve();
|
|
@@ -244,7 +248,11 @@ module.exports = function(gulp, gulpPlugins, siteSettings, siteData) {
|
|
|
244
248
|
return async function() {
|
|
245
249
|
if (Object.keys(siteData).length > 0) {
|
|
246
250
|
if (!templatesData.doNotUseDefaultFieldConfig && !templatesData.defaultConfigCompleted) {
|
|
247
|
-
|
|
251
|
+
if (templatesData.siteData.useAccessibleConfig) {
|
|
252
|
+
await getDefaultFormFieldConfig('accessible-components');
|
|
253
|
+
} else {
|
|
254
|
+
await getDefaultFormFieldConfig('shared-components');
|
|
255
|
+
}
|
|
248
256
|
}
|
|
249
257
|
|
|
250
258
|
if (!templatesData.tcpaText && templatesData.primary_trade) {
|