mod-build 3.6.61-beta.8 → 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 +2 -1
- package/gulp-tasks/grab-shared-components.js +15 -19
- package/gulp-tasks/templates.js +26 -29
- package/package.json +1 -1
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
|
};
|
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
|
};
|