@times-components/article-extras 0.32.17-alpha.3 → 0.32.18
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 +16 -0
- package/dist/article-extras.js +20 -75
- package/package.json +19 -19
- package/rnw.js +1 -1
- package/dist/share-save-entitlement-state.js +0 -49
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,22 @@
|
|
|
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.32.18](https://github.com/newsuk/times-components/compare/@times-components/article-extras@0.32.17...@times-components/article-extras@0.32.18) (2024-10-28)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @times-components/article-extras
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
## [0.32.17](https://github.com/newsuk/times-components/compare/@times-components/article-extras@0.32.16...@times-components/article-extras@0.32.17) (2024-10-28)
|
|
15
|
+
|
|
16
|
+
**Note:** Version bump only for package @times-components/article-extras
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
6
22
|
## [0.32.16](https://github.com/newsuk/times-components/compare/@times-components/article-extras@0.32.15...@times-components/article-extras@0.32.16) (2024-10-23)
|
|
7
23
|
|
|
8
24
|
**Note:** Version bump only for package @times-components/article-extras
|
package/dist/article-extras.js
CHANGED
|
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
|
|
8
|
-
var _react =
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
9
9
|
|
|
10
10
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
11
11
|
|
|
@@ -27,30 +27,8 @@ var _responsive = require("./styles/responsive");
|
|
|
27
27
|
|
|
28
28
|
var _styles = require("./styles");
|
|
29
29
|
|
|
30
|
-
var _shareSaveEntitlementState = _interopRequireDefault(require("./share-save-entitlement-state"));
|
|
31
|
-
|
|
32
30
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
33
31
|
|
|
34
|
-
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); }
|
|
35
|
-
|
|
36
|
-
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
37
|
-
|
|
38
|
-
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
39
|
-
|
|
40
|
-
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
41
|
-
|
|
42
|
-
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
43
|
-
|
|
44
|
-
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
45
|
-
|
|
46
|
-
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
47
|
-
|
|
48
|
-
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
49
|
-
|
|
50
|
-
function _iterableToArrayLimit(arr, i) { var _i = arr && (typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]); if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
|
51
|
-
|
|
52
|
-
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
53
|
-
|
|
54
32
|
const clearingStyle = {
|
|
55
33
|
clear: "both"
|
|
56
34
|
};
|
|
@@ -74,40 +52,13 @@ const ArticleExtras = _ref => {
|
|
|
74
52
|
storefrontConfig = _ref.storefrontConfig,
|
|
75
53
|
breadcrumbs = _ref.breadcrumbs,
|
|
76
54
|
domainSpecificUrl = _ref.domainSpecificUrl,
|
|
77
|
-
isEntitlementFeatureEnabled = _ref.isEntitlementFeatureEnabled
|
|
78
|
-
isSharingSavingEntitlementEnabled = _ref.isSharingSavingEntitlementEnabled;
|
|
79
|
-
|
|
80
|
-
const _useState = (0, _react.useState)(undefined),
|
|
81
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
82
|
-
shareSaveEntitlementData = _useState2[0],
|
|
83
|
-
setShareSaveEntitlementData = _useState2[1];
|
|
84
|
-
|
|
85
|
-
(0, _react.useEffect)(() => {
|
|
86
|
-
const fetchUserEntitlements = /*#__PURE__*/function () {
|
|
87
|
-
var _ref2 = _asyncToGenerator(function* () {
|
|
88
|
-
// eslint-disable-next-line no-undef
|
|
89
|
-
const response = yield fetch("/api/get-user-entitlements");
|
|
90
|
-
const data = yield response.json();
|
|
91
|
-
console.log("fetchUserEntitlements", data);
|
|
92
|
-
setShareSaveEntitlementData(data);
|
|
93
|
-
});
|
|
94
|
-
|
|
95
|
-
return function fetchUserEntitlements() {
|
|
96
|
-
return _ref2.apply(this, arguments);
|
|
97
|
-
};
|
|
98
|
-
}();
|
|
99
|
-
|
|
100
|
-
if (typeof window !== "undefined" && isSharingSavingEntitlementEnabled) {
|
|
101
|
-
fetchUserEntitlements();
|
|
102
|
-
}
|
|
103
|
-
}, [isSharingSavingEntitlementEnabled]);
|
|
104
|
-
console.log("shareSaveEntitlementData", shareSaveEntitlementData);
|
|
55
|
+
isEntitlementFeatureEnabled = _ref.isEntitlementFeatureEnabled;
|
|
105
56
|
|
|
106
57
|
const renderBreadcrumb = function renderBreadcrumb() {
|
|
107
|
-
let
|
|
58
|
+
let _ref2 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {
|
|
108
59
|
showBorder: false
|
|
109
60
|
},
|
|
110
|
-
showBorder =
|
|
61
|
+
showBorder = _ref2.showBorder;
|
|
111
62
|
|
|
112
63
|
if (breadcrumbs && breadcrumbs.length > 0) {
|
|
113
64
|
return /*#__PURE__*/_react.default.createElement(_responsive.BreadcrumbContainer, {
|
|
@@ -145,8 +96,19 @@ const ArticleExtras = _ref => {
|
|
|
145
96
|
id: "advert-inarticle-native-4"
|
|
146
97
|
}))));
|
|
147
98
|
|
|
148
|
-
|
|
149
|
-
|
|
99
|
+
return /*#__PURE__*/_react.default.createElement(_userState.default, {
|
|
100
|
+
state: _userState.default.showArticleExtras,
|
|
101
|
+
fallback: sponsoredArticlesAndRelatedArticles(false, true)
|
|
102
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
103
|
+
style: clearingStyle
|
|
104
|
+
}), renderBreadcrumb({
|
|
105
|
+
showBorder: topics && topics.length > 0
|
|
106
|
+
}), /*#__PURE__*/_react.default.createElement(_articleTopics.default, {
|
|
107
|
+
topics: topics
|
|
108
|
+
}), isSharingSavingEnabled && /*#__PURE__*/_react.default.createElement(_userState.default, {
|
|
109
|
+
state: _userState.default.showSaveAndShareBar
|
|
110
|
+
}, /*#__PURE__*/_react.default.createElement(_messageBar.MessageContext.Consumer, null, _ref3 => {
|
|
111
|
+
let showMessage = _ref3.showMessage;
|
|
150
112
|
return /*#__PURE__*/_react.default.createElement(_responsive.ShareAndSaveContainer, {
|
|
151
113
|
showBottomBorder: !relatedArticleSlice
|
|
152
114
|
}, /*#__PURE__*/_react.default.createElement(_saveAndShareBar.default, {
|
|
@@ -157,25 +119,9 @@ const ArticleExtras = _ref => {
|
|
|
157
119
|
onSaveToMyArticles: () => {},
|
|
158
120
|
onShareOnEmail: () => {},
|
|
159
121
|
savingEnabled: savingEnabled,
|
|
160
|
-
sharingEnabled: sharingEnabled
|
|
161
|
-
isSharingSavingEntitlementEnabled: isSharingSavingEntitlementEnabled
|
|
122
|
+
sharingEnabled: sharingEnabled
|
|
162
123
|
}));
|
|
163
|
-
})
|
|
164
|
-
|
|
165
|
-
return /*#__PURE__*/_react.default.createElement(_userState.default, {
|
|
166
|
-
state: _userState.default.showArticleExtras,
|
|
167
|
-
fallback: sponsoredArticlesAndRelatedArticles(false, true)
|
|
168
|
-
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
169
|
-
style: clearingStyle
|
|
170
|
-
}), renderBreadcrumb({
|
|
171
|
-
showBorder: topics && topics.length > 0
|
|
172
|
-
}), /*#__PURE__*/_react.default.createElement(_articleTopics.default, {
|
|
173
|
-
topics: topics
|
|
174
|
-
}), isSharingSavingEntitlementEnabled ? isSharingSavingEnabled && /*#__PURE__*/_react.default.createElement(_userState.default, {
|
|
175
|
-
state: _userState.default.showSaveAndShareBar
|
|
176
|
-
}, renderSaveAndShareBar()) : /*#__PURE__*/_react.default.createElement(_shareSaveEntitlementState.default, {
|
|
177
|
-
shareSaveEntitlementData: shareSaveEntitlementData
|
|
178
|
-
}, renderSaveAndShareBar()), sponsoredArticlesAndRelatedArticles(true, false), /*#__PURE__*/_react.default.createElement(_articleComments.default, {
|
|
124
|
+
})), sponsoredArticlesAndRelatedArticles(true, false), /*#__PURE__*/_react.default.createElement(_articleComments.default, {
|
|
179
125
|
articleId: articleId,
|
|
180
126
|
isEnabled: commentsEnabled,
|
|
181
127
|
commentingConfig: commentingConfig,
|
|
@@ -207,8 +153,7 @@ ArticleExtras.propTypes = {
|
|
|
207
153
|
storefrontConfig: _propTypes.default.string.isRequired,
|
|
208
154
|
breadcrumbs: _propTypes.default.arrayOf(_propTypes.default.shape({})),
|
|
209
155
|
domainSpecificUrl: _propTypes.default.string.isRequired,
|
|
210
|
-
isEntitlementFeatureEnabled: _propTypes.default.bool.isRequired
|
|
211
|
-
isSharingSavingEntitlementEnabled: _propTypes.default.bool.isRequired
|
|
156
|
+
isEntitlementFeatureEnabled: _propTypes.default.bool.isRequired
|
|
212
157
|
};
|
|
213
158
|
ArticleExtras.defaultProps = {
|
|
214
159
|
relatedArticleSlice: null,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@times-components/article-extras",
|
|
3
|
-
"version": "0.32.
|
|
3
|
+
"version": "0.32.18",
|
|
4
4
|
"description": "Extra information components at the bottom of the articles, such as topics, related articles and comments ",
|
|
5
5
|
"main": "dist/index",
|
|
6
6
|
"dev": "src/index",
|
|
@@ -33,12 +33,12 @@
|
|
|
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": "
|
|
37
|
-
"@times-components/jest-configurator-web": "
|
|
38
|
-
"@times-components/jest-serializer": "
|
|
39
|
-
"@times-components/storybook": "
|
|
40
|
-
"@times-components/test-utils": "
|
|
41
|
-
"@times-components/webpack-configurator": "
|
|
36
|
+
"@times-components/eslint-config-thetimes": "0.8.18",
|
|
37
|
+
"@times-components/jest-configurator-web": "0.8.2",
|
|
38
|
+
"@times-components/jest-serializer": "3.13.20",
|
|
39
|
+
"@times-components/storybook": "4.12.34",
|
|
40
|
+
"@times-components/test-utils": "2.4.2",
|
|
41
|
+
"@times-components/webpack-configurator": "2.1.1",
|
|
42
42
|
"babel-jest": "24.8.0",
|
|
43
43
|
"eslint": "5.9.0",
|
|
44
44
|
"jest": "24.8.0",
|
|
@@ -49,17 +49,17 @@
|
|
|
49
49
|
"webpack": "4.30.0"
|
|
50
50
|
},
|
|
51
51
|
"dependencies": {
|
|
52
|
-
"@times-components/article-comments": "
|
|
53
|
-
"@times-components/article-topics": "
|
|
54
|
-
"@times-components/button": "
|
|
55
|
-
"@times-components/context": "
|
|
56
|
-
"@times-components/message-bar": "
|
|
57
|
-
"@times-components/related-articles": "
|
|
58
|
-
"@times-components/save-and-share-bar": "
|
|
59
|
-
"@times-components/ts-components": "
|
|
60
|
-
"@times-components/ts-styleguide": "
|
|
61
|
-
"@times-components/user-state": "
|
|
62
|
-
"@times-components/utils": "
|
|
52
|
+
"@times-components/article-comments": "0.44.19",
|
|
53
|
+
"@times-components/article-topics": "4.11.55",
|
|
54
|
+
"@times-components/button": "2.10.61",
|
|
55
|
+
"@times-components/context": "1.24.0",
|
|
56
|
+
"@times-components/message-bar": "0.7.85",
|
|
57
|
+
"@times-components/related-articles": "6.18.2",
|
|
58
|
+
"@times-components/save-and-share-bar": "0.24.11",
|
|
59
|
+
"@times-components/ts-components": "1.109.0",
|
|
60
|
+
"@times-components/ts-styleguide": "1.50.34",
|
|
61
|
+
"@times-components/user-state": "0.5.51",
|
|
62
|
+
"@times-components/utils": "6.26.0",
|
|
63
63
|
"prop-types": "15.7.2",
|
|
64
64
|
"styled-components": "4.3.2"
|
|
65
65
|
},
|
|
@@ -74,5 +74,5 @@
|
|
|
74
74
|
"publishConfig": {
|
|
75
75
|
"access": "public"
|
|
76
76
|
},
|
|
77
|
-
"gitHead": "
|
|
77
|
+
"gitHead": "6f38162a6c0e3bdde7af7dc97ca299e7962f2077"
|
|
78
78
|
}
|
package/rnw.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
module.exports=function(e){var t={};function n(r){if(t[r])return t[r].exports;var i=t[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},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 r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)n.d(r,i,function(t){return e[t]}.bind(null,i));return r},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=12)}([function(e,t){e.exports=require("@times-components/ts-styleguide/rnw")},function(e,t){e.exports=require("react")},function(e,t){e.exports=require("prop-types")},function(e,t){e.exports=require("styled-components")},function(e,t){e.exports=require("@times-components/user-state/rnw")},function(e,t){e.exports=require("@times-components/ts-components/rnw")},function(e,t){e.exports=require("@times-components/article-comments/rnw")},function(e,t){e.exports=require("@times-components/related-articles/rnw")},function(e,t){e.exports=require("@times-components/message-bar/rnw")},function(e,t){e.exports=require("@times-components/save-and-share-bar/rnw")},function(e,t){e.exports=require("@times-components/article-topics/rnw")},function(e,t){e.exports=require("@times-components/utils/rnw")},function(e,t,n){"use strict";n.r(t);var r=n(1),i=n.n(r),o=n(2),a=n.n(o),l=n(4),c=n.n(l),s=n(6),d=n.n(s),p=n(7),u=n.n(p),m=n(8),f=n(9),b=n.n(f),h=n(5),g=n(10),y=n.n(g),w=n(11),x=n(3),v=n.n(x),O=n(0),E=v()(w.TcView).withConfig({displayName:"responsive",componentId:"rerzrc-0"})(["padding-left:",";padding-right:",";@media (min-width:","px){width:80.8%;margin:0 auto;padding-left:0;padding-right:0;}@media (min-width:","px){width:56.2%;}"],Object(O.spacing)(2),Object(O.spacing)(2),O.breakpoints.medium,O.breakpoints.wide);function j(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function S(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var C=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?j(Object(n),!0).forEach((function(t){S(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):j(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}({},{topicsContainer:{borderTopColor:O.colours.functional.keyline,borderTopWidth:1},topicsContainerTablet:{alignSelf:"center",width:O.tabletWidth},topicsMetaContainer:{justifyContent:"flex-start"}});const P=e=>{let t=e.topics;return t&&t.length>0?i.a.createElement(E,null,i.a.createElement("nav",{"data-cy":"topic-tags"},i.a.createElement(y.a,{style:C.topicsContainer,topics:t}))):null};P.defaultProps={topics:null};var k=P;const _=v.a.div.withConfig({displayName:"responsive__ShareAndSaveContainer",componentId:"hqs3q1-0"})(["border-top-color:",";border-top-style:solid;border-top-width:1px;width:56.2%;margin:0 auto;@media (max-width:","px){display:none;}",";"],O.colours.functional.keyline,O.breakpoints.huge,e=>e.showBottomBorder&&"border-bottom-color: ".concat(O.colours.functional.keyline,";\n border-bottom-style: solid;\n border-bottom-width: 1px;")),q=v.a.div.withConfig({displayName:"responsive__BreadcrumbContainer",componentId:"hqs3q1-1"})(["display:flex;justify-content:center;margin:0 auto;padding-bottom:8px;",";@media (min-width:","px){width:80.8%;}@media (min-width:","px){width:56.2%;}"],e=>e.$border?"\n border-bottom-color: ".concat(O.colours.functional.keyline,";\n border-bottom-style: solid;\n border-bottom-width: 1px;\n "):"",O.breakpoints.medium,O.breakpoints.wide);function A(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function I(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?A(Object(n),!0).forEach((function(t){D(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):A(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function D(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}v.a.div.withConfig({displayName:"styles__NativeAd",componentId:"sc-1ul3b7n-0"})(["clear:both;display:flex;flex-wrap:wrap;margin:0 auto 30px;width:80.8%;min-height:210px;@media (min-width:768px){min-height:120px;}@media (min-width:","px){width:56.2%;}&.hidden{visibility:hidden;}"],O.breakpoints.wide),v.a.h2.withConfig({displayName:"styles__NativeAdTitle",componentId:"sc-1ul3b7n-1"})(["border-bottom:1px solid #dbdbdb;color:#333;flex:1 1 100%;font:normal ","px / 17px ",";margin-bottom:10px;padding:5px 0;text-transform:uppercase;"],O.fontSizes.teaser,O.fontsWithFallback.bodyRegular),v.a.div.withConfig({displayName:"styles__Ad",componentId:"sc-1ul3b7n-2"})(["flex:1 1 50%;@media (max-width:767px){flex:1 1 46%;&:first-of-type{margin-right:1.5%;}&:last-child{margin-left:1.5%;}}"]),I(I({},Object(O.fontFactory)({font:"supporting",fontSize:"tertiary"})),{},{color:O.colours.functional.secondary,maxWidth:330,textAlign:"center"}),Object(O.spacing)(0),Object(O.spacing)(5),O.colours.functional.keyline,Object(O.spacing)(10),I(I({color:O.colours.functional.primary},Object(O.fontFactory)({font:"headline",fontSize:"commentsHeadline"})),{},{maxWidth:315,paddingBottom:Object(O.spacing)(2),paddingTop:Object(O.spacing)(6),textAlign:"center"}),O.tabletWidth;const N=v.a.div.withConfig({displayName:"styles__PromotedContentContainer",componentId:"sc-1ul3b7n-3"})(["border-top:2px solid #1d1d1b;background-color:#f5f5f5;padding:16px 10px 24px;margin-block-start:20px;&:not(:last-child){margin-block-end:32px;}@media (min-width:","px){padding:16px 20px 24px;}@media (min-width:","px){margin-block-start:28px;margin-block-end:32px;margin-inline:20px;}"],O.breakpoints.medium,O.breakpoints.wide),T=v.a.span.withConfig({displayName:"styles__PromotedContentTitle",componentId:"sc-1ul3b7n-4"})(['display:block;font-family:"Roboto";font-weight:500;font-size:12px;line-height:16px;color:#333333;']),B=v.a.div.withConfig({displayName:"styles__PromotedContentGrid",componentId:"sc-1ul3b7n-5"})(["display:grid;grid-template-columns:repeat(2,1fr);gap:16px 32px;margin-block-start:16px;@media (min-width:","px){grid-template-columns:repeat(4,1fr);}"],O.breakpoints.wide),R=v.a.div.withConfig({displayName:"styles__PromotedContentAd",componentId:"sc-1ul3b7n-6"})(['position:relative;min-height:150px;&:nth-child(1)::after,&:nth-child(4)::after{position:absolute;content:"";top:0;right:-16px;width:1px;height:100%;background-color:#e4e4e4;}@media (min-width:','px){&:not(:last-child)::after{position:absolute;content:"";top:0;right:-16px;width:1px;height:100%;background-color:#e4e4e4;}}'],O.breakpoints.wide),M=v.a.div.withConfig({displayName:"styles__PromotedContentSectionDivider",componentId:"sc-1ul3b7n-7"})(["border-top:1px solid #e4e4e4;grid-column:1 / 3;@media (min-width:","px){display:none;}"],O.breakpoints.wide);const F=e=>{let t=e.shareSaveEntitlementData,n=e.children;console.log("shareSaveEntitlementData in state",t);const r=t&&t.user&&t.user.subscriptions&&t.user.subscriptions[0]&&t.user.subscriptions[0].featureDecisions||[],i=r&&r.some(e=>"fp-753"===e.code&&e.outcomeAsBoolean);return void 0!==t&&i?n:null},U=a.a.shape({code:a.a.string.isRequired,name:a.a.string.isRequired,outcome:a.a.string.isRequired,outcomeAsBoolean:a.a.bool.isRequired}),W=a.a.shape({id:a.a.string.isRequired,featureDecisions:a.a.arrayOf(U).isRequired}),z=a.a.shape({cpn:a.a.string.isRequired,subscriptions:a.a.arrayOf(W).isRequired});F.PropTypes=a.a.shape({user:z.isRequired});var H=F;function V(e,t,n,r,i,o,a){try{var l=e[o](a),c=l.value}catch(e){return void n(e)}l.done?t(c):Promise.resolve(c).then(r,i)}function $(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 r,i,o=[],a=!0,l=!1;try{for(n=n.call(e);!(a=(r=n.next()).done)&&(o.push(r.value),!t||o.length!==t);a=!0);}catch(e){l=!0,i=e}finally{try{a||null==n.return||n.return()}finally{if(l)throw i}}return o}(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,r=new Array(t);n<t;n++)r[n]=e[n];return r}const L={clear:"both"},J=e=>{let t=e.analyticsStream,n=e.articleId,o=e.commentsEnabled,a=e.registerNode,l=e.savingEnabled,s=e.sharingEnabled,p=e.articleUrl,f=e.section,g=e.articleHeadline,y=e.relatedArticleSlice,w=e.relatedArticlesVisible,x=e.commentingConfig,v=e.topics,O=e.isSharingSavingEnabled,E=e.isCommentEnabled,j=e.storefrontConfig,S=e.breadcrumbs,C=e.domainSpecificUrl,P=e.isEntitlementFeatureEnabled,A=e.isSharingSavingEntitlementEnabled;const I=$(Object(r.useState)(void 0),2),D=I[0],F=I[1];Object(r.useEffect)(()=>{"undefined"!=typeof window&&A&&function(){var e,t=(e=function*(){const e=yield fetch("/api/get-user-entitlements"),t=yield e.json();console.log("fetchUserEntitlements",t),F(t)},function(){var t=this,n=arguments;return new Promise((function(r,i){var o=e.apply(t,n);function a(e){V(o,r,i,a,l,"next",e)}function l(e){V(o,r,i,a,l,"throw",e)}a(void 0)}))});return function(){return t.apply(this,arguments)}}()()},[A]),console.log("shareSaveEntitlementData",D);const U=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{showBorder:!1},t=e.showBorder;return S&&S.length>0?i.a.createElement(q,{$border:t},i.a.createElement(h.Breadcrumb,{data:S})):null},W=(e,r)=>i.a.createElement(i.a.Fragment,null,i.a.createElement("div",{id:"related-articles",ref:e=>a(e)},r&&U({showBorder:!1}),i.a.createElement(u.a,{analyticsStream:t,isVisible:w,slice:y}),e&&i.a.createElement(h.RecommendedFetch,{articleId:n,articleHeadline:g,articleSection:f})),i.a.createElement(N,null,i.a.createElement(T,null,"PROMOTED CONTENT"),i.a.createElement(B,null,i.a.createElement(R,{id:"advert-inarticle-native-1"}),i.a.createElement(R,{id:"advert-inarticle-native-2"}),i.a.createElement(M,null),i.a.createElement(R,{id:"advert-inarticle-native-3"}),i.a.createElement(R,{id:"advert-inarticle-native-4"})))),z=()=>i.a.createElement(m.MessageContext.Consumer,null,e=>{let t=e.showMessage;return i.a.createElement(_,{showBottomBorder:!y},i.a.createElement(b.a,{articleId:n,articleHeadline:g,articleUrl:p,onCopyLink:()=>t("Article link copied"),onSaveToMyArticles:()=>{},onShareOnEmail:()=>{},savingEnabled:l,sharingEnabled:s,isSharingSavingEntitlementEnabled:A}))});return i.a.createElement(c.a,{state:c.a.showArticleExtras,fallback:W(!1,!0)},i.a.createElement("div",{style:L}),U({showBorder:v&&v.length>0}),i.a.createElement(k,{topics:v}),A?O&&i.a.createElement(c.a,{state:c.a.showSaveAndShareBar},z()):i.a.createElement(H,{shareSaveEntitlementData:D},z()),W(!0,!1),i.a.createElement(d.a,{articleId:n,isEnabled:o,commentingConfig:x,isCommentEnabled:E,storefrontConfig:j,domainSpecificUrl:C,isEntitlementFeatureEnabled:P}))};J.defaultProps={relatedArticleSlice:null,topics:null,isSharingSavingEnabled:!0,isCommentEnabled:!0,breadcrumbs:[]};var K=J;t.default=K}]);
|
|
1
|
+
module.exports=function(e){var t={};function n(r){if(t[r])return t[r].exports;var i=t[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},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 r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)n.d(r,i,function(t){return e[t]}.bind(null,i));return r},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=12)}([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/user-state/rnw")},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/article-comments/rnw")},function(e,t){e.exports=require("@times-components/related-articles/rnw")},function(e,t){e.exports=require("@times-components/message-bar/rnw")},function(e,t){e.exports=require("@times-components/save-and-share-bar/rnw")},function(e,t){e.exports=require("@times-components/article-topics/rnw")},function(e,t){e.exports=require("@times-components/utils/rnw")},function(e,t,n){"use strict";n.r(t);var r=n(1),i=n.n(r),o=(n(5),n(3)),a=n.n(o),l=n(6),c=n.n(l),s=n(7),d=n.n(s),p=n(8),m=n(9),u=n.n(m),b=n(4),f=n(10),g=n.n(f),h=n(11),y=n(2),x=n.n(y),w=n(0),v=x()(h.TcView).withConfig({displayName:"responsive",componentId:"rerzrc-0"})(["padding-left:",";padding-right:",";@media (min-width:","px){width:80.8%;margin:0 auto;padding-left:0;padding-right:0;}@media (min-width:","px){width:56.2%;}"],Object(w.spacing)(2),Object(w.spacing)(2),w.breakpoints.medium,w.breakpoints.wide);function O(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function E(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=function(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){E(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}({},{topicsContainer:{borderTopColor:w.colours.functional.keyline,borderTopWidth:1},topicsContainerTablet:{alignSelf:"center",width:w.tabletWidth},topicsMetaContainer:{justifyContent:"flex-start"}});const C=e=>{let t=e.topics;return t&&t.length>0?i.a.createElement(v,null,i.a.createElement("nav",{"data-cy":"topic-tags"},i.a.createElement(g.a,{style:j.topicsContainer,topics:t}))):null};C.defaultProps={topics:null};var k=C;const P=x.a.div.withConfig({displayName:"responsive__ShareAndSaveContainer",componentId:"hqs3q1-0"})(["border-top-color:",";border-top-style:solid;border-top-width:1px;width:56.2%;margin:0 auto;@media (max-width:","px){display:none;}",";"],w.colours.functional.keyline,w.breakpoints.huge,e=>e.showBottomBorder&&"border-bottom-color: ".concat(w.colours.functional.keyline,";\n border-bottom-style: solid;\n border-bottom-width: 1px;")),S=x.a.div.withConfig({displayName:"responsive__BreadcrumbContainer",componentId:"hqs3q1-1"})(["display:flex;justify-content:center;margin:0 auto;padding-bottom:8px;",";@media (min-width:","px){width:80.8%;}@media (min-width:","px){width:56.2%;}"],e=>e.$border?"\n border-bottom-color: ".concat(w.colours.functional.keyline,";\n border-bottom-style: solid;\n border-bottom-width: 1px;\n "):"",w.breakpoints.medium,w.breakpoints.wide);function _(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function q(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?_(Object(n),!0).forEach((function(t){N(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 N(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}x.a.div.withConfig({displayName:"styles__NativeAd",componentId:"sc-1ul3b7n-0"})(["clear:both;display:flex;flex-wrap:wrap;margin:0 auto 30px;width:80.8%;min-height:210px;@media (min-width:768px){min-height:120px;}@media (min-width:","px){width:56.2%;}&.hidden{visibility:hidden;}"],w.breakpoints.wide),x.a.h2.withConfig({displayName:"styles__NativeAdTitle",componentId:"sc-1ul3b7n-1"})(["border-bottom:1px solid #dbdbdb;color:#333;flex:1 1 100%;font:normal ","px / 17px ",";margin-bottom:10px;padding:5px 0;text-transform:uppercase;"],w.fontSizes.teaser,w.fontsWithFallback.bodyRegular),x.a.div.withConfig({displayName:"styles__Ad",componentId:"sc-1ul3b7n-2"})(["flex:1 1 50%;@media (max-width:767px){flex:1 1 46%;&:first-of-type{margin-right:1.5%;}&:last-child{margin-left:1.5%;}}"]),q(q({},Object(w.fontFactory)({font:"supporting",fontSize:"tertiary"})),{},{color:w.colours.functional.secondary,maxWidth:330,textAlign:"center"}),Object(w.spacing)(0),Object(w.spacing)(5),w.colours.functional.keyline,Object(w.spacing)(10),q(q({color:w.colours.functional.primary},Object(w.fontFactory)({font:"headline",fontSize:"commentsHeadline"})),{},{maxWidth:315,paddingBottom:Object(w.spacing)(2),paddingTop:Object(w.spacing)(6),textAlign:"center"}),w.tabletWidth;const I=x.a.div.withConfig({displayName:"styles__PromotedContentContainer",componentId:"sc-1ul3b7n-3"})(["border-top:2px solid #1d1d1b;background-color:#f5f5f5;padding:16px 10px 24px;margin-block-start:20px;&:not(:last-child){margin-block-end:32px;}@media (min-width:","px){padding:16px 20px 24px;}@media (min-width:","px){margin-block-start:28px;margin-block-end:32px;margin-inline:20px;}"],w.breakpoints.medium,w.breakpoints.wide),A=x.a.span.withConfig({displayName:"styles__PromotedContentTitle",componentId:"sc-1ul3b7n-4"})(['display:block;font-family:"Roboto";font-weight:500;font-size:12px;line-height:16px;color:#333333;']),T=x.a.div.withConfig({displayName:"styles__PromotedContentGrid",componentId:"sc-1ul3b7n-5"})(["display:grid;grid-template-columns:repeat(2,1fr);gap:16px 32px;margin-block-start:16px;@media (min-width:","px){grid-template-columns:repeat(4,1fr);}"],w.breakpoints.wide),B=x.a.div.withConfig({displayName:"styles__PromotedContentAd",componentId:"sc-1ul3b7n-6"})(['position:relative;min-height:150px;&:nth-child(1)::after,&:nth-child(4)::after{position:absolute;content:"";top:0;right:-16px;width:1px;height:100%;background-color:#e4e4e4;}@media (min-width:','px){&:not(:last-child)::after{position:absolute;content:"";top:0;right:-16px;width:1px;height:100%;background-color:#e4e4e4;}}'],w.breakpoints.wide),D=x.a.div.withConfig({displayName:"styles__PromotedContentSectionDivider",componentId:"sc-1ul3b7n-7"})(["border-top:1px solid #e4e4e4;grid-column:1 / 3;@media (min-width:","px){display:none;}"],w.breakpoints.wide);const M={clear:"both"},F=e=>{let t=e.analyticsStream,n=e.articleId,r=e.commentsEnabled,o=e.registerNode,l=e.savingEnabled,s=e.sharingEnabled,m=e.articleUrl,f=e.section,g=e.articleHeadline,h=e.relatedArticleSlice,y=e.relatedArticlesVisible,x=e.commentingConfig,w=e.topics,v=e.isSharingSavingEnabled,O=e.isCommentEnabled,E=e.storefrontConfig,j=e.breadcrumbs,C=e.domainSpecificUrl,_=e.isEntitlementFeatureEnabled;const q=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{showBorder:!1},t=e.showBorder;return j&&j.length>0?i.a.createElement(S,{$border:t},i.a.createElement(b.Breadcrumb,{data:j})):null},N=(e,r)=>i.a.createElement(i.a.Fragment,null,i.a.createElement("div",{id:"related-articles",ref:e=>o(e)},r&&q({showBorder:!1}),i.a.createElement(d.a,{analyticsStream:t,isVisible:y,slice:h}),e&&i.a.createElement(b.RecommendedFetch,{articleId:n,articleHeadline:g,articleSection:f})),i.a.createElement(I,null,i.a.createElement(A,null,"PROMOTED CONTENT"),i.a.createElement(T,null,i.a.createElement(B,{id:"advert-inarticle-native-1"}),i.a.createElement(B,{id:"advert-inarticle-native-2"}),i.a.createElement(D,null),i.a.createElement(B,{id:"advert-inarticle-native-3"}),i.a.createElement(B,{id:"advert-inarticle-native-4"}))));return i.a.createElement(a.a,{state:a.a.showArticleExtras,fallback:N(!1,!0)},i.a.createElement("div",{style:M}),q({showBorder:w&&w.length>0}),i.a.createElement(k,{topics:w}),v&&i.a.createElement(a.a,{state:a.a.showSaveAndShareBar},i.a.createElement(p.MessageContext.Consumer,null,e=>{let t=e.showMessage;return i.a.createElement(P,{showBottomBorder:!h},i.a.createElement(u.a,{articleId:n,articleHeadline:g,articleUrl:m,onCopyLink:()=>t("Article link copied"),onSaveToMyArticles:()=>{},onShareOnEmail:()=>{},savingEnabled:l,sharingEnabled:s}))})),N(!0,!1),i.a.createElement(c.a,{articleId:n,isEnabled:r,commentingConfig:x,isCommentEnabled:O,storefrontConfig:E,domainSpecificUrl:C,isEntitlementFeatureEnabled:_}))};F.defaultProps={relatedArticleSlice:null,topics:null,isSharingSavingEnabled:!0,isCommentEnabled:!0,breadcrumbs:[]};var W=F;t.default=W}]);
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
|
|
8
|
-
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
9
|
-
|
|
10
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
|
-
|
|
12
|
-
/* eslint-env browser */
|
|
13
|
-
const ShareSaveEntitlementState = _ref => {
|
|
14
|
-
let shareSaveEntitlementData = _ref.shareSaveEntitlementData,
|
|
15
|
-
children = _ref.children;
|
|
16
|
-
const FP_CODE_SHARE_AND_SAVE = "fp-753";
|
|
17
|
-
console.log("shareSaveEntitlementData in state", shareSaveEntitlementData);
|
|
18
|
-
const featureDecisions = shareSaveEntitlementData && shareSaveEntitlementData.user && shareSaveEntitlementData.user.subscriptions && shareSaveEntitlementData.user.subscriptions[0] && shareSaveEntitlementData.user.subscriptions[0].featureDecisions || [];
|
|
19
|
-
const isShareSaveEntitlementEnabled = featureDecisions && featureDecisions.some(decision => decision.code === FP_CODE_SHARE_AND_SAVE && decision.outcomeAsBoolean);
|
|
20
|
-
|
|
21
|
-
if (shareSaveEntitlementData === undefined || !isShareSaveEntitlementEnabled) {
|
|
22
|
-
return null;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
return children;
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
const FeatureDecisionPropTypes = _propTypes.default.shape({
|
|
29
|
-
code: _propTypes.default.string.isRequired,
|
|
30
|
-
name: _propTypes.default.string.isRequired,
|
|
31
|
-
outcome: _propTypes.default.string.isRequired,
|
|
32
|
-
outcomeAsBoolean: _propTypes.default.bool.isRequired
|
|
33
|
-
});
|
|
34
|
-
|
|
35
|
-
const SubscriptionPropTypes = _propTypes.default.shape({
|
|
36
|
-
id: _propTypes.default.string.isRequired,
|
|
37
|
-
featureDecisions: _propTypes.default.arrayOf(FeatureDecisionPropTypes).isRequired
|
|
38
|
-
});
|
|
39
|
-
|
|
40
|
-
const UserPropTypes = _propTypes.default.shape({
|
|
41
|
-
cpn: _propTypes.default.string.isRequired,
|
|
42
|
-
subscriptions: _propTypes.default.arrayOf(SubscriptionPropTypes).isRequired
|
|
43
|
-
});
|
|
44
|
-
|
|
45
|
-
ShareSaveEntitlementState.PropTypes = _propTypes.default.shape({
|
|
46
|
-
user: UserPropTypes.isRequired
|
|
47
|
-
});
|
|
48
|
-
var _default = ShareSaveEntitlementState;
|
|
49
|
-
exports.default = _default;
|