@financial-times/dotcom-ui-bootstrap 11.3.1 → 11.3.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/README.md CHANGED
@@ -125,7 +125,7 @@ If JavaScript is available the `no-js` class on the document element will be rep
125
125
 
126
126
  If the browser passes the [cuts the mustard](#cutting-the-mustard) test then the `core` class name on the document element will be replaced with `enhanced`.
127
127
 
128
- If any scripts fail to load a tracking pixel will be loaded to send a JavaScript loading failure event to [Spoor].
128
+ If any scripts fail to load a tracking pixel will be loaded to send a JavaScript loading failure event to [Spoor]. With enhanced experience, if any first-party scripts (i.e. scripts on an `www.ft.com` hostname) fail to load, the bootstrap will fall back to core experience.
129
129
 
130
130
  [Spoor]: https://spoor-docs.herokuapp.com/
131
131
 
package/lib/bootstrap.js CHANGED
@@ -25,9 +25,15 @@
25
25
  console.error('The script ' + script + ' failed to load') // eslint-disable-line no-console
26
26
  }
27
27
 
28
+ const scriptHost = new URL(script).hostname
29
+
28
30
  if (/enhanced/.test(doc.className)) {
29
- console.warn('Script loading failed, reverting to core experience') // eslint-disable-line no-console
30
- doc.className = doc.className.replace('enhanced', 'core')
31
+ if (scriptHost === 'www.ft.com') {
32
+ console.warn('Script loading failed, reverting to core experience') // eslint-disable-line no-console
33
+ doc.className = doc.className.replace('enhanced', 'core')
34
+ } else {
35
+ console.warn('Third-party script, not reverting to core experience') // eslint-disable-line no-console
36
+ }
31
37
  }
32
38
 
33
39
  if (scriptsConfig.trackErrors) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@financial-times/dotcom-ui-bootstrap",
3
- "version": "11.3.1",
3
+ "version": "11.3.2",
4
4
  "description": "",
5
5
  "main": "component.js",
6
6
  "browser": "browser.js",