mod-build 3.6.71 → 4.0.0-alpha.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.
Files changed (149) hide show
  1. package/.eslintignore +3 -0
  2. package/.eslintrc +18 -0
  3. package/CHANGELOG.md +2 -240
  4. package/README.md +16 -263
  5. package/gulp-tasks/build.js +1 -1
  6. package/package.json +21 -69
  7. package/siteconfig.js +38 -0
  8. package/src/accessible-components/button/_button.scss +195 -0
  9. package/src/accessible-components/button/back-button.html +4 -0
  10. package/src/accessible-components/button/button.html +17 -0
  11. package/src/accessible-components/carousel/_carousel.scss +112 -0
  12. package/src/accessible-components/carousel/carousel.html +25 -0
  13. package/src/accessible-components/checkbox/_checkbox.scss +96 -0
  14. package/src/accessible-components/checkbox/checkbox.html +8 -0
  15. package/src/accessible-components/expand-collapse/_expand-collapse.scss +122 -0
  16. package/src/accessible-components/expand-collapse/expand-collapse.html +8 -0
  17. package/src/accessible-components/expand-collapse/expand-collapse.js +52 -0
  18. package/src/accessible-components/expand-collapse/expand-collapse.min.js +2 -0
  19. package/src/accessible-components/expand-collapse/expand-collapse.min.js.map +1 -0
  20. package/src/accessible-components/featured-block/_featured-block.scss +219 -0
  21. package/src/accessible-components/featured-block/featured-block.html +54 -0
  22. package/src/accessible-components/foot-assets/foot-assets.html +92 -0
  23. package/src/accessible-components/footer/footer.html +2 -0
  24. package/src/{templates/_partials/scripts/gtm-editorials/body/google-tag-manager-body.html → accessible-components/gtm-body/gtm-body.html} +1 -2
  25. package/src/accessible-components/head/head.html +188 -0
  26. package/src/accessible-components/header/_header.scss +289 -0
  27. package/src/accessible-components/header/header.html +66 -0
  28. package/src/accessible-components/hero/_hero.scss +371 -0
  29. package/src/accessible-components/hero/hero.html +53 -0
  30. package/src/accessible-components/how-it-works/_how-it-works.scss +217 -0
  31. package/src/accessible-components/how-it-works/how-it-works-carousel.html +12 -0
  32. package/src/accessible-components/how-it-works/how-it-works-static.html +12 -0
  33. package/src/accessible-components/how-it-works/how-it-works.html +14 -0
  34. package/src/accessible-components/information/_information.scss +92 -0
  35. package/src/accessible-components/information/information.html +26 -0
  36. package/src/accessible-components/input/_input.scss +202 -0
  37. package/src/accessible-components/input/input.html +22 -0
  38. package/src/accessible-components/input/textarea.html +9 -0
  39. package/src/accessible-components/partners/_partners.scss +232 -0
  40. package/src/accessible-components/partners/partners.html +56 -0
  41. package/src/accessible-components/picture/picture.html +19 -0
  42. package/src/accessible-components/preloader/_preloader.scss +61 -0
  43. package/src/accessible-components/preloader/preloader.html +23 -0
  44. package/src/accessible-components/progress-bar/_progress-bar.scss +119 -0
  45. package/src/accessible-components/progress-bar/progress-bar.html +21 -0
  46. package/src/accessible-components/progress-bar/progress-bar.js +37 -0
  47. package/src/accessible-components/progress-bar/progress-bar.min.js +2 -0
  48. package/src/accessible-components/progress-bar/progress-bar.min.js.map +1 -0
  49. package/src/accessible-components/radio-button/_radio-button.scss +537 -0
  50. package/src/accessible-components/radio-button/radio-button.html +34 -0
  51. package/src/accessible-components/reviews/_reviews.scss +175 -0
  52. package/src/accessible-components/reviews/reviews-carousel.html +12 -0
  53. package/src/accessible-components/reviews/reviews-static.html +12 -0
  54. package/src/accessible-components/reviews/reviews.html +37 -0
  55. package/src/accessible-components/select/_select.scss +69 -0
  56. package/src/accessible-components/select/select.html +10 -0
  57. package/src/accessible-components/steps/_steps.scss +524 -0
  58. package/src/accessible-components/steps/defaultFormFieldConfig.json +109 -0
  59. package/src/accessible-components/steps/step-fields.html +33 -0
  60. package/src/accessible-components/steps/steps.html +150 -0
  61. package/src/accessible-components/tcpa/_tcpa.scss +49 -0
  62. package/src/accessible-components/tcpa/tcpa.html +9 -0
  63. package/src/accessible-components/tile/_tile.scss +117 -0
  64. package/src/accessible-components/tile/tile.html +14 -0
  65. package/src/accessible-components/value-props/_value-props.scss +100 -0
  66. package/src/accessible-components/value-props/value-props.html +17 -0
  67. package/src/accessible-components/zip-control/_zip-control.scss +78 -0
  68. package/src/accessible-components/zip-control/zip-control.html +10 -0
  69. package/src/data/footer.js +117 -0
  70. package/src/data/seasons.js +5 -7
  71. package/src/data/theme.json +164 -0
  72. package/src/index.html +18 -0
  73. package/src/main.js +45 -0
  74. package/src/resources/scripts/abandonment/abandonment-1df90ee155f6c0893d90.min.js +2 -0
  75. package/src/resources/scripts/abandonment/abandonment.min.js +2 -0
  76. package/src/resources/scripts/footer/footer-component-7b5e263f64568573ecc0.min.js +2 -0
  77. package/src/resources/scripts/footer/footer-component.min.js +2 -0
  78. package/src/resources/scripts/helpers/initNumericOnlyFields.min.js +2 -0
  79. package/src/resources/scripts/helpers/initNumericOnlyFields.min.js.map +1 -0
  80. package/src/resources/scripts/helpers/isZipCodeValid.min.js +2 -0
  81. package/src/resources/scripts/helpers/isZipCodeValid.min.js.map +1 -0
  82. package/src/resources/scripts/mod-alytics/modalytics-0ac7d7a5a72ea67a0f47.min.js +2 -0
  83. package/src/resources/scripts/mod-alytics/modalytics.min.js +2 -0
  84. package/src/resources/scripts/mod-form/form/homeowner-77a4dd439b8db412678b.min.js +2 -0
  85. package/src/resources/scripts/mod-form/form/homeowner.min.js +2 -0
  86. package/src/resources/scripts/mod-utils/modutils-8ba40d21f559171ddd36.min.js +2 -0
  87. package/src/resources/scripts/mod-utils/modutils.min.js +2 -0
  88. package/src/resources/styles/components/abandonment/abandonment-ae63aca828944411eff7.min.css +1 -0
  89. package/src/resources/styles/components/abandonment/abandonment.min.css +1 -0
  90. package/src/resources/styles/components/footer/mod-footer-3717faf57147c62c1777.min.css +1 -0
  91. package/src/resources/styles/components/footer/mod-footer.min.css +1 -0
  92. package/src/resources/styles/components/footer/qs-footer-12bf078dc614ff221c3c.min.css +1 -0
  93. package/src/resources/styles/components/footer/qs-footer.min.css +1 -0
  94. package/src/resources/templates/modals/about/index.html +9 -0
  95. package/src/resources/templates/modals/contact-us/index.html +348 -0
  96. package/src/resources/templates/modals/faq/index.html +9 -0
  97. package/src/resources/templates/modals/privacy/index.html +236 -0
  98. package/src/resources/templates/modals/terms/index.html +166 -0
  99. package/src/scripts/has-qs-params.js +6 -5
  100. package/src/scripts/url-cleaner.js +3 -3
  101. package/src/scripts/utils.js +178 -0
  102. package/src/styles/home.scss +1 -0
  103. package/src/temp/scripts/maxmind-geoip2.js +104 -0
  104. package/src/templates/_partials/scripts/deferred-styles.html +16 -16
  105. package/src/templates/_partials/scripts/vwo-redirect-callback.html +43 -45
  106. package/src/templates/components/head.html +70 -0
  107. package/tasks/clean.js +13 -0
  108. package/tasks/grab-cdn.js +107 -0
  109. package/tasks/grab-form-helpers.js +94 -0
  110. package/tasks/grab-shared-components.js +81 -0
  111. package/tasks/grab-shared-scripts.js +267 -0
  112. package/tasks/serve.js +15 -0
  113. package/tasks/templates.js +168 -0
  114. package/template.js +801 -0
  115. package/vite.config.js +56 -0
  116. package/.eslintrc.yml +0 -59
  117. package/src/data/common.js +0 -704
  118. package/src/data/components/qs-footer.js +0 -55
  119. package/src/data/components/quote-footer.js +0 -73
  120. package/src/scripts/apt-block.js +0 -919
  121. package/src/scripts/components/custom-selects.js +0 -48
  122. package/src/scripts/components/radio-panels.js +0 -45
  123. package/src/scripts/es6-1.js +0 -6
  124. package/src/scripts/es6-2.js +0 -2
  125. package/src/scripts/qs-form.js +0 -839
  126. package/src/scripts/vendor/maxmind-geoip2.js +0 -2
  127. package/src/scripts/vendor/swiper.min.js +0 -13
  128. package/src/styles/apt-block.scss +0 -888
  129. package/src/templates/_partials/apt-block.html +0 -30
  130. package/src/templates/_partials/scripts/analytics.html +0 -4
  131. package/src/templates/_partials/scripts/go-page-hiding-snippet.html +0 -8
  132. package/src/templates/_partials/scripts/google-maps.html +0 -1
  133. package/src/templates/_partials/scripts/google-optimize.html +0 -12
  134. package/src/templates/_partials/scripts/gtm-editorials/head/google-tag-manager-head.html +0 -10
  135. package/src/templates/_partials/scripts/gtm-hil/body/google-tag-manager-body.html +0 -5
  136. package/src/templates/_partials/scripts/gtm-hil/head/google-tag-manager-head.html +0 -10
  137. package/src/templates/_partials/scripts/gtm-pro/body/google-tag-manager-body.html +0 -5
  138. package/src/templates/_partials/scripts/gtm-pro/head/google-tag-manager-head.html +0 -10
  139. package/src/templates/_partials/scripts/gtm-quote/body/google-tag-manager-body.html +0 -5
  140. package/src/templates/_partials/scripts/gtm-quote/head/google-tag-manager-head.html +0 -9
  141. package/src/templates/_partials/scripts/gtm-whitelabel/body/mod-google-tag-manager-body.html +0 -5
  142. package/src/templates/_partials/scripts/gtm-whitelabel/body/non-mod-google-tag-manager-body.html +0 -5
  143. package/src/templates/_partials/scripts/gtm-whitelabel/head/mod-google-tag-manager-head.html +0 -10
  144. package/src/templates/_partials/scripts/gtm-whitelabel/head/non-mod-google-tag-manager-head.html +0 -9
  145. package/src/templates/_partials/scripts/gtm-wordpress/body/google-tag-manager-body.html +0 -5
  146. package/src/templates/_partials/scripts/gtm-wordpress/head/google-tag-manager-head.html +0 -9
  147. package/src/templates/_partials/scripts/visual-website-optimizer.html +0 -5
  148. package/src/templates/index.html +0 -46
  149. /package/{src → public}/favicon.ico +0 -0
