mod-build 4.0.13 → 4.0.14-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 +4 -0
- package/package.json +1 -1
- package/tasks/templates.js +34 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
## 4.0.14
|
|
2
|
+
|
|
3
|
+
- Adding a call to grab the default content for Best Company Top Recommended pages so there isn't a delay on the initial page
|
|
4
|
+
|
|
1
5
|
## 4.0.13
|
|
2
6
|
|
|
3
7
|
- Making sure the abandonment.min.js gets copied to the right folder path (needs to copy to /abandonment/accessible/ if the site is indeed using the accessible version). This will ensure our shared-resource deployments trigger the files correctly.
|
package/package.json
CHANGED
package/tasks/templates.js
CHANGED
|
@@ -68,9 +68,39 @@ const getDefaultFormFieldConfig = async (config, folder = 'accessible-components
|
|
|
68
68
|
axiosInstance.interceptors.response.eject(responseInterceptor);
|
|
69
69
|
});
|
|
70
70
|
});
|
|
71
|
-
|
|
72
71
|
};
|
|
73
72
|
|
|
73
|
+
// Default Content for Best Company Top Recommended Pages (Zip Version)
|
|
74
|
+
const getDefaultTopRecommendedContent = async (tempConfig) => {
|
|
75
|
+
let trade = 'solar'; // Currently only available for Solar; But if other trades are needed, let's convert this to an array & grab all default content
|
|
76
|
+
const url = `https://api2.bestcompany.com/api/external/${trade}/get-top-recommended`,
|
|
77
|
+
apiToken = 'jtsb9RnZYE1UsDy7Wpka4bmaEWYrI7KUDdLQO68ec612336d';
|
|
78
|
+
|
|
79
|
+
await new Promise((resolve) => {
|
|
80
|
+
axiosInstance.get(url, {
|
|
81
|
+
headers: {
|
|
82
|
+
'Authorization': `Bearer ${apiToken}`
|
|
83
|
+
}
|
|
84
|
+
})
|
|
85
|
+
.then(async resp => {
|
|
86
|
+
if (resp.status !== 200) {
|
|
87
|
+
throw new Error(`${resp.status}: Error while fetching default top recommended content`);
|
|
88
|
+
}
|
|
89
|
+
const defaultTopRecommended = resp.data;
|
|
90
|
+
trade = trade.split('-');
|
|
91
|
+
const camelCaseTrade = trade.map(word => word.charAt(0).toUpperCase() + word.slice(1)).join('');
|
|
92
|
+
|
|
93
|
+
tempConfig[`default${camelCaseTrade}Content`] = defaultTopRecommended;
|
|
94
|
+
resolve();
|
|
95
|
+
}).catch(error => {
|
|
96
|
+
console.error(error);
|
|
97
|
+
resolve();
|
|
98
|
+
}).finally(() => {
|
|
99
|
+
axiosInstance.interceptors.response.eject(responseInterceptor);
|
|
100
|
+
});
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
|
|
74
104
|
const fetchTcpaFromSitegenie = async (config, tempConfig) => {
|
|
75
105
|
const company = config.company_name;
|
|
76
106
|
const companyPlaceholder = "<%=company_name%>";
|
|
@@ -159,6 +189,9 @@ export default async function(config) {
|
|
|
159
189
|
if (!config.tcpaText && config.primary_trade && !tempConfigCreated) {
|
|
160
190
|
await fetchTcpaFromSitegenie(config, tempConfig);
|
|
161
191
|
}
|
|
192
|
+
if (!config.topRecommendedContent && config.getTopRecommendedContent && !tempConfigCreated) {
|
|
193
|
+
await getDefaultTopRecommendedContent(tempConfig);
|
|
194
|
+
}
|
|
162
195
|
}
|
|
163
196
|
|
|
164
197
|
if (!tempConfigCreated) {
|