mod-build 4.0.13 → 4.0.14-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/CHANGELOG.md +4 -0
- package/package.json +1 -1
- package/tasks/templates.js +40 -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,44 @@ 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 (config) => {
|
|
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
|
+
fs.writeFileSync(`${defaultSettings.srcFolder}/resources/data/defaultContent.json`, '', 'utf8');
|
|
80
|
+
|
|
81
|
+
await new Promise((resolve) => {
|
|
82
|
+
axiosInstance.get(url, {
|
|
83
|
+
headers: {
|
|
84
|
+
'Authorization': `Bearer ${apiToken}`
|
|
85
|
+
}
|
|
86
|
+
})
|
|
87
|
+
.then(async resp => {
|
|
88
|
+
if (resp.status !== 200) {
|
|
89
|
+
throw new Error(`${resp.status}: Error while fetching default top recommended content`);
|
|
90
|
+
}
|
|
91
|
+
const defaultTopRecommended = resp.data;
|
|
92
|
+
trade = trade.split('-');
|
|
93
|
+
const camelCaseTrade = trade.map(word => word.charAt(0).toUpperCase() + word.slice(1)).join('');
|
|
94
|
+
|
|
95
|
+
let tradeWrapper = {
|
|
96
|
+
[`default${camelCaseTrade}Content`]: defaultTopRecommended
|
|
97
|
+
}
|
|
98
|
+
fs.appendFileSync(`${defaultSettings.srcFolder}/resources/data/defaultContent.json`, JSON.stringify(tradeWrapper, null, 2), 'utf8');
|
|
99
|
+
resolve();
|
|
100
|
+
}).catch(error => {
|
|
101
|
+
console.error(error);
|
|
102
|
+
resolve();
|
|
103
|
+
}).finally(() => {
|
|
104
|
+
axiosInstance.interceptors.response.eject(responseInterceptor);
|
|
105
|
+
});
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
|
|
74
109
|
const fetchTcpaFromSitegenie = async (config, tempConfig) => {
|
|
75
110
|
const company = config.company_name;
|
|
76
111
|
const companyPlaceholder = "<%=company_name%>";
|
|
@@ -159,6 +194,10 @@ export default async function(config) {
|
|
|
159
194
|
if (!config.tcpaText && config.primary_trade && !tempConfigCreated) {
|
|
160
195
|
await fetchTcpaFromSitegenie(config, tempConfig);
|
|
161
196
|
}
|
|
197
|
+
if (config.getTopRecommendedContent && !tempConfigCreated) {
|
|
198
|
+
console.log('GRAB DEFAULT CONTENT!');
|
|
199
|
+
await getDefaultTopRecommendedContent(config);
|
|
200
|
+
}
|
|
162
201
|
}
|
|
163
202
|
|
|
164
203
|
if (!tempConfigCreated) {
|