mod-build 3.6.75 → 3.6.76-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/package-lock-1.json +35243 -0
- package/package.json +1 -1
- package/src/scripts/mod-form-contractor.js +69 -26
package/package.json
CHANGED
|
@@ -295,22 +295,6 @@ 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
|
-
|
|
314
298
|
/**
|
|
315
299
|
* Process data to the new API required format
|
|
316
300
|
* @param {Object} formData - form data
|
|
@@ -356,6 +340,7 @@ modForm.formatContractorDataForModApi = function(formData, currentStep) {
|
|
|
356
340
|
annualRevenue: formData.annualRevenue,
|
|
357
341
|
buysLeads: formData.buysLeads,
|
|
358
342
|
crmInUse: formData.crmInUse,
|
|
343
|
+
ein: formData.ein,
|
|
359
344
|
whoCallsLeads: formData.whoCallsLeads,
|
|
360
345
|
websiteUrl: formData.websiteUrl,
|
|
361
346
|
companyZip: formData.companyZip
|
|
@@ -412,6 +397,61 @@ modForm.initResubmitBtn = function() {
|
|
|
412
397
|
});
|
|
413
398
|
};
|
|
414
399
|
|
|
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.isSmallBusiness(formData.annualRevenue)) {
|
|
445
|
+
return false;
|
|
446
|
+
}
|
|
447
|
+
|
|
448
|
+
if (this.isFreeEmail(formData.email) && formData.websiteUrl === '') {
|
|
449
|
+
return false;
|
|
450
|
+
}
|
|
451
|
+
|
|
452
|
+
return true;
|
|
453
|
+
};
|
|
454
|
+
|
|
415
455
|
/**
|
|
416
456
|
* Process form after succesful submit
|
|
417
457
|
* @param {Object} response - response data
|
|
@@ -481,8 +521,9 @@ modForm.processContractorFormSubmitSuccess = function(response, currentStep, xhr
|
|
|
481
521
|
|
|
482
522
|
// Thankyou blocks logic
|
|
483
523
|
var $tyStateBlocks = _this.opts.form.find('.ty-state-block'),
|
|
484
|
-
$
|
|
485
|
-
$
|
|
524
|
+
$cxpTyp = _this.opts.form.find('.ty-state-block-cxp'),
|
|
525
|
+
$noserviceTyp = _this.opts.form.find('.ty-state-block-noservice'),
|
|
526
|
+
$generalTyp = _this.opts.form.find('.ty-state-block-success'),
|
|
486
527
|
$generalTyp = _this.opts.form.find('.ty-state-block-success'),
|
|
487
528
|
$primaryProjectClass = _this.opts.form.find('select[name="primaryProjectClass"]'),
|
|
488
529
|
tyStateGAName;
|
|
@@ -493,16 +534,18 @@ modForm.processContractorFormSubmitSuccess = function(response, currentStep, xhr
|
|
|
493
534
|
// Check what type of TY page to show
|
|
494
535
|
$tyStateBlocks.hide();
|
|
495
536
|
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
} else if (_this.isSmallBusiness()) { // if is small business
|
|
501
|
-
tyStateGAName = 'thankyou-smallbusiness';
|
|
502
|
-
$sbssTyp.show();
|
|
503
|
-
} else {
|
|
537
|
+
const meetsModCriteria = _this.meetsMQLCriteria(_this.getFormData());
|
|
538
|
+
const meetsCxpCriteria = _this.isSupportedByCxp(_this.getFormData());
|
|
539
|
+
|
|
540
|
+
if (meetsModCriteria) {
|
|
504
541
|
tyStateGAName = 'thankyou';
|
|
505
542
|
$generalTyp.show();
|
|
543
|
+
} else if (meetsCxpCriteria) {
|
|
544
|
+
tyStateGAName = 'thankyou-cxp';
|
|
545
|
+
$cxpTyp.show();
|
|
546
|
+
} else {
|
|
547
|
+
tyStateGAName = 'thankyou-noservice';
|
|
548
|
+
$noserviceTyp.show();
|
|
506
549
|
}
|
|
507
550
|
|
|
508
551
|
// Track TY page in GA
|