mod-build 3.6.76-beta.1 → 3.6.76
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/package.json +1 -1
- package/src/scripts/mod-form-contractor.js +27 -69
package/CHANGELOG.md
CHANGED
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,61 +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.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
|
-
|
|
455
416
|
/**
|
|
456
417
|
* Process form after succesful submit
|
|
457
418
|
* @param {Object} response - response data
|
|
@@ -521,9 +482,8 @@ modForm.processContractorFormSubmitSuccess = function(response, currentStep, xhr
|
|
|
521
482
|
|
|
522
483
|
// Thankyou blocks logic
|
|
523
484
|
var $tyStateBlocks = _this.opts.form.find('.ty-state-block'),
|
|
524
|
-
$
|
|
525
|
-
$
|
|
526
|
-
$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'),
|
|
527
487
|
$generalTyp = _this.opts.form.find('.ty-state-block-success'),
|
|
528
488
|
$primaryProjectClass = _this.opts.form.find('select[name="primaryProjectClass"]'),
|
|
529
489
|
tyStateGAName;
|
|
@@ -534,18 +494,16 @@ modForm.processContractorFormSubmitSuccess = function(response, currentStep, xhr
|
|
|
534
494
|
// Check what type of TY page to show
|
|
535
495
|
$tyStateBlocks.hide();
|
|
536
496
|
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
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 {
|
|
541
505
|
tyStateGAName = 'thankyou';
|
|
542
506
|
$generalTyp.show();
|
|
543
|
-
} else if (meetsCxpCriteria) {
|
|
544
|
-
tyStateGAName = 'thankyou-cxp';
|
|
545
|
-
$cxpTyp.show();
|
|
546
|
-
} else {
|
|
547
|
-
tyStateGAName = 'thankyou-noservice';
|
|
548
|
-
$noserviceTyp.show();
|
|
549
507
|
}
|
|
550
508
|
|
|
551
509
|
// Track TY page in GA
|