mod-build 3.6.40-beta.3 → 3.6.40-beta.5
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
|
@@ -27,7 +27,8 @@ function replaceModalyticsSrc(gulp, gulpPlugins, siteSettings, siteData) {
|
|
|
27
27
|
.pipe(gulp.dest(siteSettings.srcFolder + '/shared-components/head'));
|
|
28
28
|
}
|
|
29
29
|
function replaceFootAssetScripts(gulp, gulpPlugins, siteSettings, siteData) {
|
|
30
|
-
|
|
30
|
+
console.log('>> STARTING Replacing Foot Asset Scripts');
|
|
31
|
+
const resourcePath = isQuotePageOrUseRelativePath ? '{{#if this.nodeModulesPath}}{{this.nodeModulesPath}}{{/if}}resources/scripts' : '/resources/scripts';
|
|
31
32
|
return gulp.src(siteSettings.srcFolder + '/shared-components/foot-assets/foot-assets.html')
|
|
32
33
|
.pipe(replace(/"(?:(?!"|js")[\s\S])+(modutils|mod-utils.*?)js"|"(?:(?!"|")[\s\S])+(footer\/footer-component.*?)js"|"(?:(?!"|")[\s\S])+(mod-form\/mod-form.*?)js"|"(?:(?!"|")[\s\S])+(qs-form.*?)js"|"(?:(?!"|")[\s\S])+(mod-form\/form.*?)js"/g, function(match) {
|
|
33
34
|
if (match.includes('mod-form')) {
|
|
@@ -42,9 +43,12 @@ function replaceFootAssetScripts(gulp, gulpPlugins, siteSettings, siteData) {
|
|
|
42
43
|
return `"${resourcePath}/mod-utils/${fileNames.modUtilsFileName}"`;
|
|
43
44
|
} else if (match.includes('footer-component')) {
|
|
44
45
|
return `"${resourcePath}/footer/${fileNames.footerComponentJsFileName}"`;
|
|
45
|
-
}
|
|
46
|
+
}
|
|
46
47
|
}))
|
|
47
|
-
.pipe(gulp.dest(siteSettings.srcFolder + '/shared-components/foot-assets'))
|
|
48
|
+
.pipe(gulp.dest(siteSettings.srcFolder + '/shared-components/foot-assets'))
|
|
49
|
+
.on('end', function() {
|
|
50
|
+
console.log('>> FINISHED Replacing Foot Asset Scripts');
|
|
51
|
+
});
|
|
48
52
|
}
|
|
49
53
|
function replaceAbandonmentJsCssSrc(gulp, gulpPlugins, siteSettings, siteData) {
|
|
50
54
|
const jsResourcePath = isQuotePageOrUseRelativePath ? 'resources/scripts/abandonment/' : '/resources/scripts/abandonment/';
|
|
@@ -107,36 +111,39 @@ function getResource(url, config = {}, fn, fnArray) {
|
|
|
107
111
|
fileNames[config.fileName] = path.basename(file.path);
|
|
108
112
|
}))
|
|
109
113
|
.pipe(config.gulp.dest(`${config.siteSettings.srcFolder}/resources/${config.dest}`))
|
|
110
|
-
.on('finish',
|
|
114
|
+
.on('finish', function(){
|
|
115
|
+
console.log(fileNames[config.fileName]);
|
|
116
|
+
resolve();
|
|
117
|
+
});
|
|
111
118
|
})
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
}
|
|
119
|
+
.then(() => {
|
|
120
|
+
if (!config.mapUrl) { return false };
|
|
121
|
+
const file = getFileFromURL(config.mapUrl);
|
|
122
|
+
return new Promise((resolve) => {
|
|
123
|
+
request(`${resourceURL}/${config.mapUrl}`)
|
|
124
|
+
.on('response', (resp) => {
|
|
125
|
+
if (resp.statusCode !== 200) {
|
|
126
|
+
throw new Error(`${resp.statusCode} Error while fetching ${file}`);
|
|
127
|
+
} else {
|
|
128
|
+
if (typeof fn === 'function') {
|
|
129
|
+
fn.call(null, config.gulp, config.gulpSettings, config.siteSettings, config.siteData);
|
|
124
130
|
}
|
|
125
|
-
})
|
|
126
|
-
.pipe(source(file))
|
|
127
|
-
.pipe(config.gulp.dest(`${config.siteSettings.srcFolder}/resources/${config.dest}`))
|
|
128
|
-
.on('finish', resolve);
|
|
129
|
-
});
|
|
130
|
-
})
|
|
131
|
-
.then(() => {
|
|
132
|
-
if (fnArray && fnArray.length) {
|
|
133
|
-
fnArray.map(function(fn) {
|
|
134
|
-
if (typeof fn === 'function') {
|
|
135
|
-
fn.call(null, config.gulp, config.gulpSettings, config.siteSettings, config.siteData)
|
|
136
131
|
}
|
|
137
|
-
})
|
|
138
|
-
|
|
132
|
+
})
|
|
133
|
+
.pipe(source(file))
|
|
134
|
+
.pipe(config.gulp.dest(`${config.siteSettings.srcFolder}/resources/${config.dest}`))
|
|
135
|
+
.on('finish', resolve);
|
|
139
136
|
});
|
|
137
|
+
})
|
|
138
|
+
.then(() => {
|
|
139
|
+
if (fnArray && fnArray.length) {
|
|
140
|
+
fnArray.map(function(fn) {
|
|
141
|
+
if (typeof fn === 'function') {
|
|
142
|
+
fn.call(null, config.gulp, config.gulpSettings, config.siteSettings, config.siteData)
|
|
143
|
+
}
|
|
144
|
+
});
|
|
145
|
+
}
|
|
146
|
+
});
|
|
140
147
|
}
|
|
141
148
|
const TASKS = {
|
|
142
149
|
copyModalytics: {
|
|
@@ -206,7 +213,7 @@ const TASKS = {
|
|
|
206
213
|
dest: 'scripts/mod-form',
|
|
207
214
|
mapUrl: 'mod-form/qs-form.min.js.map',
|
|
208
215
|
},
|
|
209
|
-
srcReplaceFn:
|
|
216
|
+
srcReplaceFn: null,
|
|
210
217
|
additionalSrcReplaceFns: []
|
|
211
218
|
},
|
|
212
219
|
copyHomeownerForm: {
|
|
@@ -216,7 +223,7 @@ const TASKS = {
|
|
|
216
223
|
dest: 'scripts/mod-form/form',
|
|
217
224
|
mapUrl: 'mod-form/form/homeowner.min.js.map',
|
|
218
225
|
},
|
|
219
|
-
srcReplaceFn:
|
|
226
|
+
srcReplaceFn: replaceFootAssetScripts,
|
|
220
227
|
additionalSrcReplaceFns: []
|
|
221
228
|
},
|
|
222
229
|
copyModFooterComponentStyles: {
|
package/gulp-tasks/templates.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
var merge = require('lodash.merge');
|
|
2
|
-
var request = require('request');
|
|
3
2
|
|
|
4
3
|
module.exports = function(gulp, gulpPlugins, siteSettings, siteData) {
|
|
5
4
|
// Merge site's data with shared data
|
|
@@ -145,7 +144,7 @@ module.exports = function(gulp, gulpPlugins, siteSettings, siteData) {
|
|
|
145
144
|
fn: function(obj) {
|
|
146
145
|
var output = '';
|
|
147
146
|
var ignoreKeys = Array.prototype.slice.call(arguments, 1, -1);
|
|
148
|
-
|
|
147
|
+
|
|
149
148
|
for (var key in obj.attributes) {
|
|
150
149
|
if (ignoreKeys.indexOf(key) === -1) {
|
|
151
150
|
if (typeof obj.attributes[key] !== 'object') {
|
|
@@ -166,36 +165,7 @@ module.exports = function(gulp, gulpPlugins, siteSettings, siteData) {
|
|
|
166
165
|
}
|
|
167
166
|
];
|
|
168
167
|
|
|
169
|
-
|
|
170
|
-
const siteData = templatesData;
|
|
171
|
-
await new Promise((resolve) => {
|
|
172
|
-
request(`https://${siteSettings.nodeEnv}/quote/resources/mod-site/shared-components/steps/defaultFormFieldConfig.json`, async function(err, xhr, response) {
|
|
173
|
-
if (xhr.statusCode !== 200) {
|
|
174
|
-
throw new Error(`${xhr.statusCode}: Error while fetching shared-components/defaultFormFieldConfig.json`);
|
|
175
|
-
}
|
|
176
|
-
if (!siteData.steps) {
|
|
177
|
-
throw new Error('steps not found!');
|
|
178
|
-
}
|
|
179
|
-
response = await JSON.parse(response);
|
|
180
|
-
siteData.steps.items.forEach(item => {
|
|
181
|
-
item.fields = item.fields.map(field => {
|
|
182
|
-
if (field.name && response[field.name]) {
|
|
183
|
-
field = Object.assign(response[field.name], field);
|
|
184
|
-
}
|
|
185
|
-
return field;
|
|
186
|
-
});
|
|
187
|
-
});
|
|
188
|
-
resolve();
|
|
189
|
-
})
|
|
190
|
-
});
|
|
191
|
-
return siteData;
|
|
192
|
-
};
|
|
193
|
-
|
|
194
|
-
return async function() {
|
|
195
|
-
if (!templatesData.doNotUseDefaultFieldConfig) {
|
|
196
|
-
await getDefaultFormFieldConfig();
|
|
197
|
-
}
|
|
198
|
-
|
|
168
|
+
return function() {
|
|
199
169
|
return gulp.src([
|
|
200
170
|
siteSettings.srcFolder + '/' + siteSettings.templatesSubfolder + '/**/*.html',
|
|
201
171
|
'!' + siteSettings.srcFolder + '/' + siteSettings.templatesSubfolder + '/_partials/**/*.html'
|
package/package.json
CHANGED
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
*/
|
|
18
18
|
|
|
19
19
|
modForm.getTradeFromUrl = function() {
|
|
20
|
-
var trades = ['solar', 'roofing', 'windows', 'hvac', 'siding', 'gutters', 'bathrooms', 'kitchen-remodeling', 'cabinets', 'home-security', 'home-warranty', 'medical-alerts', 'stair-lifts', 'walk-in-tubs', 'hot-tubs', 'flooring'],
|
|
20
|
+
var trades = ['solar', 'roofing', 'windows', 'hvac', 'siding', 'gutters', 'bathrooms', 'kitchen-remodeling', 'cabinets', 'home-security', 'home-warranty', 'medical-alerts', 'stair-lifts', 'walk-in-tubs', 'hot-tubs', 'flooring', 'tree-services'],
|
|
21
21
|
queryParamString = (location.search.slice(1) !== '') ? location.search.slice(1) : '',
|
|
22
22
|
params = queryParamString.toLowerCase(),
|
|
23
23
|
filteredTrades = trades.filter(function(trade) {
|