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 CHANGED
@@ -1,5 +1,9 @@
1
1
  # Changelog
2
2
 
3
+ ## 3.6.76
4
+
5
+ - Add EIN field to data for Mod endpoint
6
+
3
7
  ## 3.6.75
4
8
 
5
9
  - Update grab-shared-scripts task to consider isPathSubdirectory flag for modalytics script path
@@ -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(url, async function(err, xhr, response) {
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mod-build",
3
- "version": "3.6.76-beta.2",
3
+ "version": "3.6.77-beta.1",
4
4
  "description": "Share components for S3 sites.",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1",
@@ -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
- $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'),
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
- const meetsModCriteria = _this.meetsMQLCriteria(_this.getFormData());
534
- const meetsCxpCriteria = _this.isSupportedByCxp(_this.getFormData());
535
-
536
- if (meetsModCriteria) {
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