@guardian/ophan-tracker-js 2.1.0-next.2 → 2.1.0

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.
@@ -1,17 +1,7 @@
1
1
  /**
2
2
  * @type {Component[]}
3
3
  */
4
- const components = [];
5
-
6
-
7
-
8
-
9
-
10
-
11
-
12
-
13
-
14
-
4
+ export const components = [];
15
5
 
16
6
  /**
17
7
  * theguardian.com uses a custom scroll event for performance reasons.
package/assets/heatmap.js CHANGED
@@ -1,12 +1,8 @@
1
- // Generated by CoffeeScript 2.7.0
2
- var heatmapFired, init;
1
+ let heatmapFired = false;
3
2
 
4
- heatmapFired = false;
5
-
6
- init = function () {
7
- var addHeatmap;
8
- addHeatmap = function () {
9
- var heatmapParam;
3
+ const init = () => {
4
+ const addHeatmap = () => {
5
+ let heatmapParam;
10
6
  if (
11
7
  typeof localStorage !== 'undefined' &&
12
8
  localStorage !== null &&
@@ -17,16 +13,26 @@ init = function () {
17
13
  /^(?:.*[&\?]heatmap(?:\=([^&]*))?)?.*$/,
18
14
  '$1',
19
15
  );
16
+
17
+ if (heatmapParam === 'experimental') {
18
+ return (document.body.appendChild(
19
+ document.createElement('script'),
20
+ ).src = '//dashboard.ophan.co.uk/assets/js/react/heatphan/index.js');
21
+ }
22
+
20
23
  if (heatmapParam === 'true' || heatmapParam === 'false') {
21
24
  localStorage['ophan_heatmap'] = heatmapParam;
22
25
  }
26
+
23
27
  if (localStorage['ophan_heatmap'] === 'true' || heatmapParam === 'show') {
24
28
  return (document.body.appendChild(
25
29
  document.createElement('script'),
26
30
  ).src = '//dashboard.ophan.co.uk/assets/js/heatmap-bookmarklet.js');
27
31
  }
32
+
28
33
  }
29
34
  };
35
+
30
36
  if (document.readyState === 'complete') {
31
37
  return addHeatmap();
32
38
  } else {
@@ -43,5 +49,5 @@ init = function () {
43
49
  };
44
50
 
45
51
  export default {
46
- init: init,
52
+ init,
47
53
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@guardian/ophan-tracker-js",
3
- "version": "2.1.0-next.2",
3
+ "version": "2.1.0",
4
4
  "type": "module",
5
5
  "engines": {
6
6
  "node": ">=16"