mod-build 3.4.12-beta.2 → 3.4.13-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.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mod-build",
3
- "version": "3.4.12-beta.2",
3
+ "version": "3.4.13-beta.2",
4
4
  "description": "Share components for S3 sites.",
5
5
  "scripts": {
6
6
  "test": "echo \"Error: no test specified\" && exit 1"
@@ -672,12 +672,14 @@ modForm.submitFormDataToQSApi = function(formData, successCallback, errorCallbac
672
672
  */
673
673
  modForm.processQSFormSubmitSuccess = function(response, xhr) {
674
674
  var cookieData,
675
- responseData = response.RESPONSE;
675
+ responseData = response.RESPONSE,
676
+ dataCaptureKey = responseData.DCK;
677
+
678
+ window.projectId = responseData.HASHEDDCK;
676
679
 
677
680
  // If submission was succesful
678
- if (responseData.DCK != null && xhr.status === 200) {
679
- var dataCaptureKey = responseData.DCK,
680
- clickKeyUUID = this.opts.formData.CLK,
681
+ if (dataCaptureKey != null && xhr.status === 200) {
682
+ var clickKeyUUID = this.opts.formData.CLK,
681
683
  landingPage = window.location.hostname + window.location.pathname;
682
684
 
683
685
  // Setting GA User ID and several custom dimensions after a successful form submit request
@@ -756,16 +758,16 @@ modForm.processQSFormSubmitSuccess = function(response, xhr) {
756
758
  }
757
759
  }
758
760
 
759
- // Set results page to HRC if the site is eligible
760
- if (this.isQsSiteEligibleForHrc() && response.RESPONSE.HASHEDDCK) {
761
- window.projectId = response.RESPONSE.HASHEDDCK;
761
+ // Set results page to HRC if the site is eligible, there's a DCK
762
+ // and the results page opt is not defined yet (emerging trades have results page defined and should not redirect to the HRC)
763
+ if (this.isQsSiteEligibleForHrc() && window.projectId && !this.opts.resultsPage) {
762
764
  this.opts.resultsPage = this.getProjExUrl();
763
- this.opts.resultsPage += (this.opts.resultsPage.indexOf('?') < 0 ? '?' : '&') + 'DCK=' + response.RESPONSE.DCK;
765
+ this.opts.resultsPage += (this.opts.resultsPage.indexOf('?') < 0 ? '?' : '&') + 'DCK=' + dataCaptureKey;
766
+ }
764
767
 
765
- // Append TY to HRC URL for QS tracking purpose
766
- if (typeof this.opts.appendTyToHrcUrl !== 'undefined' && this.opts.appendTyToHrcUrl === true) {
767
- this.opts.resultsPage += '&' + (responseData.MATCHES.length > 0 ? 'ThankYou' : 'Sorry');
768
- }
768
+ // Append TY to HRC URL for QS tracking purpose
769
+ if (typeof this.opts.appendTyToHrcUrl !== 'undefined' && this.opts.appendTyToHrcUrl === true) {
770
+ this.opts.resultsPage += '&' + (responseData.MATCHES.length > 0 ? 'ThankYou' : 'Sorry');
769
771
  }
770
772
 
771
773
  // Renamed thankyou page to results page to be more explicit that TYP is dying
@@ -3,4 +3,4 @@ var gtm_container_ID = window.isQSPage ? '{{qs_gtm_container_ID}}' : '{{gtm_cont
3
3
  new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
4
4
  j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
5
5
  'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
6
- })(window,document,'script','dataLayer','{{gtm_container_ID}}');
6
+ })(window,document,'script','dataLayer',gtm_container_ID);