mod-build 4.0.101-beta.2 → 4.0.102-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 +2 -2
- package/package.json +1 -1
- package/src/resources/data/tcpa.json +4 -0
- package/src/resources/templates/modals/about/index.hbs +9 -0
- package/src/resources/templates/modals/about/index.html +9 -0
- package/src/resources/templates/modals/contact-us/index.hbs +348 -0
- package/src/resources/templates/modals/contact-us/index.html +348 -0
- package/src/resources/templates/modals/e-sign-consent/index.hbs +35 -0
- package/src/resources/templates/modals/e-sign-consent/index.html +35 -0
- package/src/resources/templates/modals/faq/index.hbs +9 -0
- package/src/resources/templates/modals/faq/index.html +9 -0
- package/src/resources/templates/modals/privacy/index.hbs +238 -0
- package/src/resources/templates/modals/privacy/index.html +238 -0
- package/src/resources/templates/modals/terms/index.hbs +166 -0
- package/src/resources/templates/modals/terms/index.html +166 -0
- package/tasks/get-default-trade-questions.js +157 -121
- package/tasks/grab-b2b-data.js +2 -2
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import merge from 'lodash.merge';
|
|
3
3
|
import { defaultSettings } from '../src/data/config.js';
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
function resolveRefs(value, root, refChain = new Set()) {
|
|
6
6
|
if (value === null || typeof value !== 'object') {
|
|
7
7
|
return value;
|
|
8
8
|
}
|
|
@@ -33,150 +33,186 @@ export function resolveRefs(value, root = value, refChain = new Set()) {
|
|
|
33
33
|
return resolved;
|
|
34
34
|
}
|
|
35
35
|
|
|
36
|
-
function
|
|
37
|
-
|
|
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
|
-
};
|
|
52
|
-
}
|
|
53
|
-
});
|
|
36
|
+
function mergeDefaultTradeQuestionsConfigOnSteps(config, steps) {
|
|
37
|
+
if (!config || typeof config !== 'object') return;
|
|
54
38
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
}
|
|
39
|
+
if (config.steps && typeof config.steps === 'object' && config.steps.items) {
|
|
40
|
+
// cloning steps to keep multiple steps: {} objects independent
|
|
41
|
+
const clonedSteps = JSON.parse(JSON.stringify(steps));
|
|
42
|
+
mergeDefaultTradeQuestionsConfig(config, clonedSteps);
|
|
43
|
+
}
|
|
61
44
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
45
|
+
for (const key in config) {
|
|
46
|
+
if (config.hasOwnProperty(key)) {
|
|
47
|
+
const value = config[key];
|
|
48
|
+
if (typeof value === 'object' && value !== null) {
|
|
49
|
+
mergeDefaultTradeQuestionsConfigOnSteps(value, steps);
|
|
67
50
|
}
|
|
68
51
|
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
function mergeDefaultTradeQuestionsConfig(config, steps) {
|
|
56
|
+
if (!config || !config.steps || !config.steps.items || !Array.isArray(config.steps.items)) {
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
config.steps.items.forEach((item) => {
|
|
61
|
+
const stepName = item.attributes.data['step-name'];
|
|
62
|
+
if (steps[stepName]) {
|
|
63
|
+
if (!item.stepContent) {
|
|
64
|
+
item.stepContent = {};
|
|
65
|
+
}
|
|
69
66
|
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
67
|
+
if (!item.stepContent.fields) {
|
|
68
|
+
item.stepContent.fields = [];
|
|
69
|
+
}
|
|
70
|
+
const defaultStepFields = steps[stepName].fields;
|
|
71
|
+
let defaultStepOptions = [];
|
|
72
|
+
let defaultQuestionLegend = {};
|
|
73
|
+
defaultStepFields.forEach((defaultField) => {
|
|
74
|
+
defaultStepOptions = defaultField.options;
|
|
75
|
+
defaultQuestionLegend = defaultField.legend;
|
|
78
76
|
});
|
|
79
|
-
}
|
|
80
77
|
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
78
|
+
item.stepContent.fields.forEach((field) => {
|
|
79
|
+
if (field.legend) {
|
|
80
|
+
field.legend = merge(defaultQuestionLegend, field.legend);
|
|
81
|
+
} else {
|
|
82
|
+
field.legend = defaultQuestionLegend;
|
|
83
|
+
}
|
|
84
84
|
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
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
|
+
}
|
|
88
92
|
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
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
|
+
}
|
|
103
|
+
|
|
104
|
+
if (field.fieldType === 'radio' || field.fieldType === 'checkbox-group') {
|
|
105
|
+
if (!field.errorMessage) {
|
|
106
|
+
field.errorMessage = field.fieldType === 'checkbox-group' ? 'Please select at least one option.' : 'Professionals need this info to generate a quote.';
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
if (field.options && Array.isArray(field.options) && field.options.length) {
|
|
110
|
+
field.options.forEach((option) => {
|
|
111
|
+
if (typeof option.update === 'number') {
|
|
112
|
+
if (option.attributes && option.attributes.checked === false) {
|
|
113
|
+
delete option.attributes.checked;
|
|
114
|
+
delete defaultStepOptions[option.update].attributes.checked;
|
|
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
|
+
});
|
|
95
125
|
}
|
|
96
|
-
|
|
97
|
-
} else if (typeof option.insertAt === 'number') {
|
|
98
|
-
defaultOptions.splice(option.insertAt, 0, option);
|
|
126
|
+
field.options = defaultStepOptions;
|
|
99
127
|
} else {
|
|
100
|
-
|
|
128
|
+
if (field && Array.isArray(field) && field.length) {
|
|
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;
|
|
101
141
|
}
|
|
102
142
|
});
|
|
103
|
-
}
|
|
104
|
-
field.options = defaultOptions;
|
|
105
|
-
});
|
|
106
|
-
}
|
|
107
143
|
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
144
|
+
// extra question block
|
|
145
|
+
if (item.stepContent.extraQuestionBlock) {
|
|
146
|
+
if (!item.stepContent.extraQuestionBlock.fields) {
|
|
147
|
+
item.stepContent.extraQuestionBlock.fields = [];
|
|
148
|
+
}
|
|
112
149
|
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
};
|
|
150
|
+
const defaultExtraQuestionFields = steps[stepName].extraQuestionBlock.fields;
|
|
151
|
+
let defaultExtraQuestionOptions = [];
|
|
152
|
+
let defaultExtraQuestionLegend = {};
|
|
153
|
+
defaultExtraQuestionFields.forEach((defaultExtraQuestionField) => {
|
|
154
|
+
defaultExtraQuestionOptions = defaultExtraQuestionField.options;
|
|
155
|
+
defaultExtraQuestionLegend = defaultExtraQuestionField.legend;
|
|
156
|
+
});
|
|
157
|
+
item.stepContent.extraQuestionBlock.fields.forEach((field) => {
|
|
122
158
|
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
}
|
|
159
|
+
if (field.legend) {
|
|
160
|
+
field.legend = merge(defaultExtraQuestionLegend, field.legend);
|
|
161
|
+
} else {
|
|
162
|
+
field.legend = defaultExtraQuestionLegend;
|
|
163
|
+
}
|
|
129
164
|
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
165
|
+
if (field && field.remove) {
|
|
166
|
+
if (field.remove.includes('all')) {
|
|
167
|
+
defaultExtraQuestionOptions = [];
|
|
168
|
+
} else {
|
|
169
|
+
defaultExtraQuestionOptions = defaultExtraQuestionOptions.filter((_, i) => !field.remove.includes(i));
|
|
170
|
+
}
|
|
171
|
+
}
|
|
136
172
|
|
|
137
|
-
|
|
173
|
+
if (field.fieldType === 'radio') {
|
|
174
|
+
if (!field.errorMessage) {
|
|
175
|
+
field.errorMessage = 'Professionals need this info to generate a quote.';
|
|
176
|
+
}
|
|
138
177
|
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
178
|
+
if (field.options && Array.isArray(field.options) && field.options.length) {
|
|
179
|
+
field.options.forEach((option, optionIndex) => {
|
|
180
|
+
if (typeof option.update === 'number') {
|
|
181
|
+
if (option.attributes && option.attributes.checked === false) {
|
|
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
|
+
});
|
|
143
211
|
}
|
|
144
|
-
mergeQuestionFields(
|
|
145
|
-
extraQuestionBlock.fields,
|
|
146
|
-
defaultStep.extraQuestionBlock.fields,
|
|
147
|
-
mergeOptions
|
|
148
|
-
);
|
|
149
212
|
}
|
|
150
213
|
});
|
|
151
214
|
}
|
|
152
215
|
|
|
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
|
-
|
|
180
216
|
export default async function(config) {
|
|
181
217
|
if (config.useStepsConfig) {
|
|
182
218
|
console.log('Starting get-default-trade-questions...');
|
package/tasks/grab-b2b-data.js
CHANGED
|
@@ -51,12 +51,12 @@ export default async function(config) {
|
|
|
51
51
|
// Array of B2B data files to fetch
|
|
52
52
|
const b2bDataFiles = [
|
|
53
53
|
{
|
|
54
|
-
inputPath: '/
|
|
54
|
+
inputPath: '/wp-content/themes/modernize/app/Data/b2b-lead-form.json',
|
|
55
55
|
destPath: `${srcFolder}/data/`,
|
|
56
56
|
fileName: 'lead-form.json'
|
|
57
57
|
},
|
|
58
58
|
{
|
|
59
|
-
inputPath: '/
|
|
59
|
+
inputPath: '/wp-content/themes/modernize/app/Data/trades.json',
|
|
60
60
|
destPath: `${srcFolder}/data/`,
|
|
61
61
|
fileName: 'trades.json'
|
|
62
62
|
}
|