mod-build 4.0.93 → 4.0.94-beta.10

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 CHANGED
@@ -1,5 +1,9 @@
1
1
  # Changelog
2
2
 
3
+ ## 4.0.94
4
+
5
+ - Prefer site config `brandedSiteIdentifiers.publicKey` over the remote branded-site-identifiers lookup
6
+
3
7
  ## 4.0.93
4
8
 
5
9
  - Removing the conditional on when to download `recaptcha.html` and that should be available whenever we need it
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mod-build",
3
- "version": "4.0.93",
3
+ "version": "4.0.94-beta.10",
4
4
  "description": "Share components for S3 sites.",
5
5
  "type": "module",
6
6
  "scripts": {
@@ -202,12 +202,16 @@ const getConsentCaptureLanguage = async function(config, tempConfig) {
202
202
  let consentCaptureObject = await resp.json(),
203
203
  service = config.service ? config.service.toLowerCase().replace('_', ' ') : config.primary_trade.toLowerCase().replace('_', ' ');
204
204
 
205
- const brandedSiteIdentifiersResp = await fetch(`https://${defaultSettings.nodeEnv}/quote/resources/mod-site/data/branded-site-identifiers.json`);
206
- if (brandedSiteIdentifiersResp.status !== 200) {
207
- throw new Error(`${brandedSiteIdentifiersResp.status}: Error while fetching branded-site-identifiers.json`);
208
- }
205
+ let brandedSiteIdentifiersData = {};
209
206
 
210
- const brandedSiteIdentifiersData = await brandedSiteIdentifiersResp.json();
207
+ if (!config.brandedSiteIdentifiers?.publicKey) {
208
+ const brandedSiteIdentifiersResp = await fetch(`https://${defaultSettings.nodeEnv}/quote/resources/mod-site/data/branded-site-identifiers.json`);
209
+ if (brandedSiteIdentifiersResp.status !== 200) {
210
+ throw new Error(`${brandedSiteIdentifiersResp.status}: Error while fetching branded-site-identifiers.json`);
211
+ }
212
+
213
+ brandedSiteIdentifiersData = await brandedSiteIdentifiersResp.json();
214
+ }
211
215
 
212
216
  if (config.isBranded) {
213
217
  const websiteName = config.website_name.toLowerCase(),
@@ -215,10 +219,13 @@ const getConsentCaptureLanguage = async function(config, tempConfig) {
215
219
  apiDomain = 'https://form-service-hs.qnst.com/';
216
220
 
217
221
  let apiUrl = '';
222
+ let publicKey = config.brandedSiteIdentifiers?.publicKey || null;
218
223
 
219
- if (brandedSiteIdentifiersData[websiteName] && (brandedSiteIdentifiersData[websiteName].publicKey || brandedSiteIdentifiersData[websiteName][companyName] && brandedSiteIdentifiersData[websiteName][companyName].publicKey)) {
220
- const publicKey = brandedSiteIdentifiersData[websiteName][companyName] ? brandedSiteIdentifiersData[websiteName][companyName].publicKey : brandedSiteIdentifiersData[websiteName].publicKey;
224
+ if (!publicKey && brandedSiteIdentifiersData[websiteName] && (brandedSiteIdentifiersData[websiteName].publicKey || brandedSiteIdentifiersData[websiteName][companyName] && brandedSiteIdentifiersData[websiteName][companyName].publicKey)) {
225
+ publicKey = brandedSiteIdentifiersData[websiteName][companyName] ? brandedSiteIdentifiersData[websiteName][companyName].publicKey : brandedSiteIdentifiersData[websiteName].publicKey;
226
+ }
221
227
 
228
+ if (publicKey) {
222
229
  apiUrl = `${apiDomain}utils/vendor-display-name?publicKey=${encodeURIComponent(publicKey)}`;
223
230
  const getBrandedDisplayName = await fetch(apiUrl);
224
231
  if (getBrandedDisplayName.status !== 200) {