mod-build 3.6.75 → 3.6.76-beta.2
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 +65 -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,57 @@ 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.isFreeEmail(formData.email) && formData.websiteUrl === '') {
|
|
445
|
+
return false;
|
|
446
|
+
}
|
|
447
|
+
|
|
448
|
+
return true;
|
|
449
|
+
};
|
|
450
|
+
|
|
415
451
|
/**
|
|
416
452
|
* Process form after succesful submit
|
|
417
453
|
* @param {Object} response - response data
|
|
@@ -481,8 +517,9 @@ modForm.processContractorFormSubmitSuccess = function(response, currentStep, xhr
|
|
|
481
517
|
|
|
482
518
|
// Thankyou blocks logic
|
|
483
519
|
var $tyStateBlocks = _this.opts.form.find('.ty-state-block'),
|
|
484
|
-
$
|
|
485
|
-
$
|
|
520
|
+
$cxpTyp = _this.opts.form.find('.ty-state-block-cxp'),
|
|
521
|
+
$noserviceTyp = _this.opts.form.find('.ty-state-block-noservice'),
|
|
522
|
+
$generalTyp = _this.opts.form.find('.ty-state-block-success'),
|
|
486
523
|
$generalTyp = _this.opts.form.find('.ty-state-block-success'),
|
|
487
524
|
$primaryProjectClass = _this.opts.form.find('select[name="primaryProjectClass"]'),
|
|
488
525
|
tyStateGAName;
|
|
@@ -493,16 +530,18 @@ modForm.processContractorFormSubmitSuccess = function(response, currentStep, xhr
|
|
|
493
530
|
// Check what type of TY page to show
|
|
494
531
|
$tyStateBlocks.hide();
|
|
495
532
|
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
} else if (_this.isSmallBusiness()) { // if is small business
|
|
501
|
-
tyStateGAName = 'thankyou-smallbusiness';
|
|
502
|
-
$sbssTyp.show();
|
|
503
|
-
} else {
|
|
533
|
+
const meetsModCriteria = _this.meetsMQLCriteria(_this.getFormData());
|
|
534
|
+
const meetsCxpCriteria = _this.isSupportedByCxp(_this.getFormData());
|
|
535
|
+
|
|
536
|
+
if (meetsModCriteria) {
|
|
504
537
|
tyStateGAName = 'thankyou';
|
|
505
538
|
$generalTyp.show();
|
|
539
|
+
} else if (meetsCxpCriteria) {
|
|
540
|
+
tyStateGAName = 'thankyou-cxp';
|
|
541
|
+
$cxpTyp.show();
|
|
542
|
+
} else {
|
|
543
|
+
tyStateGAName = 'thankyou-noservice';
|
|
544
|
+
$noserviceTyp.show();
|
|
506
545
|
}
|
|
507
546
|
|
|
508
547
|
// Track TY page in GA
|