mod-build 3.6.76-beta.2 → 3.6.77-beta.1
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/templates.js +5 -1
- package/package.json +1 -1
- package/src/scripts/mod-form-contractor.js +27 -65
- package/package-lock-1.json +0 -35243
package/CHANGELOG.md
CHANGED
package/gulp-tasks/templates.js
CHANGED
|
@@ -236,10 +236,14 @@ module.exports = function(gulp, gulpPlugins, siteSettings, siteData) {
|
|
|
236
236
|
const service = templatesData.service ? templatesData.service.toLowerCase().replace(' ', '_') : templatesData.primary_trade.toLowerCase().replace(' ', '_');
|
|
237
237
|
const apiEnv = 'https://' + (templatesData.nodeEnv === 'modernize.com' ? 'hs.leadpost.net/' : 'hsleadpost1.quinstage.com/');
|
|
238
238
|
const url = `${apiEnv}coreg/getTCPAConsent?website=${website}&service=${service}&affiliateKey=${affiliateKey}&c_level=${c_level}`;
|
|
239
|
+
const reqConfig = {
|
|
240
|
+
url: url,
|
|
241
|
+
encoding: 'latin1'
|
|
242
|
+
};
|
|
239
243
|
console.time('Finished fetch-tcpa-from-sitegenie after');
|
|
240
244
|
console.log('Starting fetch-tcpa-from-sitegenie: ',url);
|
|
241
245
|
await new Promise(function(resolve) {
|
|
242
|
-
request(
|
|
246
|
+
request(reqConfig, async function(err, xhr, response) {
|
|
243
247
|
if (xhr.statusCode !== 200) {
|
|
244
248
|
throw new Error(`${xhr.statusCode}: Error while fetching TCPA`);
|
|
245
249
|
}
|
package/package.json
CHANGED
|
@@ -295,6 +295,22 @@ modForm.submitContractorFormDataToApi = function(formData, successCallback, erro
|
|
|
295
295
|
}
|
|
296
296
|
};
|
|
297
297
|
|
|
298
|
+
/**
|
|
299
|
+
* Check if the submitted info qualifies as small business to show corresponding thank you block
|
|
300
|
+
* @returns {Boolean} - true if small business
|
|
301
|
+
*/
|
|
302
|
+
modForm.isSmallBusiness = function() {
|
|
303
|
+
var $annualRevenue = this.opts.form.find('[name="annualRevenue"]').val(),
|
|
304
|
+
smbRevenueAnswers = ['Under $250,000', 'I\'m a Sales Rep'],
|
|
305
|
+
isSmallBus = false;
|
|
306
|
+
|
|
307
|
+
if (smbRevenueAnswers.indexOf($annualRevenue) > -1) {
|
|
308
|
+
isSmallBus = true;
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
return isSmallBus;
|
|
312
|
+
};
|
|
313
|
+
|
|
298
314
|
/**
|
|
299
315
|
* Process data to the new API required format
|
|
300
316
|
* @param {Object} formData - form data
|
|
@@ -340,8 +356,8 @@ modForm.formatContractorDataForModApi = function(formData, currentStep) {
|
|
|
340
356
|
annualRevenue: formData.annualRevenue,
|
|
341
357
|
buysLeads: formData.buysLeads,
|
|
342
358
|
crmInUse: formData.crmInUse,
|
|
343
|
-
ein: formData.ein,
|
|
344
359
|
whoCallsLeads: formData.whoCallsLeads,
|
|
360
|
+
ein: formData.ein,
|
|
345
361
|
websiteUrl: formData.websiteUrl,
|
|
346
362
|
companyZip: formData.companyZip
|
|
347
363
|
}
|
|
@@ -397,57 +413,6 @@ modForm.initResubmitBtn = function() {
|
|
|
397
413
|
});
|
|
398
414
|
};
|
|
399
415
|
|
|
400
|
-
modForm.isSmallBusiness = function(annualRevenue) {
|
|
401
|
-
const smbRevenueAnswers = ['I\'m a sales rep', '$0 - $500K', '$500K - $1M'];
|
|
402
|
-
if (!annualRevenue) {
|
|
403
|
-
console.error('No annual revenue provided');
|
|
404
|
-
return false;
|
|
405
|
-
}
|
|
406
|
-
|
|
407
|
-
return smbRevenueAnswers.indexOf(annualRevenue) > -1;
|
|
408
|
-
}
|
|
409
|
-
|
|
410
|
-
/**
|
|
411
|
-
* Email
|
|
412
|
-
* @param {String} email - email address to validate
|
|
413
|
-
* @returns {Boolean} isFreeEmail
|
|
414
|
-
*/
|
|
415
|
-
modForm.isFreeEmail = function(email) {
|
|
416
|
-
let isFreeEmail = false;
|
|
417
|
-
const freeDomains = ['gmail', 'hotmail', 'msn', 'aol', 'yahoo', 'ymail', 'comcast', 'icloud'];
|
|
418
|
-
|
|
419
|
-
if (email) {
|
|
420
|
-
const emailAddress = email.toLowerCase();
|
|
421
|
-
isFreeEmail = freeDomains.some(domain => emailAddress.includes(domain));
|
|
422
|
-
}
|
|
423
|
-
|
|
424
|
-
return isFreeEmail;
|
|
425
|
-
}
|
|
426
|
-
|
|
427
|
-
/**
|
|
428
|
-
* Check if data meets criteria to match with CXP
|
|
429
|
-
* @returns {Boolean} - true if meets CXP criteria
|
|
430
|
-
*/
|
|
431
|
-
modForm.isSupportedByCxp = function(formData) {
|
|
432
|
-
if (formData.primaryProjectClass === 'Solar') {
|
|
433
|
-
return false;
|
|
434
|
-
}
|
|
435
|
-
|
|
436
|
-
return true;
|
|
437
|
-
};
|
|
438
|
-
|
|
439
|
-
/**
|
|
440
|
-
* Check if the submitted info meets the criteria of a Marketing Qualified Lead (MQL, a lead who is more likely to become a customer than other leads)
|
|
441
|
-
* @returns {Boolean} - true if meets MQL Criteria
|
|
442
|
-
*/
|
|
443
|
-
modForm.meetsMQLCriteria = function(formData) {
|
|
444
|
-
if (this.isFreeEmail(formData.email) && formData.websiteUrl === '') {
|
|
445
|
-
return false;
|
|
446
|
-
}
|
|
447
|
-
|
|
448
|
-
return true;
|
|
449
|
-
};
|
|
450
|
-
|
|
451
416
|
/**
|
|
452
417
|
* Process form after succesful submit
|
|
453
418
|
* @param {Object} response - response data
|
|
@@ -517,9 +482,8 @@ modForm.processContractorFormSubmitSuccess = function(response, currentStep, xhr
|
|
|
517
482
|
|
|
518
483
|
// Thankyou blocks logic
|
|
519
484
|
var $tyStateBlocks = _this.opts.form.find('.ty-state-block'),
|
|
520
|
-
$
|
|
521
|
-
$
|
|
522
|
-
$generalTyp = _this.opts.form.find('.ty-state-block-success'),
|
|
485
|
+
$otherTyp = _this.opts.form.find('.ty-state-block-other'),
|
|
486
|
+
$sbssTyp = _this.opts.form.find('.ty-state-block-sbss'),
|
|
523
487
|
$generalTyp = _this.opts.form.find('.ty-state-block-success'),
|
|
524
488
|
$primaryProjectClass = _this.opts.form.find('select[name="primaryProjectClass"]'),
|
|
525
489
|
tyStateGAName;
|
|
@@ -530,18 +494,16 @@ modForm.processContractorFormSubmitSuccess = function(response, currentStep, xhr
|
|
|
530
494
|
// Check what type of TY page to show
|
|
531
495
|
$tyStateBlocks.hide();
|
|
532
496
|
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
497
|
+
if ($primaryProjectClass.val() === 'Other') {
|
|
498
|
+
tyStateGAName = 'thankyou-other';
|
|
499
|
+
$otherTyp.show();
|
|
500
|
+
_this.initResubmitBtn();
|
|
501
|
+
} else if (_this.isSmallBusiness()) { // if is small business
|
|
502
|
+
tyStateGAName = 'thankyou-smallbusiness';
|
|
503
|
+
$sbssTyp.show();
|
|
504
|
+
} else {
|
|
537
505
|
tyStateGAName = 'thankyou';
|
|
538
506
|
$generalTyp.show();
|
|
539
|
-
} else if (meetsCxpCriteria) {
|
|
540
|
-
tyStateGAName = 'thankyou-cxp';
|
|
541
|
-
$cxpTyp.show();
|
|
542
|
-
} else {
|
|
543
|
-
tyStateGAName = 'thankyou-noservice';
|
|
544
|
-
$noserviceTyp.show();
|
|
545
507
|
}
|
|
546
508
|
|
|
547
509
|
// Track TY page in GA
|