@times-components/article-main-comment 2.73.10 → 2.73.11-alpha.13

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
@@ -3,6 +3,86 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [2.73.20](https://github.com/newsuk/times-components/compare/@times-components/article-main-comment@2.73.19...@times-components/article-main-comment@2.73.20) (2023-11-30)
7
+
8
+ **Note:** Version bump only for package @times-components/article-main-comment
9
+
10
+
11
+
12
+
13
+
14
+ ## [2.73.19](https://github.com/newsuk/times-components/compare/@times-components/article-main-comment@2.73.18...@times-components/article-main-comment@2.73.19) (2023-11-29)
15
+
16
+ **Note:** Version bump only for package @times-components/article-main-comment
17
+
18
+
19
+
20
+
21
+
22
+ ## [2.73.18](https://github.com/newsuk/times-components/compare/@times-components/article-main-comment@2.73.17...@times-components/article-main-comment@2.73.18) (2023-11-29)
23
+
24
+ **Note:** Version bump only for package @times-components/article-main-comment
25
+
26
+
27
+
28
+
29
+
30
+ ## [2.73.17](https://github.com/newsuk/times-components/compare/@times-components/article-main-comment@2.73.16...@times-components/article-main-comment@2.73.17) (2023-11-28)
31
+
32
+ **Note:** Version bump only for package @times-components/article-main-comment
33
+
34
+
35
+
36
+
37
+
38
+ ## [2.73.16](https://github.com/newsuk/times-components/compare/@times-components/article-main-comment@2.73.15...@times-components/article-main-comment@2.73.16) (2023-11-27)
39
+
40
+ **Note:** Version bump only for package @times-components/article-main-comment
41
+
42
+
43
+
44
+
45
+
46
+ ## [2.73.15](https://github.com/newsuk/times-components/compare/@times-components/article-main-comment@2.73.14...@times-components/article-main-comment@2.73.15) (2023-11-27)
47
+
48
+ **Note:** Version bump only for package @times-components/article-main-comment
49
+
50
+
51
+
52
+
53
+
54
+ ## [2.73.14](https://github.com/newsuk/times-components/compare/@times-components/article-main-comment@2.73.13...@times-components/article-main-comment@2.73.14) (2023-11-27)
55
+
56
+ **Note:** Version bump only for package @times-components/article-main-comment
57
+
58
+
59
+
60
+
61
+
62
+ ## [2.73.13](https://github.com/newsuk/times-components/compare/@times-components/article-main-comment@2.73.12...@times-components/article-main-comment@2.73.13) (2023-11-27)
63
+
64
+ **Note:** Version bump only for package @times-components/article-main-comment
65
+
66
+
67
+
68
+
69
+
70
+ ## [2.73.12](https://github.com/newsuk/times-components/compare/@times-components/article-main-comment@2.73.11...@times-components/article-main-comment@2.73.12) (2023-11-24)
71
+
72
+ **Note:** Version bump only for package @times-components/article-main-comment
73
+
74
+
75
+
76
+
77
+
78
+ ## [2.73.11](https://github.com/newsuk/times-components/compare/@times-components/article-main-comment@2.73.10...@times-components/article-main-comment@2.73.11) (2023-11-23)
79
+
80
+ **Note:** Version bump only for package @times-components/article-main-comment
81
+
82
+
83
+
84
+
85
+
6
86
  ## [2.73.10](https://github.com/newsuk/times-components/compare/@times-components/article-main-comment@2.73.9...@times-components/article-main-comment@2.73.10) (2023-11-23)
7
87
 
8
88
  **Note:** Version bump only for package @times-components/article-main-comment
@@ -11,10 +11,16 @@ var _articleSkeleton = _interopRequireDefault(require("@times-components/article
11
11
 
12
12
  var _utils = require("@times-components/utils");
13
13
 
14
+ var _tsNewskit = require("@times-components/ts-newskit");
15
+
16
+ var _newskit = require("newskit");
17
+
14
18
  var _articleHeader = _interopRequireDefault(require("./article-header/article-header"));
15
19
 
16
20
  var _articlePropTypes = require("./article-prop-types/article-prop-types");
17
21
 
22
+ var _responsive = require("./styles/responsive");
23
+
18
24
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
19
25
 
20
26
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
@@ -25,6 +31,64 @@ class ArticlePage extends _react.Component {
25
31
  constructor(props) {
26
32
  super(props);
27
33
  this.renderHeader = this.renderHeader.bind(this);
34
+ this.state = {
35
+ initialPosition: 0
36
+ };
37
+ this.sidebarRef = _react.default.createRef();
38
+ this.handleScroll = this.handleScroll.bind(this);
39
+ }
40
+
41
+ componentDidMount() {
42
+ window.addEventListener("scroll", this.handleScroll);
43
+ const sidebarNode = this.sidebarRef.current;
44
+
45
+ if (sidebarNode) {
46
+ const rect = sidebarNode.getBoundingClientRect();
47
+ const stickyNavigationHeight = 40;
48
+ this.setState({
49
+ initialPosition: rect.top - stickyNavigationHeight
50
+ });
51
+ }
52
+ }
53
+
54
+ componentWillUnmount() {
55
+ window.removeEventListener("scroll", this.handleScroll);
56
+ }
57
+
58
+ handleScroll() {
59
+ const sidebarNode = this.sidebarRef.current;
60
+
61
+ if (sidebarNode) {
62
+ const rect = sidebarNode.getBoundingClientRect();
63
+ const adElement = document.querySelector(".responsive__InlineAdWrapper-sc-4v1r4q-17");
64
+ const relatedArticlesElement = document.getElementById("related-articles");
65
+ let isAdIntersecting = false;
66
+ let isRelatedArticlesIntersecting = false;
67
+
68
+ if (adElement) {
69
+ const adRect = adElement.getBoundingClientRect();
70
+ isAdIntersecting = adRect.top <= rect.bottom && adRect.bottom >= rect.top;
71
+ }
72
+
73
+ if (relatedArticlesElement) {
74
+ const relatedArticlesRect = relatedArticlesElement.getBoundingClientRect();
75
+ isRelatedArticlesIntersecting = relatedArticlesRect.top <= window.innerHeight && relatedArticlesRect.bottom >= 0;
76
+ }
77
+
78
+ const initialPosition = this.state.initialPosition;
79
+ const stickyNavigationHeight = 40;
80
+
81
+ if (isAdIntersecting || isRelatedArticlesIntersecting) {
82
+ sidebarNode.style.transition = "opacity 0.5s ease";
83
+ sidebarNode.style.opacity = "0";
84
+ } else {
85
+ const isScrolled = rect.top <= stickyNavigationHeight && window.scrollY > initialPosition;
86
+ sidebarNode.style.transition = "opacity 0.5s ease";
87
+ sidebarNode.style.opacity = "1";
88
+ sidebarNode.style.position = isScrolled ? "fixed" : "absolute";
89
+ sidebarNode.style.top = isScrolled ? "".concat(stickyNavigationHeight, "px") : "100%";
90
+ }
91
+ }
28
92
  }
29
93
 
30
94
  renderHeader() {
@@ -40,9 +104,10 @@ class ArticlePage extends _react.Component {
40
104
  publishedTime = article.publishedTime,
41
105
  shortHeadline = article.shortHeadline,
42
106
  standfirst = article.standfirst,
43
- updatedTime = article.updatedTime;
107
+ updatedTime = article.updatedTime,
108
+ section = article.section;
44
109
  const authorImage = bylines && bylines.length > 0 && bylines[0].image && Object.keys(bylines[0].image).length !== 0 && bylines[0].image.crop ? bylines[0].image.crop.url : null;
45
- return /*#__PURE__*/_react.default.createElement(_articleHeader.default, {
110
+ return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_articleHeader.default, {
46
111
  authorImage: authorImage,
47
112
  bylines: bylines,
48
113
  flags: expirableFlags,
@@ -54,7 +119,27 @@ class ArticlePage extends _react.Component {
54
119
  standfirst: standfirst,
55
120
  updatedTime: updatedTime,
56
121
  showAudioPlayer: showAudioPlayer
57
- });
122
+ }), (0, _utils.CanShowPuzzleSidebar)(section) && /*#__PURE__*/_react.default.createElement(_newskit.NewsKitProvider, {
123
+ theme: _tsNewskit.PuzzlesWebLightTheme
124
+ }, /*#__PURE__*/_react.default.createElement(_responsive.PuzzlesSidebar, {
125
+ ref: this.sidebarRef
126
+ }, /*#__PURE__*/_react.default.createElement(_tsNewskit.ArticleSidebar, {
127
+ pageLink: "https://www.thetimes.co.uk/puzzles",
128
+ sectionTitle: "Puzzles",
129
+ data: [{
130
+ title: "Crossword",
131
+ url: "https://www.thetimes.co.uk/puzzles/crossword",
132
+ imgUrl: "https://www.thetimes.co.uk/imageserver/image/%2Fpuzzles%2Ficons%2F33b27655-dcc9-421f-906f-b2b10dd26865.png?crop=1250%2C833%2C0%2C0&resize=500"
133
+ }, {
134
+ title: "Polygon",
135
+ url: "https://www.thetimes.co.uk/puzzles/word-puzzles",
136
+ imgUrl: "https://www.thetimes.co.uk/imageserver/image/%2Fpuzzles%2Ficons%2F33b27655-dcc9-421f-906f-b2b10dd26865.png?crop=1250%2C833%2C0%2C0&resize=500"
137
+ }, {
138
+ title: "Sudoku",
139
+ url: "https://www.thetimes.co.uk/puzzles/sudoku",
140
+ imgUrl: "https://www.thetimes.co.uk/imageserver/image/%2Fpuzzles%2Ficons%2F33b27655-dcc9-421f-906f-b2b10dd26865.png?crop=1250%2C833%2C0%2C0&resize=500"
141
+ }]
142
+ }))));
58
143
  }
59
144
 
60
145
  render() {
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.StandfirstContainer = exports.Separator = exports.MetaContainer = exports.Meta = exports.LabelContainer = exports.HeadlineContainer = exports.HeaderContainer = exports.FlagsContainer = exports.DatePublicationContainer = exports.AuthorImageContainer = void 0;
6
+ exports.PuzzlesSidebar = exports.StandfirstContainer = exports.Separator = exports.MetaContainer = exports.Meta = exports.LabelContainer = exports.HeadlineContainer = exports.HeaderContainer = exports.FlagsContainer = exports.DatePublicationContainer = exports.AuthorImageContainer = void 0;
7
7
 
8
8
  var _utils = require("@times-components/utils");
9
9
 
@@ -69,4 +69,11 @@ const StandfirstContainer = _styledComponents.default.h2.withConfig({
69
69
  fontSize: "infoTitle"
70
70
  }), (0, _tsStyleguide.spacing)(5), _tsStyleguide.breakpoints.wide, (0, _tsStyleguide.spacing)(4));
71
71
 
72
- exports.StandfirstContainer = StandfirstContainer;
72
+ exports.StandfirstContainer = StandfirstContainer;
73
+
74
+ const PuzzlesSidebar = _styledComponents.default.div.withConfig({
75
+ displayName: "responsive__PuzzlesSidebar",
76
+ componentId: "ba1gpd-10"
77
+ })(["padding-left:", ";position:absolute;right:0;z-index:1;top:100%;display:none;@media (min-width:", "px){display:block;width:19.8333%;padding-right:", ";}@media (min-width:", "px){display:block;width:18.8333%;padding-right:", ";}"], (0, _tsStyleguide.spacing)(4), _tsStyleguide.breakpoints.wide, (0, _tsStyleguide.spacing)(8), _tsStyleguide.breakpoints.huge, (0, _tsStyleguide.spacing)(10));
78
+
79
+ exports.PuzzlesSidebar = PuzzlesSidebar;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@times-components/article-main-comment",
3
- "version": "2.73.10",
3
+ "version": "2.73.11-alpha.13+64a72c664f",
4
4
  "description": "Main Comment Article Template",
5
5
  "main": "dist/article-main-comment",
6
6
  "dev": "src/article-main-comment",
@@ -33,15 +33,15 @@
33
33
  "homepage": "https://github.com/newsuk/times-components#readme",
34
34
  "devDependencies": {
35
35
  "@babel/core": "7.4.4",
36
- "@times-components/eslint-config-thetimes": "0.8.18",
37
- "@times-components/jest-configurator-web": "0.8.1",
38
- "@times-components/jest-serializer": "3.12.2",
39
- "@times-components/provider": "1.39.3",
40
- "@times-components/provider-test-tools": "1.29.1",
41
- "@times-components/storybook": "4.11.3",
42
- "@times-components/tealium-utils": "0.9.0",
43
- "@times-components/test-utils": "2.4.1",
44
- "@times-components/webpack-configurator": "2.1.0",
36
+ "@times-components/eslint-config-thetimes": "^0.8.18",
37
+ "@times-components/jest-configurator-web": "^0.8.1",
38
+ "@times-components/jest-serializer": "^3.12.2",
39
+ "@times-components/provider": "^1.39.3",
40
+ "@times-components/provider-test-tools": "^1.29.1",
41
+ "@times-components/storybook": "^4.11.3",
42
+ "@times-components/tealium-utils": "^0.9.0",
43
+ "@times-components/test-utils": "^2.4.1",
44
+ "@times-components/webpack-configurator": "^2.1.0",
45
45
  "babel-jest": "24.8.0",
46
46
  "eslint": "5.9.0",
47
47
  "jest": "24.8.0",
@@ -53,20 +53,21 @@
53
53
  "webpack": "4.30.0"
54
54
  },
55
55
  "dependencies": {
56
- "@times-components/ad": "2.21.43",
57
- "@times-components/article-byline": "3.13.15",
58
- "@times-components/article-label": "2.16.1",
59
- "@times-components/article-skeleton": "1.115.10",
60
- "@times-components/context": "1.10.37",
61
- "@times-components/date-publication": "0.28.1",
62
- "@times-components/image": "6.15.14",
63
- "@times-components/responsive": "0.17.1",
64
- "@times-components/ts-components": "1.81.7",
65
- "@times-components/ts-newskit": "1.139.1",
66
- "@times-components/ts-styleguide": "1.48.1",
67
- "@times-components/user-state": "0.5.11",
68
- "@times-components/utils": "6.16.21",
69
- "@times-components/video-label": "2.11.22",
56
+ "@times-components/ad": "^2.21.43",
57
+ "@times-components/article-byline": "^3.13.15",
58
+ "@times-components/article-label": "^2.16.1",
59
+ "@times-components/article-skeleton": "^1.115.11-alpha.13+64a72c664f",
60
+ "@times-components/context": "^1.10.37",
61
+ "@times-components/date-publication": "^0.28.1",
62
+ "@times-components/image": "^6.15.14",
63
+ "@times-components/responsive": "^0.17.1",
64
+ "@times-components/ts-components": "^1.81.7",
65
+ "@times-components/ts-newskit": "^1.140.6",
66
+ "@times-components/ts-styleguide": "^1.48.1",
67
+ "@times-components/user-state": "^0.5.11",
68
+ "@times-components/utils": "^6.16.21",
69
+ "@times-components/video-label": "^2.11.22",
70
+ "newskit": "7.2.0",
70
71
  "prop-types": "15.7.2",
71
72
  "styled-components": "4.3.2"
72
73
  },
@@ -81,5 +82,5 @@
81
82
  "publishConfig": {
82
83
  "access": "public"
83
84
  },
84
- "gitHead": "8a02f4055c36e19085f19976c3b75c139800f201"
85
+ "gitHead": "64a72c664f4b36d804896462116577b26b89dffe"
85
86
  }
package/rnw.js CHANGED
@@ -1 +1 @@
1
- module.exports=function(e){var t={};function r(n){if(t[n])return t[n].exports;var i=t[n]={i:n,l:!1,exports:{}};return e[n].call(i.exports,i,i.exports,r),i.l=!0,i.exports}return r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)r.d(n,i,function(t){return e[t]}.bind(null,i));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=14)}([function(e,t){e.exports=require("@times-components/ts-styleguide/rnw")},function(e,t){e.exports=require("prop-types")},function(e,t){e.exports=require("react")},function(e,t){e.exports=require("@times-components/utils/rnw")},function(e,t){e.exports=require("styled-components")},function(e,t){e.exports=require("@times-components/ts-components/rnw")},function(e,t){e.exports=require("@times-components/ts-newskit/rnw")},function(e,t){e.exports=require("@times-components/article-byline/rnw")},function(e,t){e.exports=require("@times-components/article-skeleton/rnw")},function(e,t){e.exports=require("@times-components/image/rnw")},function(e,t){e.exports=require("@times-components/article-label/rnw")},function(e,t){e.exports=require("@times-components/video-label/rnw")},function(e,t){e.exports=require("@times-components/context/rnw")},function(e,t){e.exports=require("@times-components/date-publication/rnw")},function(e,t,r){"use strict";r.r(t);var n=r(2),i=r.n(n),a=r(8),o=r.n(a),s=r(3),l=r(5),c=r(6),p=r(9),d=r.n(p),u=r(10),m=r.n(u),b=r(11),g=r.n(b),f=r(12),y=r.n(f),h=r(0),O=r(1),w=r.n(O);w.a.bool,w.a.string;function j(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function x(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?j(Object(r),!0).forEach((function(t){v(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):j(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function v(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function P(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function k(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}var C=function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?P(Object(r),!0).forEach((function(t){k(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):P(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}({},{articleHeadline:x(x({},Object(h.fontFactory)({font:"headline",fontSize:"headline"})),{},{color:h.colours.functional.brandColour,marginBottom:Object(h.spacing)(2),textAlign:"center"}),articleHeadlineTablet:x({},Object(h.fontFactory)({font:"headline",fontSize:"articleHeadline"})),authorImage:{marginBottom:Object(h.spacing)(5)},container:{alignItems:"center",paddingLeft:Object(h.spacing)(2),paddingRight:Object(h.spacing)(2)},datePublication:x(x({},Object(h.fontFactory)({font:"supporting",fontSize:"cardMeta"})),{},{color:h.colours.functional.secondary,marginTop:Object(h.spacing)(1)}),datePublicationTablet:{marginTop:"auto"},header:{marginBottom:Object(h.spacing)(3),paddingBottom:Object(h.spacing)(4),paddingTop:Object(h.spacing)(7)},label:{marginBottom:Object(h.spacing)(2)},meta:{flexDirection:"row",flexWrap:"wrap"},metaContainer:{alignItems:"center",width:"100%",paddingTop:Object(h.spacing)(2),paddingBottom:Object(h.spacing)(2),borderBottomColor:h.colours.functional.keyline,borderBottomWidth:1,borderTopColor:h.colours.functional.keyline,borderTopWidth:1},metaContainerTablet:{flexDirection:"row",justifyContent:"center"},separator:{borderRightColor:h.colours.functional.keyline,borderRightWidth:1,height:Object(h.spacing)(3),marginLeft:Object(h.spacing)(2),marginRight:Object(h.spacing)(2)},standFirst:x(x({},Object(h.fontFactory)({font:"headlineRegular",fontSize:"smallestHeadline"})),{},{color:h.colours.functional.primary,marginBottom:Object(h.spacing)(3),paddingLeft:Object(h.spacing)(2),paddingRight:Object(h.spacing)(2),textAlign:"center"})});const T=e=>{let t=e.isVideo,r=e.label;if(!t&&!r)return null;const n=t?g.a:m.a;return i.a.createElement(y.a.Consumer,null,e=>{let t=e.theme.sectionColour;return i.a.createElement(s.TcView,{style:C.label},i.a.createElement(n,{color:t||h.colours.section.default,title:r}))})};T.defaultProps={isVideo:!1,label:null};var E=T,S=r(7),q=r(13),_=r.n(q);w.a.arrayOf(w.a.shape({})).isRequired,w.a.string.isRequired,w.a.string.isRequired;var D=r(4),I=r.n(D);const R=I()(s.TcView).withConfig({displayName:"responsive__AuthorImageContainer",componentId:"ba1gpd-0"})(["border-radius:50%;height:100px;overflow:hidden;width:100px;@media (min-width:","px){height:118px;width:118px;}"],h.breakpoints.medium),N=I()(s.TcText).withConfig({displayName:"responsive__DatePublicationContainer",componentId:"ba1gpd-1"})(["",";flex-direction:row;flex-wrap:wrap;margin-top:",";@media (min-width:","px){margin-top:0;}"],e=>e.styles&&e.styles,Object(h.spacing)(3),h.breakpoints.medium),H=I()(s.TcView).withConfig({displayName:"responsive__FlagsContainer",componentId:"ba1gpd-2"})(["padding-top:",";padding-bottom:",";@media (min-width:","px){padding-top:0;}"],Object(h.spacing)(1),Object(h.spacing)(3),h.breakpoints.medium),z=I()(s.TcView).withConfig({displayName:"responsive__HeaderContainer",componentId:"ba1gpd-3"})(["order:2;z-index:1;@media (min-width:","px){width:80.8%;margin:0 auto ",";margin-left:auto;margin-right:auto;}@media (min-width:","px){width:56.2%;}"],h.breakpoints.medium,Object(h.spacing)(2),h.breakpoints.wide),A=I.a.h1.withConfig({displayName:"responsive__HeadlineContainer",componentId:"ba1gpd-4"})(["border:0px solid black;box-sizing:border-box;display:inline;font-family:sans-serif;margin:0px;padding:0px;white-space:pre-wrap;overflow-wrap:break-word;font-weight:400;",";@media (min-width:","px){font-size:","px;line-height:50px;margin-bottom:",";}"],e=>e.styles&&e.styles,h.breakpoints.medium,h.fontSizes.articleHeadline,Object(h.spacing)(1)),V=(I()(s.TcView).withConfig({displayName:"responsive__LabelContainer",componentId:"ba1gpd-5"})(["@media (min-width:","px){margin-top:0px;}"],h.breakpoints.wide),I()(s.TcView).withConfig({displayName:"responsive__Meta",componentId:"ba1gpd-6"})([""," max-width:100%;justify-content:center;@media (min-width:","px){margin-top:0;}"],e=>e.styles&&e.styles,h.breakpoints.medium)),F=I()(s.TcView).withConfig({displayName:"responsive__MetaContainer",componentId:"ba1gpd-7"})(["align-items:center;justify-content:center;@media (min-width:","px){flex-direction:row;flex-wrap:wrap;}"],h.breakpoints.medium),L=I()(s.TcView).withConfig({displayName:"responsive__Separator",componentId:"ba1gpd-8"})(["display:none;@media (min-width:","px){background-color:",";display:flex;height:",";margin:0 ",";width:1px;}"],h.breakpoints.medium,h.colours.functional.keyline,Object(h.spacing)(3),Object(h.spacing)(2)),M=I.a.h2.withConfig({displayName:"responsive__StandfirstContainer",componentId:"ba1gpd-9"})(["border:0px solid black;box-sizing:border-box;display:inline;margin:0px;padding:0px;white-space:pre-wrap;overflow-wrap:break-word;font-weight:400;",";@media (min-width:","px){font-size:","px;line-height:","px;margin-bottom:",";}@media (min-width:","px){margin-bottom:",";}"],e=>e.styles&&e.styles,h.breakpoints.medium,h.fontSizes.infoTitle,Object(h.lineHeight)({font:"bodyRegular",fontSize:"infoTitle"}),Object(h.spacing)(5),h.breakpoints.wide,Object(h.spacing)(4));var B=e=>{let t=e.bylines,r=e.publicationName,a=e.publishedTime;return i.a.createElement(F,null,Object(S.hasBylineData)(t)&&i.a.createElement(n.Fragment,null,i.a.createElement(V,{styles:C.meta},i.a.createElement(S.ArticleBylineWithLinks,{ast:t})),i.a.createElement(L,null)),i.a.createElement(V,{styles:C.meta},i.a.createElement(N,{styles:Object(s.checkStylesForUnits)(C.datePublication)},i.a.createElement(_.a,{date:a,publication:r}))))};const W=e=>{let t=e.standfirst;return t?i.a.createElement(M,{role:"heading","aria-level":"2",styles:Object(s.checkStylesForUnits)(C.standFirst),testID:"standfirst"},t):null};W.defaultProps={standfirst:null};var U=W;w.a.string.isRequired,w.a.arrayOf(w.a.shape({})).isRequired,w.a.arrayOf(w.a.shape({expiryTime:w.a.string,type:w.a.string})),w.a.bool,w.a.string.isRequired,w.a.string,w.a.bool,w.a.string.isRequired,w.a.string.isRequired,w.a.bool,w.a.string,w.a.string;function G(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function Q(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?G(Object(r),!0).forEach((function(t){J(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):G(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function J(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}const K=e=>{let t=e.authorImage,r=e.bylines,n=e.flags,a=e.hasVideo,o=e.headline,p=e.label,u=e.publicationName,m=e.showAudioPlayer,b=e.publishedTime,g=e.standfirst,f=e.updatedTime;return i.a.createElement(z,{style:Q(Q({},C.header),C.container)},i.a.createElement(R,{style:C.authorImage},i.a.createElement(d.a,{aspectRatio:1,uri:t,accessibilityLabel:"author-image"})),i.a.createElement(E,{isVideo:a,label:p}),i.a.createElement(A,{role:"heading","aria-level":"1",styles:Object(s.checkStylesForUnits)(C.articleHeadline)},o),i.a.createElement(H,null,i.a.createElement(l.UpdatedTimeProvider,{updatedTime:f},i.a.createElement(l.ArticleFlags,{flags:n}))),i.a.createElement(U,{standfirst:g}),i.a.createElement(B,{bylines:r,publicationName:u,publishedTime:b}),i.a.createElement(c.TCThemeProvider,null,i.a.createElement(c.InArticleAudio,{showAudioPlayer:m,src:"",readyToPlayText:"Listen to article",playingText:"Playing",narrator:r?r[0].byline[0].children[0].attributes.value:"",headline:o,feedback:{requestFeedback:!0,feedbackMessage:"Want to listen to more articles? Give your feedback below or email",thankyouMessage:"Thank you for your feedback. We're always trying to give you the best possible experience – your feedback helps us do this."}})))};K.defaultProps={flags:[],hasVideo:!1,label:null,longRead:!1,standfirst:null,updatedTime:null};var X=K;function Y(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function Z(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Y(Object(r),!0).forEach((function(t){$(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Y(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function $(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}Z(Z({},{analyticsStream:w.a.func.isRequired,article:w.a.shape({}),error:w.a.shape({graphQLErrors:w.a.array,message:w.a.string,networkError:w.a.shape({message:w.a.string})}),isLoading:w.a.bool,onImagePress:w.a.func,receiveChildList:w.a.func.isRequired,zephrDivs:w.a.bool,showAudioPlayer:w.a.bool}),{},{navigationMode:w.a.shape({}).isRequired,storefrontConfig:w.a.string.isRequired});const ee=Z({},{article:null,error:null,isLoading:!1,onImagePress:null,showAudioPlayer:!1});class te extends n.Component{constructor(e){super(e),this.renderHeader=this.renderHeader.bind(this)}renderHeader(){const e=this.props,t=e.article,r=e.showAudioPlayer,n=t.bylines,a=t.expirableFlags,o=t.hasVideo,l=t.headline,c=t.label,p=t.publicationName,d=t.publishedTime,u=t.shortHeadline,m=t.standfirst,b=t.updatedTime,g=n&&n.length>0&&n[0].image&&0!==Object.keys(n[0].image).length&&n[0].image.crop?n[0].image.crop.url:null;return i.a.createElement(X,{authorImage:g,bylines:n,flags:a,hasVideo:o,headline:Object(s.getHeadline)(l,u),label:c,publicationName:p,publishedTime:d,standfirst:m,updatedTime:b,showAudioPlayer:r})}render(){const e=this.props,t=e.article,r=e.analyticsStream,n=e.error,a=e.isLoading,s=e.logoUrl,l=e.navigationMode,c=e.receiveChildList,p=e.commentingConfig,d=e.paidContentClassName,u=e.isPreview,m=e.showAudioPlayer,b=e.swgProductId,g=e.zephrDivs,f=e.storefrontConfig;return n||a?null:i.a.createElement(o.a,{analyticsStream:r,data:t,Header:this.renderHeader,logoUrl:s,receiveChildList:c,navigationMode:l,commentingConfig:p,paidContentClassName:d,isPreview:u,swgProductId:b,zephrDivs:g,showAudioPlayer:m,storefrontConfig:f})}}te.defaultProps=ee;t.default=te}]);
1
+ module.exports=function(e){var t={};function i(n){if(t[n])return t[n].exports;var r=t[n]={i:n,l:!1,exports:{}};return e[n].call(r.exports,r,r.exports,i),r.l=!0,r.exports}return i.m=e,i.c=t,i.d=function(e,t,n){i.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},i.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},i.t=function(e,t){if(1&t&&(e=i(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(i.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)i.d(n,r,function(t){return e[t]}.bind(null,r));return n},i.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return i.d(t,"a",t),t},i.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},i.p="",i(i.s=15)}([function(e,t){e.exports=require("@times-components/ts-styleguide/rnw")},function(e,t){e.exports=require("prop-types")},function(e,t){e.exports=require("react")},function(e,t){e.exports=require("@times-components/utils/rnw")},function(e,t){e.exports=require("styled-components")},function(e,t){e.exports=require("@times-components/ts-newskit/rnw")},function(e,t){e.exports=require("@times-components/ts-components/rnw")},function(e,t){e.exports=require("@times-components/article-byline/rnw")},function(e,t){e.exports=require("@times-components/article-skeleton/rnw")},function(e,t){e.exports=require("newskit")},function(e,t){e.exports=require("@times-components/image/rnw")},function(e,t){e.exports=require("@times-components/article-label/rnw")},function(e,t){e.exports=require("@times-components/video-label/rnw")},function(e,t){e.exports=require("@times-components/context/rnw")},function(e,t){e.exports=require("@times-components/date-publication/rnw")},function(e,t,i){"use strict";i.r(t);var n=i(2),r=i.n(n),o=i(8),a=i.n(o),s=i(3),l=i(5),c=i(9),p=i(6),d=i(10),u=i.n(d),m=i(11),b=i.n(m),g=i(12),f=i.n(g),h=i(13),y=i.n(h),w=i(0),O=i(1),j=i.n(O);j.a.bool,j.a.string;function v(e,t){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),i.push.apply(i,n)}return i}function x(e){for(var t=1;t<arguments.length;t++){var i=null!=arguments[t]?arguments[t]:{};t%2?v(Object(i),!0).forEach((function(t){P(e,t,i[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):v(Object(i)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(i,t))}))}return e}function P(e,t,i){return t in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}function C(e,t){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),i.push.apply(i,n)}return i}function k(e,t,i){return t in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}var z=function(e){for(var t=1;t<arguments.length;t++){var i=null!=arguments[t]?arguments[t]:{};t%2?C(Object(i),!0).forEach((function(t){k(e,t,i[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):C(Object(i)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(i,t))}))}return e}({},{articleHeadline:x(x({},Object(w.fontFactory)({font:"headline",fontSize:"headline"})),{},{color:w.colours.functional.brandColour,marginBottom:Object(w.spacing)(2),textAlign:"center"}),articleHeadlineTablet:x({},Object(w.fontFactory)({font:"headline",fontSize:"articleHeadline"})),authorImage:{marginBottom:Object(w.spacing)(5)},container:{alignItems:"center",paddingLeft:Object(w.spacing)(2),paddingRight:Object(w.spacing)(2)},datePublication:x(x({},Object(w.fontFactory)({font:"supporting",fontSize:"cardMeta"})),{},{color:w.colours.functional.secondary,marginTop:Object(w.spacing)(1)}),datePublicationTablet:{marginTop:"auto"},header:{marginBottom:Object(w.spacing)(3),paddingBottom:Object(w.spacing)(4),paddingTop:Object(w.spacing)(7)},label:{marginBottom:Object(w.spacing)(2)},meta:{flexDirection:"row",flexWrap:"wrap"},metaContainer:{alignItems:"center",width:"100%",paddingTop:Object(w.spacing)(2),paddingBottom:Object(w.spacing)(2),borderBottomColor:w.colours.functional.keyline,borderBottomWidth:1,borderTopColor:w.colours.functional.keyline,borderTopWidth:1},metaContainerTablet:{flexDirection:"row",justifyContent:"center"},separator:{borderRightColor:w.colours.functional.keyline,borderRightWidth:1,height:Object(w.spacing)(3),marginLeft:Object(w.spacing)(2),marginRight:Object(w.spacing)(2)},standFirst:x(x({},Object(w.fontFactory)({font:"headlineRegular",fontSize:"smallestHeadline"})),{},{color:w.colours.functional.primary,marginBottom:Object(w.spacing)(3),paddingLeft:Object(w.spacing)(2),paddingRight:Object(w.spacing)(2),textAlign:"center"})});const E=e=>{let t=e.isVideo,i=e.label;if(!t&&!i)return null;const n=t?f.a:b.a;return r.a.createElement(y.a.Consumer,null,e=>{let t=e.theme.sectionColour;return r.a.createElement(s.TcView,{style:z.label},r.a.createElement(n,{color:t||w.colours.section.default,title:i}))})};E.defaultProps={isVideo:!1,label:null};var T=E,S=i(7),q=i(14),R=i.n(q);j.a.arrayOf(j.a.shape({})).isRequired,j.a.string.isRequired,j.a.string.isRequired;var _=i(4),I=i.n(_);const D=I()(s.TcView).withConfig({displayName:"responsive__AuthorImageContainer",componentId:"ba1gpd-0"})(["border-radius:50%;height:100px;overflow:hidden;width:100px;@media (min-width:","px){height:118px;width:118px;}"],w.breakpoints.medium),F=I()(s.TcText).withConfig({displayName:"responsive__DatePublicationContainer",componentId:"ba1gpd-1"})(["",";flex-direction:row;flex-wrap:wrap;margin-top:",";@media (min-width:","px){margin-top:0;}"],e=>e.styles&&e.styles,Object(w.spacing)(3),w.breakpoints.medium),N=I()(s.TcView).withConfig({displayName:"responsive__FlagsContainer",componentId:"ba1gpd-2"})(["padding-top:",";padding-bottom:",";@media (min-width:","px){padding-top:0;}"],Object(w.spacing)(1),Object(w.spacing)(3),w.breakpoints.medium),L=I()(s.TcView).withConfig({displayName:"responsive__HeaderContainer",componentId:"ba1gpd-3"})(["order:2;z-index:1;@media (min-width:","px){width:80.8%;margin:0 auto ",";margin-left:auto;margin-right:auto;}@media (min-width:","px){width:56.2%;}"],w.breakpoints.medium,Object(w.spacing)(2),w.breakpoints.wide),A=I.a.h1.withConfig({displayName:"responsive__HeadlineContainer",componentId:"ba1gpd-4"})(["border:0px solid black;box-sizing:border-box;display:inline;font-family:sans-serif;margin:0px;padding:0px;white-space:pre-wrap;overflow-wrap:break-word;font-weight:400;",";@media (min-width:","px){font-size:","px;line-height:50px;margin-bottom:",";}"],e=>e.styles&&e.styles,w.breakpoints.medium,w.fontSizes.articleHeadline,Object(w.spacing)(1)),H=(I()(s.TcView).withConfig({displayName:"responsive__LabelContainer",componentId:"ba1gpd-5"})(["@media (min-width:","px){margin-top:0px;}"],w.breakpoints.wide),I()(s.TcView).withConfig({displayName:"responsive__Meta",componentId:"ba1gpd-6"})([""," max-width:100%;justify-content:center;@media (min-width:","px){margin-top:0;}"],e=>e.styles&&e.styles,w.breakpoints.medium)),B=I()(s.TcView).withConfig({displayName:"responsive__MetaContainer",componentId:"ba1gpd-7"})(["align-items:center;justify-content:center;@media (min-width:","px){flex-direction:row;flex-wrap:wrap;}"],w.breakpoints.medium),V=I()(s.TcView).withConfig({displayName:"responsive__Separator",componentId:"ba1gpd-8"})(["display:none;@media (min-width:","px){background-color:",";display:flex;height:",";margin:0 ",";width:1px;}"],w.breakpoints.medium,w.colours.functional.keyline,Object(w.spacing)(3),Object(w.spacing)(2)),M=I.a.h2.withConfig({displayName:"responsive__StandfirstContainer",componentId:"ba1gpd-9"})(["border:0px solid black;box-sizing:border-box;display:inline;margin:0px;padding:0px;white-space:pre-wrap;overflow-wrap:break-word;font-weight:400;",";@media (min-width:","px){font-size:","px;line-height:","px;margin-bottom:",";}@media (min-width:","px){margin-bottom:",";}"],e=>e.styles&&e.styles,w.breakpoints.medium,w.fontSizes.infoTitle,Object(w.lineHeight)({font:"bodyRegular",fontSize:"infoTitle"}),Object(w.spacing)(5),w.breakpoints.wide,Object(w.spacing)(4)),U=I.a.div.withConfig({displayName:"responsive__PuzzlesSidebar",componentId:"ba1gpd-10"})(["padding-left:",";position:absolute;right:0;z-index:1;top:100%;display:none;@media (min-width:","px){display:block;width:19.8333%;padding-right:",";}@media (min-width:","px){display:block;width:18.8333%;padding-right:",";}"],Object(w.spacing)(4),w.breakpoints.wide,Object(w.spacing)(8),w.breakpoints.huge,Object(w.spacing)(10));var W=e=>{let t=e.bylines,i=e.publicationName,o=e.publishedTime;return r.a.createElement(B,null,Object(S.hasBylineData)(t)&&r.a.createElement(n.Fragment,null,r.a.createElement(H,{styles:z.meta},r.a.createElement(S.ArticleBylineWithLinks,{ast:t})),r.a.createElement(V,null)),r.a.createElement(H,{styles:z.meta},r.a.createElement(F,{styles:Object(s.checkStylesForUnits)(z.datePublication)},r.a.createElement(R.a,{date:o,publication:i}))))};const G=e=>{let t=e.standfirst;return t?r.a.createElement(M,{role:"heading","aria-level":"2",styles:Object(s.checkStylesForUnits)(z.standFirst),testID:"standfirst"},t):null};G.defaultProps={standfirst:null};var K=G;j.a.string.isRequired,j.a.arrayOf(j.a.shape({})).isRequired,j.a.arrayOf(j.a.shape({expiryTime:j.a.string,type:j.a.string})),j.a.bool,j.a.string.isRequired,j.a.string,j.a.bool,j.a.string.isRequired,j.a.string.isRequired,j.a.bool,j.a.string,j.a.string;function Q(e,t){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),i.push.apply(i,n)}return i}function Y(e){for(var t=1;t<arguments.length;t++){var i=null!=arguments[t]?arguments[t]:{};t%2?Q(Object(i),!0).forEach((function(t){J(e,t,i[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):Q(Object(i)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(i,t))}))}return e}function J(e,t,i){return t in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}const X=e=>{let t=e.authorImage,i=e.bylines,n=e.flags,o=e.hasVideo,a=e.headline,c=e.label,d=e.publicationName,m=e.showAudioPlayer,b=e.publishedTime,g=e.standfirst,f=e.updatedTime;return r.a.createElement(L,{style:Y(Y({},z.header),z.container)},r.a.createElement(D,{style:z.authorImage},r.a.createElement(u.a,{aspectRatio:1,uri:t,accessibilityLabel:"author-image"})),r.a.createElement(T,{isVideo:o,label:c}),r.a.createElement(A,{role:"heading","aria-level":"1",styles:Object(s.checkStylesForUnits)(z.articleHeadline)},a),r.a.createElement(N,null,r.a.createElement(p.UpdatedTimeProvider,{updatedTime:f},r.a.createElement(p.ArticleFlags,{flags:n}))),r.a.createElement(K,{standfirst:g}),r.a.createElement(W,{bylines:i,publicationName:d,publishedTime:b}),r.a.createElement(l.TCThemeProvider,null,r.a.createElement(l.InArticleAudio,{showAudioPlayer:m,src:"",readyToPlayText:"Listen to article",playingText:"Playing",narrator:i?i[0].byline[0].children[0].attributes.value:"",headline:a,feedback:{requestFeedback:!0,feedbackMessage:"Want to listen to more articles? Give your feedback below or email",thankyouMessage:"Thank you for your feedback. We're always trying to give you the best possible experience – your feedback helps us do this."}})))};X.defaultProps={flags:[],hasVideo:!1,label:null,longRead:!1,standfirst:null,updatedTime:null};var Z=X;function $(e,t){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),i.push.apply(i,n)}return i}function ee(e){for(var t=1;t<arguments.length;t++){var i=null!=arguments[t]?arguments[t]:{};t%2?$(Object(i),!0).forEach((function(t){te(e,t,i[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(i)):$(Object(i)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(i,t))}))}return e}function te(e,t,i){return t in e?Object.defineProperty(e,t,{value:i,enumerable:!0,configurable:!0,writable:!0}):e[t]=i,e}ee(ee({},{analyticsStream:j.a.func.isRequired,article:j.a.shape({}),error:j.a.shape({graphQLErrors:j.a.array,message:j.a.string,networkError:j.a.shape({message:j.a.string})}),isLoading:j.a.bool,onImagePress:j.a.func,receiveChildList:j.a.func.isRequired,zephrDivs:j.a.bool,showAudioPlayer:j.a.bool}),{},{navigationMode:j.a.shape({}).isRequired,storefrontConfig:j.a.string.isRequired});const ie=ee({},{article:null,error:null,isLoading:!1,onImagePress:null,showAudioPlayer:!1});class ne extends n.Component{constructor(e){super(e),this.renderHeader=this.renderHeader.bind(this),this.state={initialPosition:0},this.sidebarRef=r.a.createRef(),this.handleScroll=this.handleScroll.bind(this)}componentDidMount(){window.addEventListener("scroll",this.handleScroll);const e=this.sidebarRef.current;if(e){const t=e.getBoundingClientRect(),i=40;this.setState({initialPosition:t.top-i})}}componentWillUnmount(){window.removeEventListener("scroll",this.handleScroll)}handleScroll(){const e=this.sidebarRef.current;if(e){const t=e.getBoundingClientRect(),i=document.querySelector(".responsive__InlineAdWrapper-sc-4v1r4q-17"),n=document.getElementById("related-articles");let r=!1,o=!1;if(i){const e=i.getBoundingClientRect();r=e.top<=t.bottom&&e.bottom>=t.top}if(n){const e=n.getBoundingClientRect();o=e.top<=window.innerHeight&&e.bottom>=0}const a=this.state.initialPosition,s=40;if(r||o)e.style.transition="opacity 0.5s ease",e.style.opacity="0";else{const i=t.top<=s&&window.scrollY>a;e.style.transition="opacity 0.5s ease",e.style.opacity="1",e.style.position=i?"fixed":"absolute",e.style.top=i?"".concat(s,"px"):"100%"}}}renderHeader(){const e=this.props,t=e.article,i=e.showAudioPlayer,n=t.bylines,o=t.expirableFlags,a=t.hasVideo,p=t.headline,d=t.label,u=t.publicationName,m=t.publishedTime,b=t.shortHeadline,g=t.standfirst,f=t.updatedTime,h=t.section,y=n&&n.length>0&&n[0].image&&0!==Object.keys(n[0].image).length&&n[0].image.crop?n[0].image.crop.url:null;return r.a.createElement(r.a.Fragment,null,r.a.createElement(Z,{authorImage:y,bylines:n,flags:o,hasVideo:a,headline:Object(s.getHeadline)(p,b),label:d,publicationName:u,publishedTime:m,standfirst:g,updatedTime:f,showAudioPlayer:i}),Object(s.CanShowPuzzleSidebar)(h)&&r.a.createElement(c.NewsKitProvider,{theme:l.PuzzlesWebLightTheme},r.a.createElement(U,{ref:this.sidebarRef},r.a.createElement(l.ArticleSidebar,{pageLink:"https://www.thetimes.co.uk/puzzles",sectionTitle:"Puzzles",data:[{title:"Crossword",url:"https://www.thetimes.co.uk/puzzles/crossword",imgUrl:"https://www.thetimes.co.uk/imageserver/image/%2Fpuzzles%2Ficons%2F33b27655-dcc9-421f-906f-b2b10dd26865.png?crop=1250%2C833%2C0%2C0&resize=500"},{title:"Polygon",url:"https://www.thetimes.co.uk/puzzles/word-puzzles",imgUrl:"https://www.thetimes.co.uk/imageserver/image/%2Fpuzzles%2Ficons%2F33b27655-dcc9-421f-906f-b2b10dd26865.png?crop=1250%2C833%2C0%2C0&resize=500"},{title:"Sudoku",url:"https://www.thetimes.co.uk/puzzles/sudoku",imgUrl:"https://www.thetimes.co.uk/imageserver/image/%2Fpuzzles%2Ficons%2F33b27655-dcc9-421f-906f-b2b10dd26865.png?crop=1250%2C833%2C0%2C0&resize=500"}]}))))}render(){const e=this.props,t=e.article,i=e.analyticsStream,n=e.error,o=e.isLoading,s=e.logoUrl,l=e.navigationMode,c=e.receiveChildList,p=e.commentingConfig,d=e.paidContentClassName,u=e.isPreview,m=e.showAudioPlayer,b=e.swgProductId,g=e.zephrDivs,f=e.storefrontConfig;return n||o?null:r.a.createElement(a.a,{analyticsStream:i,data:t,Header:this.renderHeader,logoUrl:s,receiveChildList:c,navigationMode:l,commentingConfig:p,paidContentClassName:d,isPreview:u,swgProductId:b,zephrDivs:g,showAudioPlayer:m,storefrontConfig:f})}}ne.defaultProps=ie;t.default=ne}]);