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