mod-build 3.6.77-beta.1 → 3.6.78
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 +5 -0
- 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
|
ein: formData.ein,
|
|
361
346
|
websiteUrl: formData.websiteUrl,
|
|
@@ -413,6 +398,57 @@ modForm.initResubmitBtn = function() {
|
|
|
413
398
|
});
|
|
414
399
|
};
|
|
415
400
|
|
|
401
|
+
modForm.isSmallBusiness = function(annualRevenue) {
|
|
402
|
+
const smbRevenueAnswers = ['I\'m a sales rep', '$0 - $500K', '$500K - $1M'];
|
|
403
|
+
if (!annualRevenue) {
|
|
404
|
+
console.error('No annual revenue provided');
|
|
405
|
+
return false;
|
|
406
|
+
}
|
|
407
|
+
|
|
408
|
+
return smbRevenueAnswers.indexOf(annualRevenue) > -1;
|
|
409
|
+
}
|
|
410
|
+
|
|
411
|
+
/**
|
|
412
|
+
* Email
|
|
413
|
+
* @param {String} email - email address to validate
|
|
414
|
+
* @returns {Boolean} isFreeEmail
|
|
415
|
+
*/
|
|
416
|
+
modForm.isFreeEmail = function(email) {
|
|
417
|
+
let isFreeEmail = false;
|
|
418
|
+
const freeDomains = ['gmail', 'hotmail', 'msn', 'aol', 'yahoo', 'ymail', 'comcast', 'icloud'];
|
|
419
|
+
|
|
420
|
+
if (email) {
|
|
421
|
+
const emailAddress = email.toLowerCase();
|
|
422
|
+
isFreeEmail = freeDomains.some(domain => emailAddress.includes(domain));
|
|
423
|
+
}
|
|
424
|
+
|
|
425
|
+
return isFreeEmail;
|
|
426
|
+
}
|
|
427
|
+
|
|
428
|
+
/**
|
|
429
|
+
* Check if data meets criteria to match with CXP
|
|
430
|
+
* @returns {Boolean} - true if meets CXP criteria
|
|
431
|
+
*/
|
|
432
|
+
modForm.isSupportedByCxp = function(formData) {
|
|
433
|
+
if (formData.primaryProjectClass === 'Solar') {
|
|
434
|
+
return false;
|
|
435
|
+
}
|
|
436
|
+
|
|
437
|
+
return true;
|
|
438
|
+
};
|
|
439
|
+
|
|
440
|
+
/**
|
|
441
|
+
* 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)
|
|
442
|
+
* @returns {Boolean} - true if meets MQL Criteria
|
|
443
|
+
*/
|
|
444
|
+
modForm.meetsMQLCriteria = function(formData) {
|
|
445
|
+
if (this.isFreeEmail(formData.email) && formData.websiteUrl === '') {
|
|
446
|
+
return false;
|
|
447
|
+
}
|
|
448
|
+
|
|
449
|
+
return true;
|
|
450
|
+
};
|
|
451
|
+
|
|
416
452
|
/**
|
|
417
453
|
* Process form after succesful submit
|
|
418
454
|
* @param {Object} response - response data
|
|
@@ -482,8 +518,9 @@ modForm.processContractorFormSubmitSuccess = function(response, currentStep, xhr
|
|
|
482
518
|
|
|
483
519
|
// Thankyou blocks logic
|
|
484
520
|
var $tyStateBlocks = _this.opts.form.find('.ty-state-block'),
|
|
485
|
-
$
|
|
486
|
-
$
|
|
521
|
+
$cxpTyp = _this.opts.form.find('.ty-state-block-cxp'),
|
|
522
|
+
$noserviceTyp = _this.opts.form.find('.ty-state-block-noservice'),
|
|
523
|
+
$generalTyp = _this.opts.form.find('.ty-state-block-success'),
|
|
487
524
|
$generalTyp = _this.opts.form.find('.ty-state-block-success'),
|
|
488
525
|
$primaryProjectClass = _this.opts.form.find('select[name="primaryProjectClass"]'),
|
|
489
526
|
tyStateGAName;
|
|
@@ -494,16 +531,18 @@ modForm.processContractorFormSubmitSuccess = function(response, currentStep, xhr
|
|
|
494
531
|
// Check what type of TY page to show
|
|
495
532
|
$tyStateBlocks.hide();
|
|
496
533
|
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
} else if (_this.isSmallBusiness()) { // if is small business
|
|
502
|
-
tyStateGAName = 'thankyou-smallbusiness';
|
|
503
|
-
$sbssTyp.show();
|
|
504
|
-
} else {
|
|
534
|
+
const meetsModCriteria = _this.meetsMQLCriteria(_this.getFormData());
|
|
535
|
+
const meetsCxpCriteria = _this.isSupportedByCxp(_this.getFormData());
|
|
536
|
+
|
|
537
|
+
if (meetsModCriteria) {
|
|
505
538
|
tyStateGAName = 'thankyou';
|
|
506
539
|
$generalTyp.show();
|
|
540
|
+
} else if (meetsCxpCriteria) {
|
|
541
|
+
tyStateGAName = 'thankyou-cxp';
|
|
542
|
+
$cxpTyp.show();
|
|
543
|
+
} else {
|
|
544
|
+
tyStateGAName = 'thankyou-noservice';
|
|
545
|
+
$noserviceTyp.show();
|
|
507
546
|
}
|
|
508
547
|
|
|
509
548
|
// Track TY page in GA
|