mod-build 4.0.102-beta.1 → 4.0.103
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 +2 -2
- package/public/resources/scripts/abandonment/abandonment-a4bbb36fbc8ed64042b8.min.js +2 -0
- package/public/resources/scripts/abandonment/abandonment.min.js +2 -0
- package/public/resources/scripts/callrail/callrail-14011d73b50a928de4b4.min.js +2 -0
- package/public/resources/scripts/callrail/callrail.min.js +2 -0
- package/public/resources/scripts/footer/footer-component-46dc0d7ca6af4fc3b76b.min.js +2 -0
- package/public/resources/scripts/footer/footer-component.min.js +2 -0
- package/public/resources/scripts/geolocation/geolocation.min.js +2 -0
- package/public/resources/scripts/helpers/addVWOTestQueryParam.min.js +2 -0
- package/public/resources/scripts/helpers/addVWOTestQueryParam.min.js.map +1 -0
- package/public/resources/scripts/helpers/additionalOpts.min.js +2 -0
- package/public/resources/scripts/helpers/additionalOpts.min.js.map +1 -0
- package/public/resources/scripts/helpers/calls-only.min.js +2 -0
- package/public/resources/scripts/helpers/calls-only.min.js.map +1 -0
- package/public/resources/scripts/helpers/getPhoneAssignmentData.min.js +2 -0
- package/public/resources/scripts/helpers/getPhoneAssignmentData.min.js.map +1 -0
- package/public/resources/scripts/helpers/initNumericOnlyFields.min.js +2 -0
- package/public/resources/scripts/helpers/initNumericOnlyFields.min.js.map +1 -0
- package/public/resources/scripts/helpers/initQSForm.min.js +2 -0
- package/public/resources/scripts/helpers/initQSForm.min.js.map +1 -0
- package/public/resources/scripts/helpers/initQuadTransform.min.js +2 -0
- package/public/resources/scripts/helpers/initQuadTransform.min.js.map +1 -0
- package/public/resources/scripts/helpers/isZipCodeValid.min.js +2 -0
- package/public/resources/scripts/helpers/isZipCodeValid.min.js.map +1 -0
- package/public/resources/scripts/helpers/observeVWOVariation.min.js +2 -0
- package/public/resources/scripts/helpers/observeVWOVariation.min.js.map +1 -0
- package/public/resources/scripts/helpers/opts.min.js +2 -0
- package/public/resources/scripts/helpers/opts.min.js.map +1 -0
- package/public/resources/scripts/jornaya.hbs +35 -0
- package/public/resources/scripts/jornaya.html +35 -0
- package/public/resources/scripts/mod-alytics/modalytics-be44027508c0438f6709.min.js +2 -0
- package/public/resources/scripts/mod-alytics/modalytics.min.js +2 -0
- package/public/resources/scripts/mod-form/form/contractor-0918337caf3dfede1609.min.js +2 -0
- package/public/resources/scripts/mod-form/form/contractor.min.js +2 -0
- package/public/resources/scripts/mod-form/form/homeowner-19a121b0e596042326f4.min.js +2 -0
- package/public/resources/scripts/mod-form/form/homeowner.min.js +2 -0
- package/public/resources/scripts/mod-utils/modutils-bc275eb41af515f626ef.min.js +2 -0
- package/public/resources/scripts/mod-utils/modutils.min.js +2 -0
- package/public/resources/scripts/trusted-form.hbs +38 -0
- package/public/resources/scripts/trusted-form.html +38 -0
- package/public/resources/styles/components/abandonment/abandonment-8a673f060817db6cb7dc.min.css +1 -0
- package/public/resources/styles/components/abandonment/abandonment.min.css +1 -0
- package/public/resources/styles/components/footer/mod-footer-d233fa64b6c8297c70ec.min.css +1 -0
- package/public/resources/styles/components/footer/mod-footer.min.css +1 -0
- package/public/resources/styles/components/footer/qs-footer-926e67c28d10c729db46.min.css +1 -0
- package/public/resources/styles/components/footer/qs-footer.min.css +1 -0
- package/src/resources/templates/modals/privacy/index.hbs +88 -89
- package/src/resources/templates/modals/privacy/index.html +88 -89
- package/src/resources/templates/modals/terms/index.hbs +8 -7
- package/src/resources/templates/modals/terms/index.html +8 -7
- package/src/scripts/globals.js +1 -3
- package/src/scripts/plugins.js +0 -3
- package/tasks/get-default-trade-questions.js +121 -157
- package/tasks/templates.js +2 -4
- package/gulp-tasks/add-path-subdirectories.js +0 -34
- package/gulp-tasks/build-stat.js +0 -9
- package/gulp-tasks/build.js +0 -28
- package/gulp-tasks/cache-bust.js +0 -19
- package/gulp-tasks/check-seasonal-variations.js +0 -21
- package/gulp-tasks/clean.js +0 -10
- package/gulp-tasks/combine-files.js +0 -7
- package/gulp-tasks/compile.js +0 -44
- package/gulp-tasks/copy-files-to-build-path.js +0 -8
- package/gulp-tasks/copy-fonts.js +0 -6
- package/gulp-tasks/copy-json.js +0 -6
- package/gulp-tasks/copy-resources-to-dist.js +0 -6
- package/gulp-tasks/copy-videos.js +0 -6
- package/gulp-tasks/extras.js +0 -22
- package/gulp-tasks/grab-cdn.js +0 -74
- package/gulp-tasks/grab-form-helpers.js +0 -55
- package/gulp-tasks/grab-global-images.js +0 -121
- package/gulp-tasks/grab-images.js +0 -79
- package/gulp-tasks/grab-shared-components.js +0 -46
- package/gulp-tasks/grab-shared-scripts.js +0 -275
- package/gulp-tasks/grab-theme-json.js +0 -24
- package/gulp-tasks/grab-tooltips-json.js +0 -33
- package/gulp-tasks/js-lint-husky.js +0 -35
- package/gulp-tasks/js-lint.js +0 -24
- package/gulp-tasks/minify.js +0 -131
- package/gulp-tasks/sass-lint.js +0 -15
- package/gulp-tasks/serve.js +0 -74
- package/gulp-tasks/settings.js +0 -22
- package/gulp-tasks/styles.js +0 -42
- package/gulp-tasks/tasks.js +0 -475
- package/gulp-tasks/templates.js +0 -288
- package/src/data/footer.js +0 -119
- package/src/scripts/default/additional-assets.js +0 -60
- package/src/scripts/default/rage-clicking.js +0 -54
- package/src/scripts/default/show-utility-providers.js +0 -28
- package/src/scripts/url-cleaner.js +0 -8
- package/src/scripts/vendor/google-tag-manager-head.js +0 -6
- package/src/scripts/vendor/heap-addeventproperties-identify.js +0 -262
- package/src/scripts/vendor/heap-tracking.js +0 -9
- package/src/styles/partials/_contact-us.scss +0 -196
- package/src/styles/partials/_google-address-autocomplete.scss +0 -52
- package/src/styles/partials/_mixins.scss +0 -39
- package/src/styles/partials/_modal-pages.scss +0 -125
- package/src/styles/partials/_modernize-colors.scss +0 -128
- package/src/styles/partials/_qs-footer.scss +0 -68
- package/src/styles/partials/_quote-footer-v1.scss +0 -79
- package/src/styles/partials/_quote-footer-v2.scss +0 -64
- package/src/styles/partials/_quote-footer-v3.scss +0 -65
- package/src/templates/_partials/scripts/deferred-styles.html +0 -16
- package/src/templates/_partials/scripts/heap-bundle.html +0 -5
- package/src/templates/_partials/scripts/heap.html +0 -4
- package/src/templates/_partials/scripts/utm-params.html +0 -9
- package/src/templates/components/qs-footer.html +0 -55
- package/src/templates/components/quote-footer-v1.html +0 -148
- package/src/templates/components/quote-footer-v2.html +0 -169
- /package/tasks/{addSeasonalchanges.js → add-seasonal-changes.js} +0 -0
- /package/tasks/{setupDevOpsTrackingId.js → setup-dev-ops-tracking-id.js} +0 -0
package/src/scripts/plugins.js
CHANGED
|
@@ -3,7 +3,6 @@ import path from "node:path";
|
|
|
3
3
|
import merge from "lodash.merge";
|
|
4
4
|
import gulpHandlebarsFileInclude from "gulp-handlebars-file-include";
|
|
5
5
|
import { defaultSettings } from "../data/config.js";
|
|
6
|
-
import footer from '../data/footer.js';
|
|
7
6
|
import { handlebarsHelpers } from "./utils.js";
|
|
8
7
|
|
|
9
8
|
/**
|
|
@@ -102,7 +101,6 @@ export const updateConfig = async (config) => {
|
|
|
102
101
|
|
|
103
102
|
let mergedConfig = {
|
|
104
103
|
...config,
|
|
105
|
-
...footer(config),
|
|
106
104
|
...{ isLocal, nodeEnv, buildPath }
|
|
107
105
|
};
|
|
108
106
|
|
|
@@ -151,7 +149,6 @@ export const updateHandlebarsOnWatch = async (config) => {
|
|
|
151
149
|
|
|
152
150
|
let mergedConfig = {
|
|
153
151
|
...config,
|
|
154
|
-
...footer(config),
|
|
155
152
|
...{ isLocal, nodeEnv, buildPath }
|
|
156
153
|
};
|
|
157
154
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import merge from 'lodash.merge';
|
|
3
3
|
import { defaultSettings } from '../src/data/config.js';
|
|
4
4
|
|
|
5
|
-
function resolveRefs(value, root, refChain = new Set()) {
|
|
5
|
+
export function resolveRefs(value, root = value, refChain = new Set()) {
|
|
6
6
|
if (value === null || typeof value !== 'object') {
|
|
7
7
|
return value;
|
|
8
8
|
}
|
|
@@ -33,186 +33,150 @@ function resolveRefs(value, root, refChain = new Set()) {
|
|
|
33
33
|
return resolved;
|
|
34
34
|
}
|
|
35
35
|
|
|
36
|
-
function
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
36
|
+
function mergeQuestionFields(fields, defaultFields, {
|
|
37
|
+
legendAttributes,
|
|
38
|
+
optionFieldTypes,
|
|
39
|
+
errorMessages
|
|
40
|
+
}) {
|
|
41
|
+
let defaultOptions = [];
|
|
42
|
+
let defaultLegend = {};
|
|
43
|
+
defaultFields.forEach((defaultField) => {
|
|
44
|
+
defaultOptions = defaultField.options;
|
|
45
|
+
defaultLegend = defaultField.legend;
|
|
46
|
+
|
|
47
|
+
if (defaultLegend && legendAttributes) {
|
|
48
|
+
defaultLegend.attributes = {
|
|
49
|
+
...defaultLegend.attributes,
|
|
50
|
+
...legendAttributes
|
|
51
|
+
};
|
|
51
52
|
}
|
|
52
|
-
}
|
|
53
|
-
}
|
|
53
|
+
});
|
|
54
54
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
55
|
+
fields.forEach((field) => {
|
|
56
|
+
if (field.legend) {
|
|
57
|
+
field.legend = merge(defaultLegend, field.legend);
|
|
58
|
+
} else {
|
|
59
|
+
field.legend = defaultLegend;
|
|
60
|
+
}
|
|
59
61
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
62
|
+
if (field.remove) {
|
|
63
|
+
if (field.remove.includes('all')) {
|
|
64
|
+
defaultOptions = [];
|
|
65
|
+
} else {
|
|
66
|
+
defaultOptions = defaultOptions.filter((_, index) => !field.remove.includes(index));
|
|
65
67
|
}
|
|
68
|
+
}
|
|
66
69
|
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
defaultQuestionLegend = defaultField.legend;
|
|
70
|
+
if (field.move) {
|
|
71
|
+
// field.move will look like [{from: 0, to: 1}]
|
|
72
|
+
// remove the option at from and insert it at to, in listed order
|
|
73
|
+
field.move.forEach((move) => {
|
|
74
|
+
const fromIndex = move.from;
|
|
75
|
+
const toIndex = move.to;
|
|
76
|
+
const fromOption = defaultOptions.splice(fromIndex, 1);
|
|
77
|
+
defaultOptions.splice(toIndex, 0, fromOption[0]);
|
|
76
78
|
});
|
|
79
|
+
}
|
|
77
80
|
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
} else {
|
|
82
|
-
field.legend = defaultQuestionLegend;
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
if (field && field.remove) {
|
|
86
|
-
if (field.remove.includes('all')) {
|
|
87
|
-
defaultStepOptions = [];
|
|
88
|
-
} else {
|
|
89
|
-
defaultStepOptions = defaultStepOptions.filter((_, i) => !field.remove.includes(i));
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
if (field && field.move) {
|
|
94
|
-
// field.move will look like [{from: 0, to: 1}]
|
|
95
|
-
// we need to remove option at from index and insert at to index
|
|
96
|
-
field.move.forEach((move) => {
|
|
97
|
-
const fromIndex = move.from;
|
|
98
|
-
const toIndex = move.to;
|
|
99
|
-
const fromOption = defaultStepOptions.splice(fromIndex, 1);
|
|
100
|
-
defaultStepOptions.splice(toIndex, 0, fromOption[0]);
|
|
101
|
-
});
|
|
102
|
-
}
|
|
81
|
+
if (!optionFieldTypes.includes(field.fieldType)) {
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
103
84
|
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
}
|
|
85
|
+
if (!field.errorMessage && errorMessages[field.fieldType]) {
|
|
86
|
+
field.errorMessage = errorMessages[field.fieldType];
|
|
87
|
+
}
|
|
108
88
|
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
}
|
|
116
|
-
merge(defaultStepOptions[option.update], option);
|
|
117
|
-
} else {
|
|
118
|
-
if (typeof option.insertAt === 'number') {
|
|
119
|
-
defaultStepOptions.splice(option.insertAt, 0, option);
|
|
120
|
-
} else {
|
|
121
|
-
defaultStepOptions.push(option);
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
});
|
|
89
|
+
if (Array.isArray(field.options)) {
|
|
90
|
+
field.options.forEach((option) => {
|
|
91
|
+
if (typeof option.update === 'number') {
|
|
92
|
+
if (option.attributes?.checked === false) {
|
|
93
|
+
delete option.attributes.checked;
|
|
94
|
+
delete defaultOptions[option.update]?.attributes?.checked;
|
|
125
95
|
}
|
|
126
|
-
|
|
96
|
+
merge(defaultOptions[option.update], option);
|
|
97
|
+
} else if (typeof option.insertAt === 'number') {
|
|
98
|
+
defaultOptions.splice(option.insertAt, 0, option);
|
|
127
99
|
} else {
|
|
128
|
-
|
|
129
|
-
if (typeof field.update === 'number') {
|
|
130
|
-
merge(defaultStepFields[field.update], field);
|
|
131
|
-
} else {
|
|
132
|
-
if (typeof field.insertAt === 'number') {
|
|
133
|
-
defaultStepFields.splice(field.insertAt, 0, field);
|
|
134
|
-
} else {
|
|
135
|
-
defaultStepFields.push(field);
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
field = defaultStepFields;
|
|
100
|
+
defaultOptions.push(option);
|
|
141
101
|
}
|
|
142
102
|
});
|
|
103
|
+
}
|
|
104
|
+
field.options = defaultOptions;
|
|
105
|
+
});
|
|
106
|
+
}
|
|
143
107
|
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
}
|
|
108
|
+
export function mergeDefaultTradeQuestionsIntoItems(items, steps, options = {}) {
|
|
109
|
+
if (!Array.isArray(items) || !steps || typeof steps !== 'object') {
|
|
110
|
+
return;
|
|
111
|
+
}
|
|
149
112
|
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
113
|
+
const mergeOptions = {
|
|
114
|
+
legendAttributes: options.legendAttributes,
|
|
115
|
+
optionFieldTypes: options.optionFieldTypes || ['radio', 'checkbox-group'],
|
|
116
|
+
errorMessages: {
|
|
117
|
+
radio: 'Professionals need this info to generate a quote.',
|
|
118
|
+
'checkbox-group': 'Please select at least one option.',
|
|
119
|
+
...options.errorMessages
|
|
120
|
+
}
|
|
121
|
+
};
|
|
158
122
|
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
123
|
+
items.forEach((item) => {
|
|
124
|
+
const stepName = item.attributes?.data?.['step-name'];
|
|
125
|
+
const defaultStep = steps[stepName];
|
|
126
|
+
if (!defaultStep) {
|
|
127
|
+
return;
|
|
128
|
+
}
|
|
164
129
|
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
}
|
|
130
|
+
if (!item.stepContent) {
|
|
131
|
+
item.stepContent = {};
|
|
132
|
+
}
|
|
133
|
+
if (!item.stepContent.fields) {
|
|
134
|
+
item.stepContent.fields = [];
|
|
135
|
+
}
|
|
172
136
|
|
|
173
|
-
|
|
174
|
-
if (!field.errorMessage) {
|
|
175
|
-
field.errorMessage = 'Professionals need this info to generate a quote.';
|
|
176
|
-
}
|
|
137
|
+
mergeQuestionFields(item.stepContent.fields, defaultStep.fields, mergeOptions);
|
|
177
138
|
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
delete option.attributes.checked;
|
|
183
|
-
delete defaultStepOptions[option.update].attributes.checked;
|
|
184
|
-
}
|
|
185
|
-
merge(defaultExtraQuestionOptions[option.update], option);
|
|
186
|
-
} else {
|
|
187
|
-
if (typeof option.insertAt === 'number') {
|
|
188
|
-
defaultExtraQuestionOptions.splice(option.insertAt, 0, option);
|
|
189
|
-
} else {
|
|
190
|
-
defaultExtraQuestionOptions.push(option);
|
|
191
|
-
}
|
|
192
|
-
}
|
|
193
|
-
});
|
|
194
|
-
}
|
|
195
|
-
field.options = defaultExtraQuestionOptions;
|
|
196
|
-
} else {
|
|
197
|
-
if (field && Array.isArray(field) && field.length) {
|
|
198
|
-
if (typeof field.update === 'number') {
|
|
199
|
-
merge(defaultExtraQuestionFields[field.update], field);
|
|
200
|
-
} else {
|
|
201
|
-
if (typeof field.insertAt === 'number') {
|
|
202
|
-
defaultExtraQuestionFields.splice(field.insertAt, 0, field);
|
|
203
|
-
} else {
|
|
204
|
-
defaultExtraQuestionFields.push(field);
|
|
205
|
-
}
|
|
206
|
-
}
|
|
207
|
-
}
|
|
208
|
-
field = defaultExtraQuestionFields;
|
|
209
|
-
}
|
|
210
|
-
});
|
|
139
|
+
const extraQuestionBlock = item.stepContent.extraQuestionBlock;
|
|
140
|
+
if (extraQuestionBlock) {
|
|
141
|
+
if (!extraQuestionBlock.fields) {
|
|
142
|
+
extraQuestionBlock.fields = [];
|
|
211
143
|
}
|
|
144
|
+
mergeQuestionFields(
|
|
145
|
+
extraQuestionBlock.fields,
|
|
146
|
+
defaultStep.extraQuestionBlock.fields,
|
|
147
|
+
mergeOptions
|
|
148
|
+
);
|
|
212
149
|
}
|
|
213
150
|
});
|
|
214
151
|
}
|
|
215
152
|
|
|
153
|
+
export function mergeDefaultTradeQuestionsConfigOnSteps(config, steps, options) {
|
|
154
|
+
if (!config || typeof config !== 'object') return;
|
|
155
|
+
|
|
156
|
+
if (config.steps && typeof config.steps === 'object' && config.steps.items) {
|
|
157
|
+
// cloning steps to keep multiple steps: {} objects independent
|
|
158
|
+
const clonedSteps = JSON.parse(JSON.stringify(steps));
|
|
159
|
+
mergeDefaultTradeQuestionsConfig(config, clonedSteps, options);
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
for (const key in config) {
|
|
163
|
+
if (config.hasOwnProperty(key)) {
|
|
164
|
+
const value = config[key];
|
|
165
|
+
if (typeof value === 'object' && value !== null) {
|
|
166
|
+
mergeDefaultTradeQuestionsConfigOnSteps(value, steps, options);
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
export function mergeDefaultTradeQuestionsConfig(config, steps, options) {
|
|
173
|
+
if (!config || !config.steps || !config.steps.items || !Array.isArray(config.steps.items)) {
|
|
174
|
+
return;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
mergeDefaultTradeQuestionsIntoItems(config.steps.items, steps, options);
|
|
178
|
+
}
|
|
179
|
+
|
|
216
180
|
export default async function(config) {
|
|
217
181
|
if (config.useStepsConfig) {
|
|
218
182
|
console.log('Starting get-default-trade-questions...');
|
package/tasks/templates.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import footer from '../src/data/footer.js';
|
|
2
1
|
import fs from 'node:fs';
|
|
3
2
|
import merge from 'lodash.merge';
|
|
4
3
|
import cloneDeep from 'lodash.clonedeep';
|
|
@@ -6,8 +5,8 @@ import { createRetryFetch } from '../src/scripts/retry-fetch.js';
|
|
|
6
5
|
|
|
7
6
|
import { defaultSettings } from '../src/data/config.js';
|
|
8
7
|
|
|
9
|
-
import setupDevOpsTrackingId from './
|
|
10
|
-
import addSeasonalchanges from './
|
|
8
|
+
import setupDevOpsTrackingId from './setup-dev-ops-tracking-id.js';
|
|
9
|
+
import addSeasonalchanges from './add-seasonal-changes.js';
|
|
11
10
|
|
|
12
11
|
const fetchWithRetryDefault = createRetryFetch();
|
|
13
12
|
const fetchWithRetryTcpa = createRetryFetch();
|
|
@@ -272,7 +271,6 @@ export default async function(config) {
|
|
|
272
271
|
|
|
273
272
|
let tempConfig = {
|
|
274
273
|
...config,
|
|
275
|
-
...footer(config),
|
|
276
274
|
...{ isLocal, nodeEnv, assetsPath, buildPath },
|
|
277
275
|
};
|
|
278
276
|
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
var replace = require('gulp-replace');
|
|
2
|
-
|
|
3
|
-
module.exports = function(gulp, gulpPlugins, siteSettings, siteData) {
|
|
4
|
-
return function() {
|
|
5
|
-
const isPathSubdirectory = siteData.siteData && siteData.siteData.pathSubdirectory || siteData && siteData.pathSubdirectory;
|
|
6
|
-
if (isPathSubdirectory) {
|
|
7
|
-
const pathSubdirectory = isPathSubdirectory;
|
|
8
|
-
|
|
9
|
-
return gulp.src(siteSettings.distFolder + '/**/*.html')
|
|
10
|
-
.pipe(replace(/(href="favicon.ico")/g, function(match, path) {
|
|
11
|
-
return `href="${pathSubdirectory}favicon.ico"`;
|
|
12
|
-
}))
|
|
13
|
-
.pipe(replace(/((src=")(images|scripts|shared-components)\/[^"]+")/g, function(match, path) {
|
|
14
|
-
if (path.startsWith('src="images') || path.startsWith('src="scripts') || path.startsWith('src="shared-components') || path.startsWith('src="accessible-components')) {
|
|
15
|
-
return `src="${pathSubdirectory}${path.slice(5)}`;
|
|
16
|
-
}
|
|
17
|
-
return match;
|
|
18
|
-
}))
|
|
19
|
-
.pipe(replace(/((srcset="images)\/[^"]+")/g, function(match, path) {
|
|
20
|
-
if (path.startsWith('srcset="images')) {
|
|
21
|
-
return `srcset="${pathSubdirectory}${path.slice(8)}`;
|
|
22
|
-
}
|
|
23
|
-
return match;
|
|
24
|
-
}))
|
|
25
|
-
.pipe(replace(/((href=")(images|styles|shared-components)\/[^"]+")/g, function(match, path) {
|
|
26
|
-
if (path.startsWith('href="images') || path.startsWith('href="styles') || path.startsWith('href="shared-components') || path.startsWith('src="accessible-components')) {
|
|
27
|
-
return `href="${pathSubdirectory}${path.slice(6)}`;
|
|
28
|
-
}
|
|
29
|
-
return match;
|
|
30
|
-
}))
|
|
31
|
-
.pipe(gulp.dest(siteSettings.distFolder));
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
};
|
package/gulp-tasks/build-stat.js
DELETED
package/gulp-tasks/build.js
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
module.exports = function(gulp, gulpPlugins, siteSettings, siteData) {
|
|
2
|
-
var runSequence = require('run-sequence');
|
|
3
|
-
|
|
4
|
-
return function() {
|
|
5
|
-
var sequenceOpts;
|
|
6
|
-
|
|
7
|
-
if (siteData.useTypescript) {
|
|
8
|
-
sequenceOpts = ['clean', 'grab-cdn', 'grab-shared-components', 'grab-shared-scripts', 'grab-form-helpers', 'templates', 'styles', 'compile-prod', 'js-lint', 'html-min', 'css-min', 'js-min', 'img-min', 'extras', 'cache-bust', 'add-path-subdirectories', 'copy-resources-to-dist', 'build-stat'];
|
|
9
|
-
} else if (siteData.isWhiteLabel) {
|
|
10
|
-
if (siteData.isQSPage) {
|
|
11
|
-
sequenceOpts = ['clean', 'grab-cdn', 'grab-shared-components', 'grab-shared-scripts', 'grab-form-helpers', 'templates', 'styles', 'copy-videos', 'grab-theme-json', 'combine-files', 'grab-images', 'copy-json', 'js-lint', 'html-min', 'css-min', 'js-min', 'img-min', 'extras', 'copy-files-to-build-path', 'cache-bust', 'add-path-subdirectories', 'grab-tooltips-json', 'copy-resources-to-dist', 'build-stat'];
|
|
12
|
-
} else {
|
|
13
|
-
sequenceOpts = ['clean', 'grab-cdn', 'grab-shared-components', 'grab-shared-scripts', 'grab-form-helpers', 'templates', 'styles', 'copy-videos', 'combine-files', 'grab-images', 'js-lint', 'html-min','grab-global-images', 'css-min', 'js-min', 'img-min', 'extras', 'cache-bust', 'add-path-subdirectories', 'grab-tooltips-json', 'copy-resources-to-dist', 'build-stat'];
|
|
14
|
-
}
|
|
15
|
-
} else {
|
|
16
|
-
sequenceOpts = ['clean', 'grab-cdn', 'grab-shared-components', 'grab-shared-scripts', 'grab-form-helpers', 'templates', 'styles', 'copy-videos', 'js-lint', 'html-min', 'css-min', 'js-min', 'img-min', 'extras', 'cache-bust', 'add-path-subdirectories', 'copy-resources-to-dist', 'build-stat'];
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
if (siteData.copyLocalFontFile) {
|
|
20
|
-
sequenceOpts.push('copy-fonts');
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
runSequence(...sequenceOpts, function() {
|
|
24
|
-
console.log('\x1b[42m%s\x1b[0m', '✔ Build completed!');
|
|
25
|
-
console.log('You can run \'gulp serve:dist\' to see production version.');
|
|
26
|
-
});
|
|
27
|
-
};
|
|
28
|
-
};
|
package/gulp-tasks/cache-bust.js
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
module.exports = function(gulp, gulpPlugins, siteSettings) {
|
|
2
|
-
var path = require('path');
|
|
3
|
-
return function() {
|
|
4
|
-
return gulp.src(siteSettings.distFolder + '/**')
|
|
5
|
-
.pipe(gulpPlugins.revAll.revision({
|
|
6
|
-
dontSearchFile: [/(resources)\/.*/, /(scripts\/components)\/.*/, /(fonts)\/.*/],
|
|
7
|
-
dontRenameFile: [/^\/favicon.ico$/g, '.html', '.txt', /modlogo([\w|\s|-])*\.(?:svg)/g, /(resources)\/.*/, /(fonts)\/.*/],
|
|
8
|
-
dontUpdateReference: [/^\/favicon.ico$/g, '.html', '.txt', /modlogo([\w|\s|-])*\.(?:svg)/g, /(resources)\/.*/, /(fonts)\/.*/],
|
|
9
|
-
transformFilename: function (file, hash) {
|
|
10
|
-
var ext = path.extname(file.path);
|
|
11
|
-
return path.basename(file.path, ext) + '-' + hash.substr(0, 8) + ext;
|
|
12
|
-
}
|
|
13
|
-
}))
|
|
14
|
-
.pipe(gulpPlugins.revDeleteOriginal())
|
|
15
|
-
.pipe(gulp.dest(siteSettings.distFolder))
|
|
16
|
-
.pipe(gulpPlugins.revAll.versionFile())
|
|
17
|
-
.pipe(gulp.dest(siteSettings.distFolder));
|
|
18
|
-
};
|
|
19
|
-
};
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
function getActiveSeasons() {
|
|
2
|
-
var seasons = require(`../src/data/seasons.js`);
|
|
3
|
-
const today = new Date();
|
|
4
|
-
const year = today.getFullYear();
|
|
5
|
-
let activeSeason = [];
|
|
6
|
-
|
|
7
|
-
for (const key in seasons) {
|
|
8
|
-
var seasonName = key;
|
|
9
|
-
var dateRanges = seasons[key];
|
|
10
|
-
var startDate = new Date(`${Object.values(dateRanges)[0]}-${year}`);
|
|
11
|
-
var endDate = new Date(`${Object.values(dateRanges)[1]}-${year}`);
|
|
12
|
-
|
|
13
|
-
if (startDate < today && today < endDate) {
|
|
14
|
-
activeSeason.push(seasonName)
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
return activeSeason;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
module.exports = getActiveSeasons;
|
package/gulp-tasks/clean.js
DELETED
package/gulp-tasks/compile.js
DELETED
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
const webpack = require('webpack-stream');
|
|
2
|
-
const glob = require('glob');
|
|
3
|
-
|
|
4
|
-
const entry = glob.sync('./src/scripts/**.ts').reduce((entry, path) => {
|
|
5
|
-
const pathName = path.replace(/(\.\/src\/scripts\/|\.ts)/g, ''); // remove `./src/scripts/`, `.ts`
|
|
6
|
-
entry[pathName] = path;
|
|
7
|
-
return entry;
|
|
8
|
-
}, {});
|
|
9
|
-
|
|
10
|
-
module.exports = function(gulp, gulpPlugins, siteSettings, mode) {
|
|
11
|
-
let assetUrl = siteSettings.tmpFolder + '/scripts';
|
|
12
|
-
if (mode === 'production') {
|
|
13
|
-
assetUrl = siteSettings.distFolder + '/scripts';
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
return function() {
|
|
17
|
-
return gulp.src('src/scripts/**.ts')
|
|
18
|
-
.on('error', function() {
|
|
19
|
-
this.end();
|
|
20
|
-
})
|
|
21
|
-
.pipe(webpack({
|
|
22
|
-
mode: mode,
|
|
23
|
-
entry,
|
|
24
|
-
output: {
|
|
25
|
-
filename: '[name].js'
|
|
26
|
-
},
|
|
27
|
-
resolve: {
|
|
28
|
-
// Add `.ts` and `.tsx` as a resolvable extension.
|
|
29
|
-
extensions: ['.ts', '.tsx', '.js']
|
|
30
|
-
},
|
|
31
|
-
module: {
|
|
32
|
-
rules: [
|
|
33
|
-
// all files with a `.ts` or `.tsx` extension will be handled by `ts-loader`
|
|
34
|
-
{ test: /\.ts?$/, loader: 'ts-loader' }
|
|
35
|
-
]
|
|
36
|
-
}
|
|
37
|
-
}))
|
|
38
|
-
.on('error', function(err) {
|
|
39
|
-
console.log('errors:',err);
|
|
40
|
-
this.end();
|
|
41
|
-
})
|
|
42
|
-
.pipe(gulp.dest(assetUrl));
|
|
43
|
-
};
|
|
44
|
-
};
|
package/gulp-tasks/copy-fonts.js
DELETED
package/gulp-tasks/copy-json.js
DELETED
package/gulp-tasks/extras.js
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
module.exports = function(gulp, gulpPlugins, siteSettings) {
|
|
2
|
-
var srcPaths = [];
|
|
3
|
-
|
|
4
|
-
srcPaths.push(siteSettings.srcFolder + '/*.*');
|
|
5
|
-
srcPaths.push('!' + siteSettings.srcFolder + '/**/*.html');
|
|
6
|
-
|
|
7
|
-
for (var i = 0; i < siteSettings.browserSyncServeFolders.length; i ++) {
|
|
8
|
-
srcPaths.push(siteSettings.browserSyncServeFolders[i] + '/**/*.otf');
|
|
9
|
-
srcPaths.push(siteSettings.browserSyncServeFolders[i] + '/**/*.eot');
|
|
10
|
-
srcPaths.push(siteSettings.browserSyncServeFolders[i] + '/**/*.svg');
|
|
11
|
-
srcPaths.push(siteSettings.browserSyncServeFolders[i] + '/**/*.ttf');
|
|
12
|
-
srcPaths.push(siteSettings.browserSyncServeFolders[i] + '/**/*.woff');
|
|
13
|
-
srcPaths.push(siteSettings.browserSyncServeFolders[i] + '/**/*.woff2');
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
return function() {
|
|
17
|
-
return gulp.src(srcPaths, {
|
|
18
|
-
dot: true
|
|
19
|
-
})
|
|
20
|
-
.pipe(gulp.dest(siteSettings.distFolder));
|
|
21
|
-
};
|
|
22
|
-
};
|