@times-components/article-comments 0.43.28-alpha.21 → 0.43.28-alpha.22
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/dist/user-entitlement-provider.js +1 -1
- package/package.json +2 -2
- package/rnw.js +1 -1
|
@@ -21,7 +21,7 @@ const UserEntitlementProvider = _ref => {
|
|
|
21
21
|
credentials: 'same-origin'
|
|
22
22
|
}), []);
|
|
23
23
|
return /*#__PURE__*/_react.default.createElement(_tsComponents.FetchProvider, {
|
|
24
|
-
url: "api/get-user-entitlements",
|
|
24
|
+
url: "/api/get-user-entitlements",
|
|
25
25
|
options: fetchOptions
|
|
26
26
|
}, /*#__PURE__*/_react.default.createElement(_userEntitlements.UserEntitlements, null, children));
|
|
27
27
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@times-components/article-comments",
|
|
3
|
-
"version": "0.43.28-alpha.
|
|
3
|
+
"version": "0.43.28-alpha.22+167e0cdc19",
|
|
4
4
|
"description": "Article Comments",
|
|
5
5
|
"main": "dist/article-comments",
|
|
6
6
|
"dev": "src/article-comments",
|
|
@@ -70,5 +70,5 @@
|
|
|
70
70
|
"publishConfig": {
|
|
71
71
|
"access": "public"
|
|
72
72
|
},
|
|
73
|
-
"gitHead": "
|
|
73
|
+
"gitHead": "167e0cdc1902b2b7000b3190bb7994a4ab134214"
|
|
74
74
|
}
|
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("@times-components/ts-components/rnw")},function(e,t){e.exports=require("@times-components/user-state/rnw")},function(e,t){e.exports=require("styled-components")},function(e,t){e.exports=require("prop-types")},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(5),n(3)),a=n.n(r),m=n(4),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);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)),c.a.p.withConfig({displayName:"responsive__CommentDisabledHeadline",componentId:"sc-2j1dkf-3"})(["color:",";font-family:",";font-size:","px;margin:0;padding-bottom:",";padding-top:",";text-align:center;"],s.colours.functional.primary,s.fontsWithFallback.headline,s.fontSizes.commentsHeadline,Object(s.spacing)(1),Object(s.spacing)(6));function d(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 u(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 u(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 u(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 p=e=>e?(e=>e.split("&").reduce((e,t)=>{const n=d(t.split("="),2),o=n[0],i=n[1];return e[o]=i,e},{}))(e).eid:void 0;const f=(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 g=()=>{if(window.SPOTIM&&window.SPOTIM.startSSO){const e=window&&window.nuk&&window.nuk.getCookieValue&&window.nuk.getCookieValue("acs_tnl"),t="".concat(p(e),"_v2");window.SPOTIM.startSSO({callback:f,userId:t})}},C=n(6);class b 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,d=e.onCommentShareLink,u=e.onCommentShareTwitter,p=e.onCommentShareEmail,f=e.onCommentShareFacebook,C=e.onCommentRecommend,b=e.onCommentNotificationClicked,y=e.onCommentUsernameClicked,v=e.onCommentSettingsClicked,h=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",C),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",b),document.addEventListener("spot-im-open-user-profile",y),document.addEventListener("spot-im-share-type",e=>(e=>{switch(e.detail.type){case"link":return d(e);case"email":return p(e);case"twitter":return u(e);case"facebook":return f(e);default:return null}})(e)),n||(window.SPOTIM&&window.SPOTIM.startSSO?g():document.addEventListener("spot-im-api-ready",()=>{g()})),document.addEventListener("spot-im-renew-sso",()=>{g()});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(h,"/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,d=e.onCommentShareTwitter,u=e.onCommentShareEmail,p=e.onCommentShareFacebook,f=e.onCommentRecommend,g=e.onCommentNotificationClicked,C=e.onCommentUsernameClicked,b=e.onCommentSettingsClicked;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:d,onCommentShareEmail:u,onCommentShareFacebook:p,onCommentRecommend:f,onCommentNotificationClicked:g,onCommentUsernameClicked:C,onCommentSettingsClicked:b},i.a.createElement("div",{ref:e=>{this.container=e}}))}}b.defaultProps={onCommentStart:()=>{},onCommentPost:()=>{},onCommentNotification:()=>{},onCommentReplyClick:()=>{},onCommentFilterNewest:()=>{},onCommentFilterMostRecommended:()=>{},onCommentFilterOldest:()=>{},onCommentShareLink:()=>{},onCommentShareTwitter:()=>{},onCommentShareEmail:()=>{},onCommentShareFacebook:()=>{},onCommentRecommend:()=>{},onCommentNotificationClicked:()=>{},onCommentUsernameClicked:()=>{},onCommentSettingsClicked:()=>{}};var y,v=(y=b,Object(C.withTrackEvents)(y,{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"}]}));n(7);function h(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 k(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?h(Object(n),!0).forEach((function(t){w(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):h(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function w(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var O={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:k(k({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:k(k({},Object(s.fontFactory)({font:"supporting",fontSize:"tertiary"})),{},{color:s.colours.functional.secondary,maxWidth:280,textAlign:"center"})};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}N(N({},O),{},{link:N(N({},O.link),{},{fontFamily:s.fontsWithFallback.supporting,fontSize:s.fontSizes.commentsGuidelines})});var E=n(2);var P=e=>{let t=e.storefrontConfig;const n=window.nuk&&window.nuk.user&&window.nuk.user.isLightPackUser,o=n?null:t,r=n?()=>document&&document.dispatchEvent(new Event("show::upgrade::modal")):null;return i.a.createElement(E.InlineDialog,{title:"Join the conversation",buttonText:"View offers",href:o,onClick:r},"Commenting is only available to unlimited access subscribers. Upgrade your subscription to have your say.")};const F=i.a.memo(e=>{let t=e.children;const n=Object(E.useFetch)().data;console.log("fetchResponse",n);return console.log("data1",{data:{user:{cpn:"3BOK090867019",subscriptions:[{id:"SUB-0011075014",featureDecisions:[{code:"fp-752",name:"Full Commenting Read/Write Access",outcome:"Disable_Commenting"},{code:"fp-753",name:"Full Sharing Access",outcome:"Disable_Sharing"},{code:"fp-754",name:"Full Article Saving Access",outcome:"Disable_Article_Saving"}]}]}}}),i.a.createElement(i.a.Fragment,null,t)}),x=e=>{let t=e.children;const n=Object(o.useMemo)(()=>({credentials:"same-origin"}),[]);return i.a.createElement(E.FetchProvider,{url:"api/get-user-entitlements",options:n},i.a.createElement(F,null,t))},R=e=>{let t=e.articleId,n=(e.isEnabled,e.isReadOnly),o=e.commentingConfig,r=(e.isCommentEnabled,e.storefrontConfig),m=e.domainSpecificUrl;return i.a.createElement(i.a.Fragment,null,i.a.createElement(a.a,{state:a.a.showJoinTheConversationDialog},i.a.createElement(P,{storefrontConfig:r})),i.a.createElement(x,null,i.a.createElement("p",null,"inside UserEntitlementProvider"),i.a.createElement(v,{articleId:t,isReadOnly:n,commentingConfig:o,domainSpecificUrl:m})))};R.defaultProps={isReadOnly:!1,isCommentEnabled:!0};t.default=R}]);
|
|
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("@times-components/ts-components/rnw")},function(e,t){e.exports=require("@times-components/user-state/rnw")},function(e,t){e.exports=require("styled-components")},function(e,t){e.exports=require("prop-types")},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(5),n(3)),a=n.n(r),m=n(4),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);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)),c.a.p.withConfig({displayName:"responsive__CommentDisabledHeadline",componentId:"sc-2j1dkf-3"})(["color:",";font-family:",";font-size:","px;margin:0;padding-bottom:",";padding-top:",";text-align:center;"],s.colours.functional.primary,s.fontsWithFallback.headline,s.fontSizes.commentsHeadline,Object(s.spacing)(1),Object(s.spacing)(6));function d(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 u(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 u(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 u(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 p=e=>e?(e=>e.split("&").reduce((e,t)=>{const n=d(t.split("="),2),o=n[0],i=n[1];return e[o]=i,e},{}))(e).eid:void 0;const f=(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 g=()=>{if(window.SPOTIM&&window.SPOTIM.startSSO){const e=window&&window.nuk&&window.nuk.getCookieValue&&window.nuk.getCookieValue("acs_tnl"),t="".concat(p(e),"_v2");window.SPOTIM.startSSO({callback:f,userId:t})}},C=n(6);class b 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,d=e.onCommentShareLink,u=e.onCommentShareTwitter,p=e.onCommentShareEmail,f=e.onCommentShareFacebook,C=e.onCommentRecommend,b=e.onCommentNotificationClicked,y=e.onCommentUsernameClicked,v=e.onCommentSettingsClicked,h=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",C),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",b),document.addEventListener("spot-im-open-user-profile",y),document.addEventListener("spot-im-share-type",e=>(e=>{switch(e.detail.type){case"link":return d(e);case"email":return p(e);case"twitter":return u(e);case"facebook":return f(e);default:return null}})(e)),n||(window.SPOTIM&&window.SPOTIM.startSSO?g():document.addEventListener("spot-im-api-ready",()=>{g()})),document.addEventListener("spot-im-renew-sso",()=>{g()});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(h,"/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,d=e.onCommentShareTwitter,u=e.onCommentShareEmail,p=e.onCommentShareFacebook,f=e.onCommentRecommend,g=e.onCommentNotificationClicked,C=e.onCommentUsernameClicked,b=e.onCommentSettingsClicked;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:d,onCommentShareEmail:u,onCommentShareFacebook:p,onCommentRecommend:f,onCommentNotificationClicked:g,onCommentUsernameClicked:C,onCommentSettingsClicked:b},i.a.createElement("div",{ref:e=>{this.container=e}}))}}b.defaultProps={onCommentStart:()=>{},onCommentPost:()=>{},onCommentNotification:()=>{},onCommentReplyClick:()=>{},onCommentFilterNewest:()=>{},onCommentFilterMostRecommended:()=>{},onCommentFilterOldest:()=>{},onCommentShareLink:()=>{},onCommentShareTwitter:()=>{},onCommentShareEmail:()=>{},onCommentShareFacebook:()=>{},onCommentRecommend:()=>{},onCommentNotificationClicked:()=>{},onCommentUsernameClicked:()=>{},onCommentSettingsClicked:()=>{}};var y,v=(y=b,Object(C.withTrackEvents)(y,{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"}]}));n(7);function h(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 k(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?h(Object(n),!0).forEach((function(t){w(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):h(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function w(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var O={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:k(k({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:k(k({},Object(s.fontFactory)({font:"supporting",fontSize:"tertiary"})),{},{color:s.colours.functional.secondary,maxWidth:280,textAlign:"center"})};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}N(N({},O),{},{link:N(N({},O.link),{},{fontFamily:s.fontsWithFallback.supporting,fontSize:s.fontSizes.commentsGuidelines})});var E=n(2);var P=e=>{let t=e.storefrontConfig;const n=window.nuk&&window.nuk.user&&window.nuk.user.isLightPackUser,o=n?null:t,r=n?()=>document&&document.dispatchEvent(new Event("show::upgrade::modal")):null;return i.a.createElement(E.InlineDialog,{title:"Join the conversation",buttonText:"View offers",href:o,onClick:r},"Commenting is only available to unlimited access subscribers. Upgrade your subscription to have your say.")};const F=i.a.memo(e=>{let t=e.children;const n=Object(E.useFetch)().data;console.log("fetchResponse",n);return console.log("data1",{data:{user:{cpn:"3BOK090867019",subscriptions:[{id:"SUB-0011075014",featureDecisions:[{code:"fp-752",name:"Full Commenting Read/Write Access",outcome:"Disable_Commenting"},{code:"fp-753",name:"Full Sharing Access",outcome:"Disable_Sharing"},{code:"fp-754",name:"Full Article Saving Access",outcome:"Disable_Article_Saving"}]}]}}}),i.a.createElement(i.a.Fragment,null,t)}),x=e=>{let t=e.children;const n=Object(o.useMemo)(()=>({credentials:"same-origin"}),[]);return i.a.createElement(E.FetchProvider,{url:"/api/get-user-entitlements",options:n},i.a.createElement(F,null,t))},R=e=>{let t=e.articleId,n=(e.isEnabled,e.isReadOnly),o=e.commentingConfig,r=(e.isCommentEnabled,e.storefrontConfig),m=e.domainSpecificUrl;return i.a.createElement(i.a.Fragment,null,i.a.createElement(a.a,{state:a.a.showJoinTheConversationDialog},i.a.createElement(P,{storefrontConfig:r})),i.a.createElement(x,null,i.a.createElement("p",null,"inside UserEntitlementProvider"),i.a.createElement(v,{articleId:t,isReadOnly:n,commentingConfig:o,domainSpecificUrl:m})))};R.defaultProps={isReadOnly:!1,isCommentEnabled:!0};t.default=R}]);
|