@@ -0,0 +1,178 @@
1
+ import { seasons } from "../data/seasons.js";
2
+ import { defaultSettings } from "../../siteconfig.js";
3
+ import gulpHandlebarsFileInclude from "gulp-handlebars-file-include";
4
+
5
+ export function getFileFromURL(url) {
6
+ return url.split('/').pop();
7
+ }
8
+
9
+ export function getActiveSeasons() {
10
+ const today = new Date();
11
+ const year = today.getFullYear();
12
+ const activeSeason = [];
13
+
14
+ for (const key in seasons) {
15
+ if (Object.prototype.hasOwnProperty.call(seasons, key)) {
16
+ const seasonName = key;
17
+ const dateRanges = seasons[key];
18
+ const startDate = new Date(`${Object.values(dateRanges)[0]}-${year}`);
19
+ const endDate = new Date(`${Object.values(dateRanges)[1]}-${year}`);
20
+
21
+ if (startDate < today && today < endDate) {
22
+ activeSeason.push(seasonName);
23
+ }
24
+ }
25
+ }
26
+
27
+ return activeSeason;
28
+ }
29
+
30
+ function handlebarsX(expression, context) {
31
+ const result = (function() {
32
+ try {
33
+ return new Function(expression);
34
+ }
35
+ catch (e) {
36
+ console.warn(
37
+ '• Expression: {{x \'' + expression + '\'}}\n'
38
+ + '• JS-Error: ', e, '\n'
39
+ + '• Context: ',
40
+ context
41
+ );
42
+ }
43
+ }).call(context);
44
+
45
+ return result;
46
+ }
47
+
48
+ export const handlebarsHelpers = [
49
+ // Run any js line
50
+ {
51
+ name: 'x',
52
+ fn: function(expression, options) {
53
+ return handlebarsX(expression, this, options);
54
+ }
55
+ },
56
+ // Run any js line and check if it is true
57
+ {
58
+ name: 'xif',
59
+ fn: function(expression, options) {
60
+ return handlebarsX(expression, this, options) ? options.fn(this) : options.inverse(this);
61
+ }
62
+ },
63
+ // Reverse array
64
+ {
65
+ name: 'reverseArray',
66
+ fn: function(expression) {
67
+ expression.reverse();
68
+ }
69
+ },
70
+ // Check if one var equals to another
71
+ {
72
+ name: 'equals',
73
+ fn: function(v1, v2, block) {
74
+ if (v1 === v2) {
75
+ return block.fn(this);
76
+ }
77
+ }
78
+ },
79
+ // Convert string to uppercase
80
+ {
81
+ name: 'uppercase',
82
+ fn: function(expression) {
83
+ return 'string' === typeof expression ? expression.toUpperCase() : '';
84
+ }
85
+ },
86
+ // Convert deferred styles string to links
87
+ {
88
+ name: 'deferredStyles',
89
+ fn: function(str) {
90
+ var urls = str.split(';'),
91
+ links = [];
92
+
93
+ urls.forEach(function(url) {
94
+ links.push('<link href="' + url + '" rel="stylesheet" type="text/css" />');
95
+ });
96
+
97
+ return links.join('');
98
+ }
99
+ },
100
+ // Format Phone number like type1 : xxx-xxx-xxxx OR type2 : (xxx) xxx-xxxx
101
+ {
102
+ name: 'formatPhoneNo',
103
+ fn: function(expression, type) {
104
+ var mask = /(\d{3})(\d{3})(\d{,4})?/;
105
+ var newValues;
106
+ if (type === 'type1') {
107
+ newValues = '$1-$2-$3';
108
+ } else {
109
+ newValues = '($1) $2-$3';
110
+ }
111
+ return expression.replace(mask, newValues);
112
+ }
113
+ },
114
+ // It will take the json object & variable name to assign the object & return it in the script tag
115
+ {
116
+ name: 'jsonVarScriptTag',
117
+ fn: function(json, variable) {
118
+ var check = (typeof json === 'object') && (typeof variable === 'string' && variable);
119
+ return check ? '<script>' + 'var ' + variable + '=' + JSON.stringify(json) + '</script>' : '';
120
+ }
121
+ },
122
+ // It will take & return json object
123
+ {
124
+ name: 'json',
125
+ fn: function(json) {
126
+ return JSON.stringify(json);
127
+ }
128
+ },
129
+ // Adding increment of 1 to value
130
+ {
131
+ name: 'inc',
132
+ fn: function(index) {
133
+ index++;
134
+ return index;
135
+ }
136
+ },
137
+ // Loop to go through and add each attribute defined in the attributes: {} object
138
+ {
139
+ name: 'addAttributes',
140
+ fn: function(obj) {
141
+ var output = '';
142
+ var ignoreKeys = Array.prototype.slice.call(arguments, 1, -1);
143
+
144
+ for (var key in obj.attributes) {
145
+ if (ignoreKeys.indexOf(key) === -1) {
146
+ if (typeof obj.attributes[key] !== 'object') {
147
+ output += key + '="' + obj.attributes[key] + '" ';
148
+ } else if (key === 'data') {
149
+ for (var dataKey in obj.attributes[key]) {
150
+ output += 'data-' + dataKey + '="' + obj.attributes[key][dataKey] + '" ';
151
+ }
152
+ } else if (key === 'aria') {
153
+ for (var ariaKey in obj.attributes[key]) {
154
+ output += 'aria-' + ariaKey + '="' + obj.attributes[key][ariaKey] + '" ';
155
+ }
156
+ }
157
+ }
158
+ }
159
+ return output.trim();
160
+ }
161
+ },
162
+ {
163
+ name: 'resolveAlias',
164
+ fn: function(input) {
165
+ if (input.includes('@')) {
166
+ const resolvedValue = defaultSettings.modBuild || '';
167
+ return input.replace('@', resolvedValue);
168
+ }
169
+ return input;
170
+ }
171
+ },
172
+ {
173
+ name: 'fileInclude',
174
+ fn: function(input) {
175
+ return gulpHandlebarsFileInclude(input);
176
+ }
177
+ }
178
+ ]
@@ -0,0 +1 @@
1
+ // an example SCSS file to import
@@ -0,0 +1,104 @@
1
+ "use strict";
2
+
3
+ var geoip2 = function () {
4
+ function e(e, t, r, n) {
5
+ this.successCallback = e, this.errorCallback = t, this.type = n;
6
+ }
7
+ var t = {};
8
+ e.prototype.returnSuccess = function (e) {
9
+ this.successCallback && "function" == typeof this.successCallback && this.successCallback(this.fillInObject(JSON.parse(e)));
10
+ }, e.prototype.returnError = function (e) {
11
+ this.errorCallback && "function" == typeof this.errorCallback && (e || (e = {
12
+ error: "Unknown error"
13
+ }), this.errorCallback(e));
14
+ };
15
+ var r = {
16
+ country: [["continent", "Object", "names", "Object"], ["country", "Object", "names", "Object"], ["registered_country", "Object", "names", "Object"], ["represented_country", "Object", "names", "Object"], ["traits", "Object"]],
17
+ city: [["city", "Object", "names", "Object"], ["continent", "Object", "names", "Object"], ["country", "Object", "names", "Object"], ["location", "Object"], ["postal", "Object"], ["registered_country", "Object", "names", "Object"], ["represented_country", "Object", "names", "Object"], ["subdivisions", "Array", 0, "Object", "names", "Object"], ["traits", "Object"]]
18
+ };
19
+ return e.prototype.fillInObject = function (e) {
20
+ for (var t = "country" === this.type ? r.country : r.city, n = 0; n < t.length; n++) for (var o = t[n], s = e, i = 0; i < o.length; i += 2) {
21
+ var c = o[i];
22
+ s[c] || (s[c] = "Object" === o[i + 1] ? {} : []), s = s[c];
23
+ }
24
+ try {
25
+ Object.defineProperty(e.continent, "continent_code", {
26
+ enumerable: !1,
27
+ get: function get() {
28
+ return this.code;
29
+ },
30
+ set: function set(e) {
31
+ this.code = e;
32
+ }
33
+ });
34
+ } catch (u) {
35
+ e.continent.code && (e.continent.continent_code = e.continent.code);
36
+ }
37
+ if ("country" !== this.type) try {
38
+ Object.defineProperty(e, "most_specific_subdivision", {
39
+ enumerable: !1,
40
+ get: function get() {
41
+ return this.subdivisions[this.subdivisions.length - 1];
42
+ },
43
+ set: function set(e) {
44
+ this.subdivisions[this.subdivisions.length - 1] = e;
45
+ }
46
+ });
47
+ } catch (u) {
48
+ e.most_specific_subdivision = e.subdivisions[e.subdivisions.length - 1];
49
+ }
50
+ return e;
51
+ }, e.prototype.getGeoIPResult = function () {
52
+ var e,
53
+ t = this,
54
+ r = new window.XMLHttpRequest(),
55
+ n = "https://geoip-js.com/geoip/v2.1/" + this.type + "/me?",
56
+ o = {
57
+ referrer: location.protocol + "//" + location.hostname
58
+ };
59
+ if (!this.alreadyRan) {
60
+ this.alreadyRan = 1;
61
+ for (e in o) o.hasOwnProperty(e) && o[e] && (n += e + "=" + encodeURIComponent(o[e]) + "&");
62
+ n = n.substring(0, n.length - 1), r.open("GET", n, !0), r.onload = function () {
63
+ if ("undefined" == typeof r.status || 200 === r.status) t.returnSuccess(r.responseText);else {
64
+ var e,
65
+ n = r.hasOwnProperty("contentType") ? r.contentType : r.getResponseHeader("Content-Type");
66
+ if (/json/.test(n) && r.responseText.length) try {
67
+ e = JSON.parse(r.responseText);
68
+ } catch (o) {
69
+ e = {
70
+ code: "HTTP_ERROR",
71
+ error: "The server returned a " + r.status + " status with an invalid JSON body."
72
+ };
73
+ } else e = r.responseText.length ? {
74
+ code: "HTTP_ERROR",
75
+ error: "The server returned a " + r.status + " status with the following body: " + r.responseText
76
+ } : {
77
+ code: "HTTP_ERROR",
78
+ error: "The server returned a " + r.status + " status but either the server did not return a body or this browser is a version of Internet Explorer that hides error bodies."
79
+ };
80
+ t.returnError(e);
81
+ }
82
+ }, r.ontimeout = function () {
83
+ t.returnError({
84
+ code: "HTTP_TIMEOUT",
85
+ error: "The request to the GeoIP2 web service timed out."
86
+ });
87
+ }, r.onerror = function () {
88
+ t.returnError({
89
+ code: "HTTP_ERROR",
90
+ error: "There was a network error receiving the response from the GeoIP2 web service."
91
+ });
92
+ }, r.send(null);
93
+ }
94
+ }, t.country = function (t, r, n) {
95
+ var o = new e(t, r, n, "country");
96
+ o.getGeoIPResult();
97
+ }, t.city = function (t, r, n) {
98
+ var o = new e(t, r, n, "city");
99
+ o.getGeoIPResult();
100
+ }, t.insights = function (t, r, n) {
101
+ var o = new e(t, r, n, "insights");
102
+ o.getGeoIPResult();
103
+ }, t;
104
+ }();
@@ -1,16 +1,16 @@
1
- <noscript id="deferred-styles">
2
- {{{deferredStyles deferredStyleUrls}}}
3
- </noscript>
4
- <script>
5
- var loadDeferredStyles = function() {
6
- var addStylesNode = document.getElementById("deferred-styles");
7
- var replacement = document.createElement("div");
8
- replacement.innerHTML = addStylesNode.textContent;
9
- document.body.appendChild(replacement)
10
- addStylesNode.parentElement.removeChild(addStylesNode);
11
- };
12
- var raf = requestAnimationFrame || mozRequestAnimationFrame ||
13
- webkitRequestAnimationFrame || msRequestAnimationFrame;
14
- if (raf) raf(function() { window.setTimeout(loadDeferredStyles, 0); });
15
- else window.addEventListener('load', loadDeferredStyles);
16
- </script>
1
+ <noscript id="deferred-styles">
2
+ {{{deferredStyles deferredStyleUrls}}}
3
+ </noscript>
4
+ <script>
5
+ const loadDeferredStyles = function() {
6
+ let addStylesNode = document.getElementById("deferred-styles");
7
+ let replacement = document.createElement("div");
8
+ replacement.innerHTML = addStylesNode.textContent;
9
+ document.body.appendChild(replacement)
10
+ addStylesNode.parentElement.removeChild(addStylesNode);
11
+ };
12
+ const raf = requestAnimationFrame || mozRequestAnimationFrame ||
13
+ webkitRequestAnimationFrame || msRequestAnimationFrame;
14
+ if (raf) raf(function() { window.setTimeout(loadDeferredStyles, 0); });
15
+ else window.addEventListener('load', loadDeferredStyles);
16
+ </script>
@@ -1,49 +1,47 @@
1
1
  <script>
