@times-components/article-comments 0.53.0 → 0.54.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.
package/CHANGELOG.md CHANGED
@@ -3,6 +3,17 @@
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
+ # [0.54.0](https://github.com/newsuk/times-components/compare/@times-components/article-comments@0.53.0...@times-components/article-comments@0.54.0) (2025-06-18)
7
+
8
+
9
+ ### Features
10
+
11
+ * **TMRA-344:** add divider to disabled comments ([#4170](https://github.com/newsuk/times-components/issues/4170)) ([d5edf14](https://github.com/newsuk/times-components/commit/d5edf14e603dcd185e74b0aa39d984a32a7e96da))
12
+
13
+
14
+
15
+
16
+
6
17
  # [0.53.0](https://github.com/newsuk/times-components/compare/@times-components/article-comments@0.52.1...@times-components/article-comments@0.53.0) (2025-06-17)
7
18
 
8
19
 
@@ -15,7 +15,7 @@ var _styles = _interopRequireDefault(require("./styles"));
15
15
 
16
16
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
17
17
 
18
- const DisabledComments = () => /*#__PURE__*/_react.default.createElement(_responsive.CommentContainer, null, /*#__PURE__*/_react.default.createElement(_responsive.CommentDisabledHeadline, null, "Comments are not enabled for this article"), /*#__PURE__*/_react.default.createElement(_responsive.CommentDisabledGuidelines, null, "Comments are subject to our community guidelines, which can be viewed", " ", /*#__PURE__*/_react.default.createElement(_link.TextLink, {
18
+ const DisabledComments = () => /*#__PURE__*/_react.default.createElement(_responsive.CommentContainer, null, /*#__PURE__*/_react.default.createElement(_responsive.CommentDisabledHeadline, null, "Comments are not enabled for this article"), /*#__PURE__*/_react.default.createElement(_responsive.Divider, null), /*#__PURE__*/_react.default.createElement(_responsive.CommentDisabledGuidelines, null, "Comments are subject to our community guidelines, which can be viewed", " ", /*#__PURE__*/_react.default.createElement(_link.TextLink, {
19
19
  style: _styles.default.link,
20
20
  url: "/article/f4024fbe-d989-11e6-9063-500e6740fc32"
21
21
  }, "here"), "."));
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.CommentDisabledHeadline = exports.CommentDisabledGuidelines = exports.CommentEnabledGuidelines = exports.CommentContainer = void 0;
6
+ exports.Divider = exports.CommentDisabledHeadline = exports.CommentDisabledGuidelines = exports.CommentEnabledGuidelines = exports.CommentContainer = void 0;
7
7
 
8
8
  var _styledComponents = _interopRequireDefault(require("styled-components"));
9
9
 
@@ -37,4 +37,11 @@ const CommentDisabledHeadline = _styledComponents.default.p.withConfig({
37
37
  componentId: "sc-2j1dkf-3"
38
38
  })(["color:", ";font-family:", ";font-size:", "px;font-weight:300;margin:0;padding-bottom:", ";padding-top:", ";text-align:center;"], _tsStyleguide.colours.functional.primary, _tsStyleguide.fontsWithFallback.headlineLight, _tsStyleguide.fontSizes.commentsHeadline, (0, _tsStyleguide.spacing)(1), (0, _tsStyleguide.spacing)(6));
39
39
 
40
- exports.CommentDisabledHeadline = CommentDisabledHeadline;
40
+ exports.CommentDisabledHeadline = CommentDisabledHeadline;
41
+
42
+ const Divider = _styledComponents.default.hr.withConfig({
43
+ displayName: "responsive__Divider",
44
+ componentId: "sc-2j1dkf-4"
45
+ })(["margin:4px auto 12px;max-width:456px;width:100%;border:none;border-top:1px solid #e4e4e4;"]);
46
+
47
+ exports.Divider = Divider;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@times-components/article-comments",
3
- "version": "0.53.0",
3
+ "version": "0.54.0",
4
4
  "description": "Article Comments",
5
5
  "main": "dist/article-comments",
6
6
  "dev": "src/article-comments",
@@ -33,12 +33,12 @@
33
33
  },
34
34
  "homepage": "https://github.com/newsuk/times-components#readme",
35
35
  "dependencies": {
36
- "@times-components/link": "3.18.4",
37
- "@times-components/tracking": "2.24.1",
38
- "@times-components/ts-components": "1.132.0",
39
- "@times-components/ts-styleguide": "1.55.0",
40
- "@times-components/user-state": "0.7.6",
41
- "@times-components/utils": "6.31.10",
36
+ "@times-components/link": "3.18.5",
37
+ "@times-components/tracking": "2.25.0",
38
+ "@times-components/ts-components": "1.133.0",
39
+ "@times-components/ts-styleguide": "1.55.1",
40
+ "@times-components/user-state": "0.7.7",
41
+ "@times-components/utils": "6.31.11",
42
42
  "prop-types": "15.7.2",
43
43
  "styled-components": "4.3.2"
44
44
  },
@@ -48,7 +48,7 @@
48
48
  "@testing-library/react": "^12.1.2",
49
49
  "@times-components/eslint-config-thetimes": "0.8.18",
50
50
  "@times-components/jest-configurator-web": "0.8.2",
51
- "@times-components/storybook": "4.14.1",
51
+ "@times-components/storybook": "4.15.0",
52
52
  "@times-components/webpack-configurator": "2.1.1",
53
53
  "babel-jest": "24.8.0",
54
54
  "eslint": "5.9.0",
@@ -71,5 +71,5 @@
71
71
  "publishConfig": {
72
72
  "access": "public"
73
73
  },
74
- "gitHead": "8049c9a779847817de79ca5e103b9d81a397be39"
74
+ "gitHead": "63351111a0373995135d30e1a5edb354aff8257d"
75
75
  }
package/rnw.js CHANGED
@@ -1 +1 @@
1
- module.exports=function(e){var t={};function n(o){if(t[o])return t[o].exports;var i=t[o]={i:o,l:!1,exports:{}};return e[o].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=e,n.c=t,n.d=function(e,t,o){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:o})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var o=Object.create(null);if(n.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)n.d(o,i,function(t){return e[t]}.bind(null,i));return o},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=8)}([function(e,t){e.exports=require("@times-components/ts-styleguide/rnw")},function(e,t){e.exports=require("react")},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("prop-types")},function(e,t){e.exports=require("@times-components/utils/rnw")},function(e,t){e.exports=require("@times-components/tracking/rnw")},function(e,t){e.exports=require("@times-components/link/rnw")},function(e,t,n){"use strict";n.r(t);var o=n(1),i=n.n(o),r=(n(4),n(5)),a=n(3),c=n(2),m=n.n(c),s=n(0);const l=m.a.div.withConfig({displayName:"responsive__CommentContainer",componentId:"sc-2j1dkf-0"})(["margin-left:auto;margin-right:auto;@media (min-width:","px){width:80.8%;}@media (min-width:","px){width:56.2%;}"],s.breakpoints.medium,s.breakpoints.wide),u=(m.a.p.withConfig({displayName:"responsive__CommentEnabledGuidelines",componentId:"sc-2j1dkf-1"})(["color:",";font-family:",";font-size:","px;margin:0 0 "," 0;padding-left:7px;padding-top:",";"],s.colours.functional.secondary,s.fontsWithFallback.supporting,s.fontSizes.commentsGuidelines,Object(s.spacing)(-2),Object(s.spacing)(6)),m.a.p.withConfig({displayName:"responsive__CommentDisabledGuidelines",componentId:"sc-2j1dkf-2"})(["color:",";font-family:",";font-size:","px;margin:0;padding-bottom:",";padding-top:",";text-align:center;"],s.colours.functional.secondary,s.fontsWithFallback.supporting,s.fontSizes.commentsGuidelines,Object(s.spacing)(6),Object(s.spacing)(1))),d=m.a.p.withConfig({displayName:"responsive__CommentDisabledHeadline",componentId:"sc-2j1dkf-3"})(["color:",";font-family:",";font-size:","px;font-weight:300;margin:0;padding-bottom:",";padding-top:",";text-align:center;"],s.colours.functional.primary,s.fontsWithFallback.headlineLight,s.fontSizes.commentsHeadline,Object(s.spacing)(1),Object(s.spacing)(6));function p(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=e&&("undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"]);if(null==n)return;var o,i,r=[],a=!0,c=!1;try{for(n=n.call(e);!(a=(o=n.next()).done)&&(r.push(o.value),!t||r.length!==t);a=!0);}catch(e){c=!0,i=e}finally{try{a||null==n.return||n.return()}finally{if(c)throw i}}return r}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return f(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return f(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function f(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=new Array(t);n<t;n++)o[n]=e[n];return o}var g=e=>e?(e=>e.split("&").reduce((e,t)=>{const n=p(t.split("="),2),o=n[0],i=n[1];return e[o]=i,e},{}))(e).eid:void 0;const C=(e,t)=>((e,t)=>{const n=new XMLHttpRequest;n.addEventListener("load",()=>{const e=(200===n.status?JSON.parse(n.response):{}).spotimCodeB;e&&t(e)}),n.open("GET",e),n.send()})("/api/comments/loginv2?codeA=".concat(encodeURIComponent(e)),t);var b=()=>{if(window.SPOTIM&&window.SPOTIM.startSSO){const e=window&&window.nuk&&window.nuk.getCookieValue&&window.nuk.getCookieValue("acs_tnl"),t="".concat(g(e),"_v2");window.SPOTIM.startSSO({callback:C,userId:t})}},y=n(6);class v extends o.Component{constructor(){super(),this.container=null}componentDidMount(){this.initialiseComments()}componentWillUnmount(){this.disposeComments()}initialiseComments(){const e=this.props,t=e.articleId,n=e.isReadOnly,o=e.commentingConfig,i=e.onCommentStart,r=e.onCommentPost,a=e.onCommentNotification,c=e.onCommentFilterNewest,m=e.onCommentFilterMostRecommended,s=e.onCommentFilterOldest,l=e.onCommentReplyClick,u=e.onCommentShareLink,d=e.onCommentShareTwitter,p=e.onCommentShareEmail,f=e.onCommentShareFacebook,g=e.onCommentRecommend,C=e.onCommentNotificationClicked,y=e.onCommentUsernameClicked,v=e.onCommentSettingsClicked,h=e.viewMoreComments,w=e.domainSpecificUrl;if(!this.container||!t||!o)return;document.addEventListener("spot-im-current-user-typing-start",i),document.addEventListener("spot-im-current-user-sent-message",r),document.addEventListener("spot-im-notification-drop-down-link",a),document.addEventListener("spot-im-user-up-vote-click",g),document.addEventListener("spot-im-sort-by-select",e=>(e=>{switch(e.detail.sortedBy){case"best":return m(e);case"oldest":return s(e);case"newest":return c(e);default:return null}})(e)),document.addEventListener("spot-im-user-clicked-reply",l),document.addEventListener("spot-im-clicked-settings",v),document.addEventListener("spot-im-user-notifications-click",C),document.addEventListener("spot-im-open-user-profile",y),document.addEventListener("spot-im-show-more-comments-clicked",h),document.addEventListener("spot-im-share-type",e=>(e=>{switch(e.detail.type){case"link":return u(e);case"email":return p(e);case"twitter":return d(e);case"facebook":return f(e);default:return null}})(e)),n||(window.SPOTIM&&window.SPOTIM.startSSO?b():document.addEventListener("spot-im-api-ready",()=>{b()})),document.addEventListener("spot-im-renew-sso",()=>{b()});const k=document.createElement("script");k.setAttribute("async","async"),k.setAttribute("src","https://launcher.spot.im/spot/".concat(o.account)),k.setAttribute("data-spotim-module","spotim-launcher"),k.setAttribute("data-post-id",t),k.setAttribute("data-post-url","".concat(w,"/article/").concat(t)),k.setAttribute("data-seo-enabled",!0),k.setAttribute("data-livefyre-url",t),this.container.appendChild(k)}disposeComments(){this.container&&(this.container.innerHTML="")}render(){const e=this.props,t=e.onCommentStart,n=e.onCommentPost,o=e.onCommentNotification,r=e.onCommentFilterNewest,a=e.onCommentFilterMostRecommended,c=e.onCommentFilterOldest,m=e.onCommentReplyClick,s=e.onCommentShareLink,u=e.onCommentShareTwitter,d=e.onCommentShareEmail,p=e.onCommentShareFacebook,f=e.onCommentRecommend,g=e.onCommentNotificationClicked,C=e.onCommentUsernameClicked,b=e.onCommentSettingsClicked,y=e.viewMoreComments;return i.a.createElement(l,{id:"comments-container",onCommentStart:t,onCommentPost:n,onCommentNotification:o,onCommentReplyClick:m,onCommentFilterNewest:r,onCommentFilterMostRecommended:a,onCommentFilterOldest:c,onCommentShareLink:s,onCommentShareTwitter:u,onCommentShareEmail:d,onCommentShareFacebook:p,onCommentRecommend:f,onCommentNotificationClicked:g,onCommentUsernameClicked:C,onCommentSettingsClicked:b,viewMoreComments:y},i.a.createElement("div",{ref:e=>{this.container=e}}))}}v.defaultProps={onCommentStart:()=>{},onCommentPost:()=>{},onCommentNotification:()=>{},onCommentReplyClick:()=>{},onCommentFilterNewest:()=>{},onCommentFilterMostRecommended:()=>{},onCommentFilterOldest:()=>{},onCommentShareLink:()=>{},onCommentShareTwitter:()=>{},onCommentShareEmail:()=>{},onCommentShareFacebook:()=>{},onCommentRecommend:()=>{},onCommentNotificationClicked:()=>{},onCommentUsernameClicked:()=>{},onCommentSettingsClicked:()=>{},viewMoreComments:()=>{}};var h,w=(h=v,Object(y.withTrackEvents)(h,{analyticsEvents:[{actionName:"navigation",eventName:"onCommentStart",trackingName:"spot im : comment : start"},{actionName:"navigation",eventName:"onCommentPost",trackingName:"spot im : comment : complete"},{actionName:"navigation",eventName:"onCommentNotification",trackingName:"spot im : notification"},{actionName:"navigation",eventName:"onCommentFilterNewest",trackingName:"spot im : sort : newest"},{actionName:"navigation",eventName:"onCommentFilterMostRecommended",trackingName:"spot im : sort : best"},{actionName:"navigation",eventName:"onCommentFilterOldest",trackingName:"spot im : sort : oldest"},{actionName:"navigation",eventName:"onCommentReplyClick",trackingName:"spot im : reply"},{actionName:"navigation",eventName:"onCommentSettingsClicked",trackingName:"spot im : settings button clicked"},{actionName:"navigation",eventName:"onCommentShareLink",trackingName:"spot im : comment : share : copy link"},{actionName:"navigation",eventName:"onCommentShareEmail",trackingName:"spot im : comment : share : email"},{actionName:"navigation",eventName:"onCommentShareTwitter",trackingName:"spot im : comment : share : twitter"},{actionName:"navigation",eventName:"onCommentShareFacebook",trackingName:"spot im : comment : share : facebook"},{actionName:"navigation",eventName:"onCommentRecommend",trackingName:"spot im : vote up"},{actionName:"navigation",eventName:"onCommentUsernameClicked",trackingName:"spot im : username clicked"},{actionName:"navigation",eventName:"onCommentNotificationClicked",trackingName:"spot im : notification clicked"},{actionName:"navigation",eventName:"viewMoreComments",trackingName:"spot im : view more comments clicked"}]})),k=n(7);function O(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function S(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?O(Object(n),!0).forEach((function(t){N(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):O(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function N(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var j={button:{marginBottom:Object(s.spacing)(0),marginTop:Object(s.spacing)(5),maxWidth:215},container:{alignItems:"center",borderStyle:"solid",borderTopColor:s.colours.functional.keyline,borderTopWidth:1,marginBottom:Object(s.spacing)(10),width:"100%"},headline:S(S({color:s.colours.functional.primary},Object(s.fontFactory)({font:"headline",fontSize:"commentsHeadline"})),{},{maxWidth:315,paddingBottom:Object(s.spacing)(2),paddingTop:Object(s.spacing)(6),textAlign:"center"}),link:{color:s.colours.functional.action},supporting:S(S({},Object(s.fontFactory)({font:"supporting",fontSize:"tertiary"})),{},{color:s.colours.functional.secondary,maxWidth:280,textAlign:"center"})};function E(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function _(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?E(Object(n),!0).forEach((function(t){P(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):E(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function P(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var x=_(_({},j),{},{link:_(_({},j.link),{},{fontFamily:s.fontsWithFallback.supporting,fontSize:s.fontSizes.commentsGuidelines})});var F=()=>i.a.createElement(l,null,i.a.createElement(d,null,"Comments are not enabled for this article"),i.a.createElement(u,null,"Comments are subject to our community guidelines, which can be viewed"," ",i.a.createElement(k.TextLink,{style:x.link,url:"/article/f4024fbe-d989-11e6-9063-500e6740fc32"},"here"),"."));const T=(e,t)=>({attrs:{event_navigation_name:"".concat(e),event_navigation_browsing_method:"".concat(t)}});var I=e=>{let t=e.fireAnalyticsEvent;const n="undefined"!=typeof window&&window.__TIMES_CONFIG__&&window.__TIMES_CONFIG__.account&&window.__TIMES_CONFIG__.account.url;return Object(o.useEffect)(()=>{t&&t(T("upgrade sticky footer : displayed","automated"))},[]),i.a.createElement(a.InlineDialog,{title:"Join the conversation",buttonText:"Go to My account",href:n,onClick:()=>((e,t,n)=>{e&&e(T(t,n))})(t,"upgrade sticky footer : go to my account","click")},"Commenting is only available to unlimited access subscribers. Upgrade your subscription to have your say.")};function M(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=e&&("undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"]);if(null==n)return;var o,i,r=[],a=!0,c=!1;try{for(n=n.call(e);!(a=(o=n.next()).done)&&(r.push(o.value),!t||r.length!==t);a=!0);}catch(e){c=!0,i=e}finally{try{a||null==n.return||n.return()}finally{if(c)throw i}}return r}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return A(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return A(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function A(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=new Array(t);n<t;n++)o[n]=e[n];return o}const L=e=>{let t=e.articleId,n=e.isEnabled,c=e.isReadOnly,m=e.commentingConfig,s=e.domainSpecificUrl;const l=M(Object(o.useState)(void 0),2),u=l[0],d=l[1];return Object(o.useEffect)(()=>{const e=Object(r.getBase64CookieValue)("access-decisions");d(!!e&&Object(r.hasEntitlement)(e,"functionalCommentingFull"))},[]),void 0===u?null:n?u?i.a.createElement(w,{articleId:t,isReadOnly:c,commentingConfig:m,domainSpecificUrl:s}):i.a.createElement(a.TrackingContextProvider,{context:{component:"JoinTheConversationDialog",object:"JoinTheConversationDialog",attrs:{event_navigation_action:"navigation",article_parent_name:"commenting"}}},e=>{let t=e.fireAnalyticsEvent;return i.a.createElement(I,{fireAnalyticsEvent:t})}):i.a.createElement(F,null)};L.defaultProps={isReadOnly:!1};t.default=L}]);
1
+ module.exports=function(e){var t={};function n(o){if(t[o])return t[o].exports;var i=t[o]={i:o,l:!1,exports:{}};return e[o].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=e,n.c=t,n.d=function(e,t,o){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:o})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var o=Object.create(null);if(n.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)n.d(o,i,function(t){return e[t]}.bind(null,i));return o},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=8)}([function(e,t){e.exports=require("@times-components/ts-styleguide/rnw")},function(e,t){e.exports=require("react")},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("prop-types")},function(e,t){e.exports=require("@times-components/utils/rnw")},function(e,t){e.exports=require("@times-components/tracking/rnw")},function(e,t){e.exports=require("@times-components/link/rnw")},function(e,t,n){"use strict";n.r(t);var o=n(1),i=n.n(o),r=(n(4),n(5)),a=n(3),m=n(2),c=n.n(m),s=n(0);const l=c.a.div.withConfig({displayName:"responsive__CommentContainer",componentId:"sc-2j1dkf-0"})(["margin-left:auto;margin-right:auto;@media (min-width:","px){width:80.8%;}@media (min-width:","px){width:56.2%;}"],s.breakpoints.medium,s.breakpoints.wide),u=(c.a.p.withConfig({displayName:"responsive__CommentEnabledGuidelines",componentId:"sc-2j1dkf-1"})(["color:",";font-family:",";font-size:","px;margin:0 0 "," 0;padding-left:7px;padding-top:",";"],s.colours.functional.secondary,s.fontsWithFallback.supporting,s.fontSizes.commentsGuidelines,Object(s.spacing)(-2),Object(s.spacing)(6)),c.a.p.withConfig({displayName:"responsive__CommentDisabledGuidelines",componentId:"sc-2j1dkf-2"})(["color:",";font-family:",";font-size:","px;margin:0;padding-bottom:",";padding-top:",";text-align:center;"],s.colours.functional.secondary,s.fontsWithFallback.supporting,s.fontSizes.commentsGuidelines,Object(s.spacing)(6),Object(s.spacing)(1))),d=c.a.p.withConfig({displayName:"responsive__CommentDisabledHeadline",componentId:"sc-2j1dkf-3"})(["color:",";font-family:",";font-size:","px;font-weight:300;margin:0;padding-bottom:",";padding-top:",";text-align:center;"],s.colours.functional.primary,s.fontsWithFallback.headlineLight,s.fontSizes.commentsHeadline,Object(s.spacing)(1),Object(s.spacing)(6)),p=c.a.hr.withConfig({displayName:"responsive__Divider",componentId:"sc-2j1dkf-4"})(["margin:4px auto 12px;max-width:456px;width:100%;border:none;border-top:1px solid #e4e4e4;"]);function f(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=e&&("undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"]);if(null==n)return;var o,i,r=[],a=!0,m=!1;try{for(n=n.call(e);!(a=(o=n.next()).done)&&(r.push(o.value),!t||r.length!==t);a=!0);}catch(e){m=!0,i=e}finally{try{a||null==n.return||n.return()}finally{if(m)throw i}}return r}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return g(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return g(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function g(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=new Array(t);n<t;n++)o[n]=e[n];return o}var C=e=>e?(e=>e.split("&").reduce((e,t)=>{const n=f(t.split("="),2),o=n[0],i=n[1];return e[o]=i,e},{}))(e).eid:void 0;const b=(e,t)=>((e,t)=>{const n=new XMLHttpRequest;n.addEventListener("load",()=>{const e=(200===n.status?JSON.parse(n.response):{}).spotimCodeB;e&&t(e)}),n.open("GET",e),n.send()})("/api/comments/loginv2?codeA=".concat(encodeURIComponent(e)),t);var y=()=>{if(window.SPOTIM&&window.SPOTIM.startSSO){const e=window&&window.nuk&&window.nuk.getCookieValue&&window.nuk.getCookieValue("acs_tnl"),t="".concat(C(e),"_v2");window.SPOTIM.startSSO({callback:b,userId:t})}},v=n(6);class h extends o.Component{constructor(){super(),this.container=null}componentDidMount(){this.initialiseComments()}componentWillUnmount(){this.disposeComments()}initialiseComments(){const e=this.props,t=e.articleId,n=e.isReadOnly,o=e.commentingConfig,i=e.onCommentStart,r=e.onCommentPost,a=e.onCommentNotification,m=e.onCommentFilterNewest,c=e.onCommentFilterMostRecommended,s=e.onCommentFilterOldest,l=e.onCommentReplyClick,u=e.onCommentShareLink,d=e.onCommentShareTwitter,p=e.onCommentShareEmail,f=e.onCommentShareFacebook,g=e.onCommentRecommend,C=e.onCommentNotificationClicked,b=e.onCommentUsernameClicked,v=e.onCommentSettingsClicked,h=e.viewMoreComments,w=e.domainSpecificUrl;if(!this.container||!t||!o)return;document.addEventListener("spot-im-current-user-typing-start",i),document.addEventListener("spot-im-current-user-sent-message",r),document.addEventListener("spot-im-notification-drop-down-link",a),document.addEventListener("spot-im-user-up-vote-click",g),document.addEventListener("spot-im-sort-by-select",e=>(e=>{switch(e.detail.sortedBy){case"best":return c(e);case"oldest":return s(e);case"newest":return m(e);default:return null}})(e)),document.addEventListener("spot-im-user-clicked-reply",l),document.addEventListener("spot-im-clicked-settings",v),document.addEventListener("spot-im-user-notifications-click",C),document.addEventListener("spot-im-open-user-profile",b),document.addEventListener("spot-im-show-more-comments-clicked",h),document.addEventListener("spot-im-share-type",e=>(e=>{switch(e.detail.type){case"link":return u(e);case"email":return p(e);case"twitter":return d(e);case"facebook":return f(e);default:return null}})(e)),n||(window.SPOTIM&&window.SPOTIM.startSSO?y():document.addEventListener("spot-im-api-ready",()=>{y()})),document.addEventListener("spot-im-renew-sso",()=>{y()});const k=document.createElement("script");k.setAttribute("async","async"),k.setAttribute("src","https://launcher.spot.im/spot/".concat(o.account)),k.setAttribute("data-spotim-module","spotim-launcher"),k.setAttribute("data-post-id",t),k.setAttribute("data-post-url","".concat(w,"/article/").concat(t)),k.setAttribute("data-seo-enabled",!0),k.setAttribute("data-livefyre-url",t),this.container.appendChild(k)}disposeComments(){this.container&&(this.container.innerHTML="")}render(){const e=this.props,t=e.onCommentStart,n=e.onCommentPost,o=e.onCommentNotification,r=e.onCommentFilterNewest,a=e.onCommentFilterMostRecommended,m=e.onCommentFilterOldest,c=e.onCommentReplyClick,s=e.onCommentShareLink,u=e.onCommentShareTwitter,d=e.onCommentShareEmail,p=e.onCommentShareFacebook,f=e.onCommentRecommend,g=e.onCommentNotificationClicked,C=e.onCommentUsernameClicked,b=e.onCommentSettingsClicked,y=e.viewMoreComments;return i.a.createElement(l,{id:"comments-container",onCommentStart:t,onCommentPost:n,onCommentNotification:o,onCommentReplyClick:c,onCommentFilterNewest:r,onCommentFilterMostRecommended:a,onCommentFilterOldest:m,onCommentShareLink:s,onCommentShareTwitter:u,onCommentShareEmail:d,onCommentShareFacebook:p,onCommentRecommend:f,onCommentNotificationClicked:g,onCommentUsernameClicked:C,onCommentSettingsClicked:b,viewMoreComments:y},i.a.createElement("div",{ref:e=>{this.container=e}}))}}h.defaultProps={onCommentStart:()=>{},onCommentPost:()=>{},onCommentNotification:()=>{},onCommentReplyClick:()=>{},onCommentFilterNewest:()=>{},onCommentFilterMostRecommended:()=>{},onCommentFilterOldest:()=>{},onCommentShareLink:()=>{},onCommentShareTwitter:()=>{},onCommentShareEmail:()=>{},onCommentShareFacebook:()=>{},onCommentRecommend:()=>{},onCommentNotificationClicked:()=>{},onCommentUsernameClicked:()=>{},onCommentSettingsClicked:()=>{},viewMoreComments:()=>{}};var w,k=(w=h,Object(v.withTrackEvents)(w,{analyticsEvents:[{actionName:"navigation",eventName:"onCommentStart",trackingName:"spot im : comment : start"},{actionName:"navigation",eventName:"onCommentPost",trackingName:"spot im : comment : complete"},{actionName:"navigation",eventName:"onCommentNotification",trackingName:"spot im : notification"},{actionName:"navigation",eventName:"onCommentFilterNewest",trackingName:"spot im : sort : newest"},{actionName:"navigation",eventName:"onCommentFilterMostRecommended",trackingName:"spot im : sort : best"},{actionName:"navigation",eventName:"onCommentFilterOldest",trackingName:"spot im : sort : oldest"},{actionName:"navigation",eventName:"onCommentReplyClick",trackingName:"spot im : reply"},{actionName:"navigation",eventName:"onCommentSettingsClicked",trackingName:"spot im : settings button clicked"},{actionName:"navigation",eventName:"onCommentShareLink",trackingName:"spot im : comment : share : copy link"},{actionName:"navigation",eventName:"onCommentShareEmail",trackingName:"spot im : comment : share : email"},{actionName:"navigation",eventName:"onCommentShareTwitter",trackingName:"spot im : comment : share : twitter"},{actionName:"navigation",eventName:"onCommentShareFacebook",trackingName:"spot im : comment : share : facebook"},{actionName:"navigation",eventName:"onCommentRecommend",trackingName:"spot im : vote up"},{actionName:"navigation",eventName:"onCommentUsernameClicked",trackingName:"spot im : username clicked"},{actionName:"navigation",eventName:"onCommentNotificationClicked",trackingName:"spot im : notification clicked"},{actionName:"navigation",eventName:"viewMoreComments",trackingName:"spot im : view more comments clicked"}]})),O=n(7);function S(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function N(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?S(Object(n),!0).forEach((function(t){j(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):S(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function j(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var E={button:{marginBottom:Object(s.spacing)(0),marginTop:Object(s.spacing)(5),maxWidth:215},container:{alignItems:"center",borderStyle:"solid",borderTopColor:s.colours.functional.keyline,borderTopWidth:1,marginBottom:Object(s.spacing)(10),width:"100%"},headline:N(N({color:s.colours.functional.primary},Object(s.fontFactory)({font:"headline",fontSize:"commentsHeadline"})),{},{maxWidth:315,paddingBottom:Object(s.spacing)(2),paddingTop:Object(s.spacing)(6),textAlign:"center"}),link:{color:s.colours.functional.action},supporting:N(N({},Object(s.fontFactory)({font:"supporting",fontSize:"tertiary"})),{},{color:s.colours.functional.secondary,maxWidth:280,textAlign:"center"})};function _(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function x(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?_(Object(n),!0).forEach((function(t){P(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):_(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function P(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var F=x(x({},E),{},{link:x(x({},E.link),{},{fontFamily:s.fontsWithFallback.supporting,fontSize:s.fontSizes.commentsGuidelines})});var I=()=>i.a.createElement(l,null,i.a.createElement(d,null,"Comments are not enabled for this article"),i.a.createElement(p,null),i.a.createElement(u,null,"Comments are subject to our community guidelines, which can be viewed"," ",i.a.createElement(O.TextLink,{style:F.link,url:"/article/f4024fbe-d989-11e6-9063-500e6740fc32"},"here"),"."));const T=(e,t)=>({attrs:{event_navigation_name:"".concat(e),event_navigation_browsing_method:"".concat(t)}});var M=e=>{let t=e.fireAnalyticsEvent;const n="undefined"!=typeof window&&window.__TIMES_CONFIG__&&window.__TIMES_CONFIG__.account&&window.__TIMES_CONFIG__.account.url;return Object(o.useEffect)(()=>{t&&t(T("upgrade sticky footer : displayed","automated"))},[]),i.a.createElement(a.InlineDialog,{title:"Join the conversation",buttonText:"Go to My account",href:n,onClick:()=>((e,t,n)=>{e&&e(T(t,n))})(t,"upgrade sticky footer : go to my account","click")},"Commenting is only available to unlimited access subscribers. Upgrade your subscription to have your say.")};function A(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=e&&("undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"]);if(null==n)return;var o,i,r=[],a=!0,m=!1;try{for(n=n.call(e);!(a=(o=n.next()).done)&&(r.push(o.value),!t||r.length!==t);a=!0);}catch(e){m=!0,i=e}finally{try{a||null==n.return||n.return()}finally{if(m)throw i}}return r}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return L(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return L(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function L(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=new Array(t);n<t;n++)o[n]=e[n];return o}const R=e=>{let t=e.articleId,n=e.isEnabled,m=e.isReadOnly,c=e.commentingConfig,s=e.domainSpecificUrl;const l=A(Object(o.useState)(void 0),2),u=l[0],d=l[1];return Object(o.useEffect)(()=>{const e=Object(r.getBase64CookieValue)("access-decisions");d(!!e&&Object(r.hasEntitlement)(e,"functionalCommentingFull"))},[]),void 0===u?null:n?u?i.a.createElement(k,{articleId:t,isReadOnly:m,commentingConfig:c,domainSpecificUrl:s}):i.a.createElement(a.TrackingContextProvider,{context:{component:"JoinTheConversationDialog",object:"JoinTheConversationDialog",attrs:{event_navigation_action:"navigation",article_parent_name:"commenting"}}},e=>{let t=e.fireAnalyticsEvent;return i.a.createElement(M,{fireAnalyticsEvent:t})}):i.a.createElement(I,null)};R.defaultProps={isReadOnly:!1};t.default=R}]);