2
- {{ fileInclude 'node_modules/mod-build/src/scripts/has-qs-params.js' }}
3
- {{ fileInclude 'node_modules/mod-build/src/scripts/url-cleaner.js' }}
4
- {{ fileInclude 'node_modules/mod-build/src/scripts/vendor/visual-website-optimizer.js' }}
5
-
6
- (function(VWO_HARD_TIMEOUT) {
7
- window._vwo_evq = window._vwo_evq || [];
8
- var queue = window._vwo_evq;
9
- for (var i = 0; i < queue.length; i++) {
10
- if (queue[i][0] === 'rD') {
11
- window.willRedirectionOccur = true;
12
- break;
13
- }
14
- }
15
- var _vwoOldPush = window._vwo_evq.push;
16
- window._vwo_evq.push = function() {
17
- var eventData = arguments[0],
18
- willRedirectionOccur;
19
- if (eventData[0] === 'rD') {
20
- willRedirectionOccur = eventData[1];
21
- // It will be set to true if a redirection is going to be done by VWO.
22
- window.willRedirectionOccurByVWO = willRedirectionOccur;
2
+ {{ fileInclude 'node_modules/mod-build/src/scripts/vendor/visual-website-optimizer.js' }}
3
+
4
+ (function(VWO_HARD_TIMEOUT) {
5
+ window._vwo_evq = window._vwo_evq || [];
6
+ var queue = window._vwo_evq;
7
+ for (var i = 0; i < queue.length; i++) {
8
+ if (queue[i][0] === 'rD') {
9
+ window.willRedirectionOccur = true;
10
+ break;
11
+ }
23
12
  }
24
- _vwoOldPush.apply(window._vwo_evq, [].slice.call(arguments));
25
- };
26
- var hardLimitTimedout = false;
27
-
28
- function tryNonVWOTracking() {
29
- if ((window._vwo_code && (window._vwo_code.finished() || window._vwo_code.libExecuted)) || hardLimitTimedout) {
30
- if (!window.willRedirectionOccurByVWO) {
31
- clearTimeout(hardLimitTimer);
32
- try {
33
- // flag to call Modalytics.initHeapVwo() method in site level js
34
- window.initHeapVwo = true;
35
- } catch (e) {}
36
- return;
13
+ var _vwoOldPush = window._vwo_evq.push;
14
+ window._vwo_evq.push = function() {
15
+ var eventData = arguments[0],
16
+ willRedirectionOccur;
17
+ if (eventData[0] === 'rD') {
18
+ willRedirectionOccur = eventData[1];
19
+ // It will be set to true if a redirection is going to be done by VWO.
20
+ window.willRedirectionOccurByVWO = willRedirectionOccur;
21
+ }
22
+ _vwoOldPush.apply(window._vwo_evq, [].slice.call(arguments));
23
+ };
24
+ var hardLimitTimedout = false;
25
+
26
+ function tryNonVWOTracking() {
27
+ if ((window._vwo_code && (window._vwo_code.finished() || window._vwo_code.libExecuted)) || hardLimitTimedout) {
28
+ if (!window.willRedirectionOccurByVWO) {
29
+ clearTimeout(hardLimitTimer);
30
+ try {
31
+ // flag to call Modalytics.initHeapVwo() method in site level js
32
+ window.initHeapVwo = true;
33
+ } catch (e) {}
34
+ return;
35
+ }
37
36
  }
37
+ setTimeout(function() {
38
+ tryNonVWOTracking()
39
+ }, 500)
38
40
  }
39
- setTimeout(function() {
40
- tryNonVWOTracking()
41
- }, 500)
42
- }
43
-
44
- var hardLimitTimer = setTimeout(function() {
45
- hardLimitTimedout = true;
46
- }, VWO_HARD_TIMEOUT);
47
- tryNonVWOTracking();
48
- })(5000 /*MAXIMUM TIME IN SECONDS IN WHICH CODE WILL EXECUTE ANYWAY*/ );
49
- </script>
41
+
42
+ var hardLimitTimer = setTimeout(function() {
43
+ hardLimitTimedout = true;
44
+ }, VWO_HARD_TIMEOUT);
45
+ tryNonVWOTracking();
46
+ })(5000 /*MAXIMUM TIME IN SECONDS IN WHICH CODE WILL EXECUTE ANYWAY*/ );
47
+ </script>
@@ -0,0 +1,70 @@
1
+ <!-- an example of the head component for v4.0.0 -->
2
+ <meta charset="UTF-8" />
3
+ <link rel="icon" type="image/svg+xml" href="/{{#if page.headConfig.faviconPath}}{{page.headConfig.faviconPath}}{{else}}favicon.svg"{{/if}} />
4
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
5
+
6
+ <!-- assets links afterBegin -->
7
+ {{#if page.headConfig.useModAnalytics}}
8
+ <script src="https://{{this.resourceDomain}}/quote/resources/mod-alytics/modalytics.min.js" {{#if page.headConfig.deferModAnalytics}}defer{{/if}} {{#if page.headConfig.asyncModAnalytics}}async{{/if}}></script>
9
+ {{/if}}
10
+
11
+ <!-- Include vwo setup -->
12
+ {{#xif "this.page.headConfig.vwoSetup.vwoPathArray.indexOf(this.path) > -1" }}
13
+ <link rel="preconnect" href="https://dev.visualwebsiteoptimizer.com">
14
+ <!-- Do not double hit our analytical resources (Heap/Google Analytics) if the page is going to be redirected by a VWO a/b test-->
15
+ <script src="{{ resolveAlias '@/scripts/vendor/visual-website-optimizer.js'}}"></script>
16
+ {{else}}
17
+ <script src="{{ resolveAlias '@/scripts/url-cleaner.js'}}"></script>
18
+ {{/xif}}
19
+
20
+ {{#unless page.headConfig.disableRobots}}
21
+ <meta name="robots" content="{{#if page.headConfig.robotsCsv}}{{page.headConfig.robotsCsv}}{{else}}noindex,nofollow{{/if}}"/>
22
+ {{/unless}}
23
+
24
+ {{#unless page.headConfig.disableOgTags}}
25
+ <meta property="og:title" content="{{page.headConfig.title}}" />
26
+ <meta property="og:description" content="{{page.headConfig.description}}" />
27
+ {{/unless}}
28
+
29
+ <meta name="description" property="description" content="{{page.headConfig.description}}" />
30
+ <meta name="keywords" property="keywords" content="{{page.headConfig.keywords}}" />
31
+
32
+ <!-- preconnect google fonts -->
33
+ <link rel="preconnect" href="https://fonts.googleapis.com">
34
+ <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
35
+ {{#if page.headConfig.preConnect}}
36
+ {{#each page.headConfig.preConnect}}
37
+ <link
38
+ {{#if this.rel}}rel="{{this.rel}}"{{/if}}
39
+ {{#if this.href}}href="{{this.href}}"{{/if}}
40
+ {{#if this.as}}as="{{this.as}}"{{/if}}
41
+ {{#if this.crossorigin}}crossorigin="{{this.crossorigin}}"{{/if}}
42
+ {{#if this.media}}media="{{this.media}}"{{/if}}
43
+ {{#if this.type}}type="{{this.type}}"{{/if}}
44
+ {{#if this.fetchpriority}}fetchpriority="{{this.fetchpriority}}"{{/if}}
45
+ >
46
+ {{/each}}
47
+ {{/if}}
48
+
49
+ <!-- site title -->
50
+ <title>
51
+ {{#if page.headConfig.inverseTitle}}
52
+ {{#unless page.headConfig.hideTitleCompanyName}}{{company_name}} | {{/unless}}
53
+ {{#if this.pageTitle}}
54
+ {{this.pageTitle}}
55
+ {{else}}
56
+ {{#if page.headConfig.title}}
57
+ {{page.headConfig.title}}
58
+ {{/if}}
59
+ {{/if}}
60
+ {{else}}
61
+ {{#if this.pageTitle}}
62
+ {{this.pageTitle}}
63
+ {{else}}
64
+ {{#if page.headConfig.title}}
65
+ {{page.headConfig.title}}
66
+ {{/if}}
67
+ {{/if}}
68
+ {{#unless page.headConfig.hideTitleCompanyName}} | {{company_name}}{{/unless}}
69
+ {{/if}}
70
+ </title>
package/tasks/clean.js ADDED
@@ -0,0 +1,13 @@
1
+ import { deleteSync } from 'del';
2
+ import { defaultSettings } from '../siteconfig';
3
+
4
+ const clean = (done) => {
5
+ deleteSync([
6
+ `src/${defaultSettings.tmpFolder}/`,
7
+ `${defaultSettings.distFolder}/`
8
+ ]);
9
+ console.log('clean finished');
10
+ done();
11
+ };
12
+
13
+ export default clean;
@@ -0,0 +1,107 @@
1
+ import { defaultSettings, siteData } from '../siteconfig.js'
2
+ import { templateData } from '../template.js';
3
+ import axios from 'axios';
4
+ import { createWriteStream } from 'node:fs';
5
+ import * as stream from 'node:stream';
6
+ import { promisify } from 'node:util';
7
+ import fs from 'node:fs';
8
+
9
+ function streamToDestination(inputPath, destPath, fileName) {
10
+ const finished = promisify(stream.finished);
11
+ const url = `https://${defaultSettings.resourceDomain}${inputPath}`;
12
+
13
+ return new Promise(resolve => {
14
+ if (!fs.existsSync(`src/${destPath}`)) {
15
+ fs.mkdirSync(`src/${destPath}`, { recursive: true });
16
+ }
17
+
18
+ // if file exists, do not create it again
19
+ if (fs.existsSync(`src/${destPath}${fileName}`)) {
20
+ resolve();
21
+ } else {
22
+ const writer = createWriteStream(`src/${destPath}${fileName}`);
23
+ const options = {
24
+ url,
25
+ method: 'get',
26
+ responseType: 'stream',
27
+ };
28
+
29
+ axios(options).then(resp => {
30
+ if (resp.status !== 200) {
31
+ throw new Error(`${resp.status}: Error while fetching ${url}`);
32
+ }
33
+ console.log('axios grab-cdn running');
34
+ resp.data.pipe(writer);
35
+ console.log(`src/${destPath}${fileName} created...`);
36
+ return finished(writer);
37
+ }).then(() => {
38
+ resolve();
39
+ }).catch(error => {
40
+ console.error(error);
41
+ resolve();
42
+ });
43
+ }
44
+ });
45
+ }
46
+
47
+ export default async function(done) {
48
+ const { nodeEnv, isLocal } = defaultSettings;
49
+ const { isQSPage, isWhiteLabel, domain } = siteData;
50
+ const { page } = templateData();
51
+ const { themeFile } = page;
52
+ const isModWhiteLabel = isWhiteLabel && !isQSPage
53
+ const domainHasModernize = domain.indexOf('modernize') > -1;
54
+
55
+ let externalResources;
56
+ // listing of Static Resources sub-path and site destination paths
57
+ // key: inputPath, value: destPath
58
+
59
+ externalResources = {
60
+ '/quote/resources/mod-site/templates/scripts/trusted-form.html': ['/templates/scripts/', 'trusted-form.html']
61
+ };
62
+
63
+ // grab footer modals and place under the resources
64
+ Object.assign(externalResources, {
65
+ '/quote/resources/shared-resources/templates/modals/about/': ['/resources/templates/modals/about/', 'index.html'],
66
+ '/quote/resources/shared-resources/templates/modals/privacy/': ['/resources/templates/modals/privacy/', 'index.html'],
67
+ '/quote/resources/shared-resources/templates/modals/terms/': ['/resources/templates/modals/terms/', 'index.html'],
68
+ '/quote/resources/shared-resources/templates/modals/contact-us/': ['/resources/templates/modals/contact-us/', 'index.html'],
69
+ '/quote/resources/shared-resources/templates/modals/faq/': ['/resources/templates/modals/faq/', 'index.html']
70
+ })
71
+
72
+ Object.assign(externalResources, {'/quote/resources/mod-site/templates/scripts/jornaya.html': ['/templates/scripts/', 'jornaya.html']});
73
+
74
+ if (isModWhiteLabel || domainHasModernize) {
75
+ Object.assign(externalResources, {'/quote/resources/mod-site/templates/scripts/recaptcha.html': ['/templates/scripts/', 'recaptcha.html']});
76
+ }
77
+
78
+ // local dev files
79
+ const remoteFilesForLocalDev = {
80
+ '/quote/resources/mod-site/scripts/vendor/maxmind-geoip2.js': ['/temp/scripts/', 'maxmind-geoip2.js']
81
+ };
82
+
83
+ // theme JSON
84
+ if (isQSPage) {
85
+ Object.assign(externalResources, {
86
+ [`/quote/resources/data/themes/${themeFile}.json`]: ['/data/', 'theme.json']
87
+ });
88
+ }
89
+
90
+ if (!nodeEnv) {
91
+ throw new Error('Missing environment variables. Did you start with gulp instead of npm run...?');
92
+ }
93
+
94
+ // only save modform/utils if its local development
95
+ if (isLocal) {
96
+ externalResources = { ...externalResources, ...remoteFilesForLocalDev };
97
+ }
98
+
99
+ const filesPromiseMap = Object.keys(externalResources).map(async key => {
100
+ const destinationPath = externalResources[key][0];
101
+ const fileName = externalResources[key][1];
102
+ await streamToDestination(key, destinationPath, fileName);
103
+ });
104
+
105
+ await Promise.all(filesPromiseMap);
106
+ done();
107
+ };