@quintype/arrow 3.15.1-perf.4 → 3.15.1-perf.5

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.
Files changed (166) hide show
  1. package/cjs/index.js +14589 -0
  2. package/package.json +1 -1
  3. package/atoms/Author/index.js +0 -170
  4. package/atoms/Author/styles.arrow.css +0 -1
  5. package/atoms/AuthorWithTime/index.js +0 -514
  6. package/atoms/AuthorWithTime/styles.arrow.css +0 -1
  7. package/atoms/CollectionName/index.js +0 -255
  8. package/atoms/CollectionName/styles.arrow.css +0 -1
  9. package/atoms/ExtendedLoadMore/index-0f809dd9.js +0 -254
  10. package/atoms/ExtendedLoadMore/index-142f015c.js +0 -476
  11. package/atoms/ExtendedLoadMore/index-37a9ccff.js +0 -182
  12. package/atoms/ExtendedLoadMore/index-446679c8.js +0 -191
  13. package/atoms/ExtendedLoadMore/index-44f97338.js +0 -300
  14. package/atoms/ExtendedLoadMore/index-57dd4870.js +0 -239
  15. package/atoms/ExtendedLoadMore/index-66dd4dbd.js +0 -215
  16. package/atoms/ExtendedLoadMore/index-8462c597.js +0 -363
  17. package/atoms/ExtendedLoadMore/index-93cb06d1.js +0 -1016
  18. package/atoms/ExtendedLoadMore/index-afd44863.js +0 -95
  19. package/atoms/ExtendedLoadMore/index-b5754c5d.js +0 -195
  20. package/atoms/ExtendedLoadMore/index-bbaf526e.js +0 -256
  21. package/atoms/ExtendedLoadMore/index-cfb262ef.js +0 -192
  22. package/atoms/ExtendedLoadMore/index.js +0 -20
  23. package/atoms/ExtendedLoadMore/styles.arrow.css +0 -1
  24. package/atoms/Headline/index.js +0 -379
  25. package/atoms/Headline/styles.arrow.css +0 -1
  26. package/atoms/HeroImage/index.js +0 -336
  27. package/atoms/HeroImage/styles.arrow.css +0 -1
  28. package/atoms/LoadmoreButton/index.js +0 -175
  29. package/atoms/LoadmoreButton/styles.arrow.css +0 -1
  30. package/atoms/ScrollSnap/index.js +0 -379
  31. package/atoms/ScrollSnap/styles.arrow.css +0 -1
  32. package/atoms/SectionTag/index.js +0 -140
  33. package/atoms/SectionTag/styles.arrow.css +0 -1
  34. package/atoms/Subheadline/index.js +0 -120
  35. package/atoms/Subheadline/styles.arrow.css +0 -1
  36. package/atoms/TimeStamp/index.js +0 -221
  37. package/atoms/TimeStamp/styles.arrow.css +0 -1
  38. package/molecules/KeyEvents/index.js +0 -457
  39. package/molecules/KeyEvents/styles.arrow.css +0 -1
  40. package/molecules/PageIntroductionCard/index.js +0 -248
  41. package/molecules/PageIntroductionCard/styles.arrow.css +0 -1
  42. package/molecules/SocialShareTemplate/index.js +0 -506
  43. package/molecules/SocialShareTemplate/styles.arrow.css +0 -1
  44. package/molecules/StoryCard/index.js +0 -1430
  45. package/molecules/StoryCard/styles.arrow.css +0 -1
  46. package/molecules/StoryElementCard/index.js +0 -3091
  47. package/molecules/StoryElementCard/styles.arrow.css +0 -1
  48. package/molecules/StorycardContent/index.js +0 -976
  49. package/molecules/StorycardContent/styles.arrow.css +0 -1
  50. package/rows/AlternateCollectionFilter/index.js +0 -2189
  51. package/rows/AlternateCollectionFilter/styles.arrow.css +0 -1
  52. package/rows/AsideCollection/index.js +0 -2135
  53. package/rows/AsideCollection/styles.arrow.css +0 -1
  54. package/rows/AstrologyCollection/index.js +0 -2106
  55. package/rows/AstrologyCollection/styles.arrow.css +0 -1
  56. package/rows/AuthorIntroductionCard/index.js +0 -813
  57. package/rows/AuthorIntroductionCard/styles.arrow.css +0 -1
  58. package/rows/AuthorsList/index.js +0 -996
  59. package/rows/AuthorsList/styles.arrow.css +0 -1
  60. package/rows/CollectionFilter/index.js +0 -2279
  61. package/rows/CollectionFilter/styles.arrow.css +0 -1
  62. package/rows/ElevenStories/index.js +0 -2118
  63. package/rows/ElevenStories/styles.arrow.css +0 -1
  64. package/rows/FourColFiveStories/index.js +0 -1861
  65. package/rows/FourColFiveStories/styles.arrow.css +0 -1
  66. package/rows/FourColGrid/index.js +0 -2083
  67. package/rows/FourColGrid/styles.arrow.css +0 -1
  68. package/rows/FourColPortraitStories/index.js +0 -2116
  69. package/rows/FourColPortraitStories/styles.arrow.css +0 -1
  70. package/rows/FourColSixteenStories/index.js +0 -1849
  71. package/rows/FourColSixteenStories/styles.arrow.css +0 -1
  72. package/rows/FourColTwelveStories/index.js +0 -1822
  73. package/rows/FourColTwelveStories/styles.arrow.css +0 -1
  74. package/rows/FourStorySlider/index.js +0 -2223
  75. package/rows/FourStorySlider/styles.arrow.css +0 -1
  76. package/rows/FourStorySliderPortrait/index.js +0 -2226
  77. package/rows/FourStorySliderPortrait/styles.arrow.css +0 -1
  78. package/rows/FourTabbedBigStorySlider/index.js +0 -1985
  79. package/rows/FourTabbedBigStorySlider/styles.arrow.css +0 -1
  80. package/rows/FullScreenSlider/index.js +0 -2141
  81. package/rows/FullScreenSlider/styles.arrow.css +0 -1
  82. package/rows/HalfScreenSlider/index.js +0 -1994
  83. package/rows/HalfScreenSlider/styles.arrow.css +0 -1
  84. package/rows/ListComponent/index.js +0 -1942
  85. package/rows/ListComponent/styles.arrow.css +0 -1
  86. package/rows/Listicles/index.js +0 -945
  87. package/rows/Listicles/styles.arrow.css +0 -1
  88. package/rows/MagazineEditions/index.js +0 -690
  89. package/rows/MagazineEditions/styles.arrow.css +0 -1
  90. package/rows/MagazineHeaderCard/index.js +0 -684
  91. package/rows/MagazineHeaderCard/styles.arrow.css +0 -1
  92. package/rows/MagazineWidget/index.js +0 -1994
  93. package/rows/MagazineWidget/styles.arrow.css +0 -1
  94. package/rows/OneColStoryList/index.js +0 -2169
  95. package/rows/OneColStoryList/styles.arrow.css +0 -1
  96. package/rows/OpinionCollection/index.js +0 -1545
  97. package/rows/OpinionCollection/styles.arrow.css +0 -1
  98. package/rows/SixColSixStories/index.js +0 -2014
  99. package/rows/SixColSixStories/styles.arrow.css +0 -1
  100. package/rows/StoryCollection/index.js +0 -2135
  101. package/rows/StoryCollection/styles.arrow.css +0 -1
  102. package/rows/TagIntroductionCard/index.js +0 -103
  103. package/rows/TagIntroductionCard/styles.arrow.css +0 -1
  104. package/rows/ThreeColFlexStories/index.js +0 -2074
  105. package/rows/ThreeColFlexStories/styles.arrow.css +0 -1
  106. package/rows/ThreeColFourteenStories/index.js +0 -1770
  107. package/rows/ThreeColFourteenStories/styles.arrow.css +0 -1
  108. package/rows/ThreeColGrid/index.js +0 -2104
  109. package/rows/ThreeColGrid/styles.arrow.css +0 -1
  110. package/rows/ThreeColSevenStory/index.js +0 -1982
  111. package/rows/ThreeColSevenStory/styles.arrow.css +0 -1
  112. package/rows/ThreeColSixStories/index.js +0 -1965
  113. package/rows/ThreeColSixStories/styles.arrow.css +0 -1
  114. package/rows/ThreeColTwelveStories/index.js +0 -1854
  115. package/rows/ThreeColTwelveStories/styles.arrow.css +0 -1
  116. package/rows/TwoColFourStories/index.js +0 -1943
  117. package/rows/TwoColFourStories/styles.arrow.css +0 -1
  118. package/rows/TwoColFourStoryHighlight/index.js +0 -1930
  119. package/rows/TwoColFourStoryHighlight/styles.arrow.css +0 -1
  120. package/rows/TwoColSevenStories/index.js +0 -1970
  121. package/rows/TwoColSevenStories/styles.arrow.css +0 -1
  122. package/rows/TwoColSixStories/index.js +0 -1963
  123. package/rows/TwoColSixStories/styles.arrow.css +0 -1
  124. package/rows/TwoColTenStoriesSidebar/index.js +0 -2029
  125. package/rows/TwoColTenStoriesSidebar/styles.arrow.css +0 -1
  126. package/rows/TwoColThreeStories/index.js +0 -1916
  127. package/rows/TwoColThreeStories/styles.arrow.css +0 -1
  128. package/story-elements/AlsoRead/index.js +0 -320
  129. package/story-elements/AlsoRead/styles.arrow.css +0 -1
  130. package/story-elements/Attachment/index.js +0 -167
  131. package/story-elements/Attachment/styles.arrow.css +0 -1
  132. package/story-elements/BigFact/index.js +0 -137
  133. package/story-elements/BigFact/styles.arrow.css +0 -1
  134. package/story-elements/BlockQuote/index.js +0 -304
  135. package/story-elements/BlockQuote/styles.arrow.css +0 -1
  136. package/story-elements/Blurb/index.js +0 -189
  137. package/story-elements/Blurb/styles.arrow.css +0 -1
  138. package/story-elements/Image/index.js +0 -529
  139. package/story-elements/Image/styles.arrow.css +0 -1
  140. package/story-elements/ImageGallery/index.js +0 -462
  141. package/story-elements/ImageGallery/styles.arrow.css +0 -1
  142. package/story-elements/ImageSlideshow/index.js +0 -773
  143. package/story-elements/ImageSlideshow/styles.arrow.css +0 -1
  144. package/story-elements/QuestionAnswer/index.js +0 -267
  145. package/story-elements/QuestionAnswer/styles.arrow.css +0 -1
  146. package/story-elements/Quote/index.js +0 -166
  147. package/story-elements/Quote/styles.arrow.css +0 -1
  148. package/story-elements/Reference/index.js +0 -160
  149. package/story-elements/Reference/styles.arrow.css +0 -1
  150. package/story-elements/StoryElement/index.js +0 -75
  151. package/story-elements/Summary/index.js +0 -190
  152. package/story-elements/Summary/styles.arrow.css +0 -1
  153. package/story-elements/Text/index.js +0 -165
  154. package/story-elements/Text/styles.arrow.css +0 -1
  155. package/story-elements/Video/index.js +0 -81
  156. package/story-elements/Video/styles.arrow.css +0 -1
  157. package/story-templates/ListicleStoryTemplate/index.js +0 -5586
  158. package/story-templates/ListicleStoryTemplate/styles.arrow.css +0 -1
  159. package/story-templates/LiveBlogStoryTemplate/index.js +0 -5762
  160. package/story-templates/LiveBlogStoryTemplate/styles.arrow.css +0 -1
  161. package/story-templates/PhotoStoryTemplate/index.js +0 -5564
  162. package/story-templates/PhotoStoryTemplate/styles.arrow.css +0 -1
  163. package/story-templates/TextStoryTemplate/index.js +0 -5637
  164. package/story-templates/TextStoryTemplate/styles.arrow.css +0 -1
  165. package/story-templates/VideoStoryTemplate/index.js +0 -5496
  166. package/story-templates/VideoStoryTemplate/styles.arrow.css +0 -1
@@ -1,945 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- var _asyncToGenerator = require('@babel/runtime/helpers/asyncToGenerator');
6
- var _defineProperty = require('@babel/runtime/helpers/defineProperty');
7
- var _slicedToArray = require('@babel/runtime/helpers/slicedToArray');
8
- var _regeneratorRuntime = require('@babel/runtime/regenerator');
9
- var _getClassName = require('babel-plugin-react-css-modules/dist/browser/getClassName');
10
- var React = require('react');
11
- var axios = require('axios');
12
- var PropTypes = require('prop-types');
13
- var lodash = require('lodash');
14
- var components = require('@quintype/components');
15
- var reactRedux = require('react-redux');
16
- require('@babel/runtime/helpers/typeof');
17
- require('react-timeago');
18
- require('date-fns-tz');
19
-
20
- function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
21
-
22
- var _asyncToGenerator__default = /*#__PURE__*/_interopDefaultLegacy(_asyncToGenerator);
23
- var _defineProperty__default = /*#__PURE__*/_interopDefaultLegacy(_defineProperty);
24
- var _slicedToArray__default = /*#__PURE__*/_interopDefaultLegacy(_slicedToArray);
25
- var _regeneratorRuntime__default = /*#__PURE__*/_interopDefaultLegacy(_regeneratorRuntime);
26
- var _getClassName__default = /*#__PURE__*/_interopDefaultLegacy(_getClassName);
27
- var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
28
- var axios__default = /*#__PURE__*/_interopDefaultLegacy(axios);
29
- var PropTypes__default = /*#__PURE__*/_interopDefaultLegacy(PropTypes);
30
-
31
- var StateContext = /*#__PURE__*/React.createContext(); // eslint-disable-next-line react/display-name
32
-
33
- var StateProvider = function StateProvider(RowComponent) {
34
- return function (props) {
35
- return (
36
- /*#__PURE__*/
37
- // eslint-disable-next-line react/prop-types
38
- React__default["default"].createElement(StateContext.Provider, {
39
- value: props.config
40
- }, /*#__PURE__*/React__default["default"].createElement(RowComponent, props))
41
- );
42
- };
43
- };
44
- var useStateValue = function useStateValue() {
45
- return React.useContext(StateContext);
46
- };
47
-
48
- var hexToRGB = function hexToRGB(hex) {
49
- var r = parseInt(hex.slice(1, 3), 16);
50
- var g = parseInt(hex.slice(3, 5), 16);
51
- var b = parseInt(hex.slice(5, 7), 16);
52
- return {
53
- r: r,
54
- g: g,
55
- b: b
56
- };
57
- };
58
- var getLuminanceOfColor = function getLuminanceOfColor(hex) {
59
- var _hexToRGB = hexToRGB(hex),
60
- r = _hexToRGB.r,
61
- g = _hexToRGB.g,
62
- b = _hexToRGB.b;
63
-
64
- return r * 0.299 + g * 0.587 + b * 0.114;
65
- };
66
- var rgbToHex = function rgbToHex() {
67
- var color = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : "rgba(255, 255, 255, 0)";
68
- var rgba = color.match(/^rgba?[\s+]?\([\s+]?(\d+)[\s+]?,[\s+]?(\d+)[\s+]?,[\s+]?(\d+)[\s+]?/i);
69
- return rgba && rgba.length === 4 ? "#" + ("0" + parseInt(rgba[1], 10).toString(16)).slice(-2) + ("0" + parseInt(rgba[2], 10).toString(16)).slice(-2) + ("0" + parseInt(rgba[3], 10).toString(16)).slice(-2) : color;
70
- };
71
- var clientWidths = {
72
- mobile: 767,
73
- tablet: 1024
74
- };
75
- var clientWidth = function clientWidth(device) {
76
- var foundDeviceWidth = lodash.get(clientWidths, device);
77
-
78
- if (foundDeviceWidth) {
79
- return lodash.get(global, "document.documentElement.clientWidth") <= foundDeviceWidth;
80
- }
81
-
82
- return false;
83
- };
84
- var getTextColor = function getTextColor() {
85
- var theme = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : "rgb(255,255,255)";
86
- var isRegexCheck = /^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/.test(theme);
87
- var getHexValue = !isRegexCheck ? rgbToHex(theme) : theme;
88
- var textColor = getLuminanceOfColor(getHexValue) < 155 ? "light" : "dark";
89
- return textColor;
90
- };
91
- var getSlug = function getSlug(collection) {
92
- var config = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
93
- var _config$magazineSlug = config.magazineSlug,
94
- magazineSlug = _config$magazineSlug === void 0 ? "" : _config$magazineSlug,
95
- _config$isArchivePage = config.isArchivePage,
96
- isArchivePage = _config$isArchivePage === void 0 ? false : _config$isArchivePage;
97
-
98
- if (isArchivePage) {
99
- return "/magazine/archive/".concat(magazineSlug);
100
- }
101
-
102
- if (magazineSlug) {
103
- return "/magazine/".concat(magazineSlug, "/").concat(collection.slug);
104
- }
105
-
106
- var isSection = collection.template === "section";
107
-
108
- if (isSection) {
109
- var sectionId = lodash.get(collection, ["metadata", "section", "0", "id"], "");
110
- var sections = config.sections;
111
- var section = sections && sections.find(function (section) {
112
- return section.id === sectionId;
113
- });
114
- return section ? section["section-url"] : "/";
115
- }
116
-
117
- return "/collection/".concat(collection.slug);
118
- };
119
- function isExternalStory() {
120
- var story = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
121
- var _story$storyTemplate = story["story-template"],
122
- storyTemplate = _story$storyTemplate === void 0 ? "" : _story$storyTemplate,
123
- _story$metadata = story.metadata,
124
- metadata = _story$metadata === void 0 ? {} : _story$metadata;
125
- return storyTemplate === "news-elsewhere" ? lodash.get(metadata, ["reference-url"], "") : "";
126
- } // Adds target='_blank' attribute to anchor tags if not present
127
- PropTypes__default["default"].shape({
128
- "sketches-host": PropTypes__default["default"].string,
129
- "cdn-name": PropTypes__default["default"].string,
130
- "cdn-image": PropTypes__default["default"].string
131
- });
132
- PropTypes__default["default"].shape({
133
- headline: PropTypes__default["default"].string,
134
- "last-published-at": PropTypes__default["default"].number,
135
- subheadline: PropTypes__default["default"].string
136
- });
137
- var getStoryUrl = function getStoryUrl(story) {
138
- var defaultValue = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "";
139
- return lodash.get(story, ["story-template"]) === "news-elsewhere" ? lodash.get(story, ["metadata", "reference-url"], "") : story.url || defaultValue;
140
- };
141
-
142
- var _styleModuleImportMap$2 = {
143
- "./collection-name.m.css": {
144
- "collection": "collection-name-m_collection__JD6sx",
145
- "collection-borderLeft": "collection-name-m_collection-borderLeft__3Dznk",
146
- "border-left": "collection-name-m_border-left__3_pYw",
147
- "collection-borderBottomFull": "collection-name-m_collection-borderBottomFull__Dkq3K",
148
- "collection-borderBottom": "collection-name-m_collection-borderBottom__2rdQM",
149
- "collection-crossLine": "collection-name-m_collection-crossLine__1sIpN",
150
- "border-bottom": "collection-name-m_border-bottom__1MnlV",
151
- "dark": "collection-name-m_dark__nMe5H",
152
- "light": "collection-name-m_light__1vFDN"
153
- }
154
- };
155
- var CollectionNameBase = function CollectionNameBase(_ref) {
156
- var _ref$collectionNameBo = _ref.collectionNameBorderColor,
157
- collectionNameBorderColor = _ref$collectionNameBo === void 0 ? "" : _ref$collectionNameBo,
158
- collection = _ref.collection,
159
- config = _ref.config,
160
- collectionNameTemplate = _ref.collectionNameTemplate,
161
- headerLevel = _ref.headerLevel,
162
- _ref$customCollection = _ref.customCollectionName,
163
- customCollectionName = _ref$customCollection === void 0 ? "" : _ref$customCollection,
164
- _ref$navigate = _ref.navigate,
165
- navigate = _ref$navigate === void 0 ? true : _ref$navigate;
166
- var collectionTitle = useStateValue() || {};
167
- var showRowTitle = lodash.get(collectionTitle, ["showRowTitle"], true);
168
- var supportedTemplates = ["borderLeft", "borderBottom", "crossLine", "borderBottomFull"];
169
- var templateStyle = supportedTemplates.includes(collectionNameTemplate) ? " collection-".concat(collectionNameTemplate) : "";
170
- var slug = navigate && collection && getSlug(collection, config) || "";
171
- var collectionName = customCollectionName || collection.name || "";
172
- var textColor = getTextColor(collectionTitle.theme);
173
- var HeaderTag = "h" + headerLevel;
174
- var CollectionNameBorderColor = rgbToHex(collectionNameBorderColor);
175
- var borderBottomFullStyle = templateStyle.includes("collection-borderBottomFull") ? "4px solid ".concat(CollectionNameBorderColor) : "";
176
-
177
- var borderBottomStyle = function borderBottomStyle() {
178
- return templateStyle.includes("collection-borderBottom") && !templateStyle.includes("collection-borderBottomFull") ? /*#__PURE__*/React__default["default"].createElement("div", {
179
- className: "collection-name-m_border-bottom__1MnlV",
180
- style: {
181
- borderBottom: "4px solid ".concat(CollectionNameBorderColor)
182
- }
183
- }) : "";
184
- };
185
-
186
- var isMobile = clientWidth("mobile");
187
-
188
- var getBorderHeight = function getBorderHeight() {
189
- if (isMobile) {
190
- switch (headerLevel) {
191
- case "1":
192
- return "32px";
193
-
194
- case "2":
195
- return "24px";
196
-
197
- case "3":
198
- return "20px";
199
-
200
- case "4":
201
- return "18px";
202
-
203
- case "5":
204
- return "16px";
205
-
206
- case "6":
207
- return "16px";
208
-
209
- default:
210
- return "20px";
211
- }
212
- }
213
-
214
- switch (headerLevel) {
215
- case "1":
216
- return "40px";
217
-
218
- case "2":
219
- return "32px";
220
-
221
- case "3":
222
- return "24px";
223
-
224
- case "4":
225
- return "20px";
226
-
227
- case "5":
228
- return "18px";
229
-
230
- case "6":
231
- return "16px";
232
-
233
- default:
234
- return "24px";
235
- }
236
- };
237
-
238
- return /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, showRowTitle && collectionName && /*#__PURE__*/React__default["default"].createElement("div", {
239
- style: {
240
- borderBottom: borderBottomFullStyle
241
- },
242
- "data-test-id": "collection-name",
243
- className: ("arr--collection-name arrow-component ".concat(templateStyle) ? "arr--collection-name arrow-component ".concat(templateStyle) + " " : "") + _getClassName__default["default"]("collection ".concat(textColor, " ").concat(templateStyle), _styleModuleImportMap$2)
244
- }, templateStyle.includes("collection-borderLeft") && /*#__PURE__*/React__default["default"].createElement("span", {
245
- className: "arr-collection-name-border-left collection-name-m_border-left__3_pYw",
246
- style: {
247
- color: CollectionNameBorderColor,
248
- fontSize: getBorderHeight()
249
- }
250
- }), slug && !slug.includes(undefined) ? /*#__PURE__*/React__default["default"].createElement(components.Link, {
251
- href: slug,
252
- "aria-label": "collection-name"
253
- }, /*#__PURE__*/React__default["default"].createElement(HeaderTag, null, collectionName)) : /*#__PURE__*/React__default["default"].createElement(HeaderTag, null, collectionName), borderBottomStyle()));
254
- };
255
- CollectionNameBase.propTypes = {
256
- /** Collection name border color */
257
- collectionNameBorderColor: PropTypes.PropTypes.string,
258
-
259
- /** The Collection Object from the API response */
260
- collection: PropTypes.PropTypes.object,
261
-
262
- /** The publisher config from the API response */
263
- config: PropTypes.PropTypes.object,
264
-
265
- /** The style template for the component */
266
- collectionNameTemplate: PropTypes.PropTypes.oneOf(["", "borderLeft", "borderBottom", "crossLine", "borderBottomFull"]),
267
-
268
- /** Header tags ranging h1-h6, where h[headerLevel] */
269
- headerLevel: PropTypes.PropTypes.string,
270
- customCollectionName: PropTypes.PropTypes.string,
271
- navigate: PropTypes.PropTypes.bool
272
- };
273
- CollectionNameBase.defaultProps = {
274
- collectionNameTemplate: "",
275
- headerLevel: "3"
276
- };
277
-
278
- function mapStateToProps(state) {
279
- return {
280
- config: lodash.get(state, ["qt", "config"], {})
281
- };
282
- }
283
-
284
- var CollectionName = reactRedux.connect(mapStateToProps)(CollectionNameBase);
285
-
286
- var Loading = function Loading(_ref) {
287
- _ref.width;
288
- _ref.height;
289
- _ref.iconColor;
290
- return /*#__PURE__*/React__default["default"].createElement("div", {
291
- className: "loading-m_loading-indicator__2Dlst"
292
- }, /*#__PURE__*/React__default["default"].createElement("svg", {
293
- width: "40",
294
- height: "40",
295
- xmlns: "http://www.w3.org/2000/svg",
296
- viewBox: "0 0 100 100",
297
- preserveAspectRatio: "xMidYMid"
298
- }, /*#__PURE__*/React__default["default"].createElement("circle", {
299
- cx: "84",
300
- cy: "50",
301
- r: "0",
302
- fill: "currentColor"
303
- }, /*#__PURE__*/React__default["default"].createElement("animate", {
304
- attributeName: "r",
305
- values: "10;0;0;0;0",
306
- keyTimes: "0;0.25;0.5;0.75;1",
307
- keySplines: "0 0.5 0.5 1;0 0.5 0.5 1;0 0.5 0.5 1;0 0.5 0.5 1",
308
- calcMode: "spline",
309
- dur: "2s",
310
- repeatCount: "indefinite",
311
- begin: "0s"
312
- }), /*#__PURE__*/React__default["default"].createElement("animate", {
313
- attributeName: "cx",
314
- values: "84;84;84;84;84",
315
- keyTimes: "0;0.25;0.5;0.75;1",
316
- keySplines: "0 0.5 0.5 1;0 0.5 0.5 1;0 0.5 0.5 1;0 0.5 0.5 1",
317
- calcMode: "spline",
318
- dur: "2s",
319
- repeatCount: "indefinite",
320
- begin: "0s"
321
- })), /*#__PURE__*/React__default["default"].createElement("circle", {
322
- cx: "84",
323
- cy: "50",
324
- r: ".709",
325
- fill: "currentColor"
326
- }, /*#__PURE__*/React__default["default"].createElement("animate", {
327
- attributeName: "r",
328
- values: "0;10;10;10;0",
329
- keyTimes: "0;0.25;0.5;0.75;1",
330
- keySplines: "0 0.5 0.5 1;0 0.5 0.5 1;0 0.5 0.5 1;0 0.5 0.5 1",
331
- calcMode: "spline",
332
- dur: "2s",
333
- repeatCount: "indefinite",
334
- begin: "-1s"
335
- }), /*#__PURE__*/React__default["default"].createElement("animate", {
336
- attributeName: "cx",
337
- values: "16;16;50;84;84",
338
- keyTimes: "0;0.25;0.5;0.75;1",
339
- keySplines: "0 0.5 0.5 1;0 0.5 0.5 1;0 0.5 0.5 1;0 0.5 0.5 1",
340
- calcMode: "spline",
341
- dur: "2s",
342
- repeatCount: "indefinite",
343
- begin: "-1s"
344
- })), /*#__PURE__*/React__default["default"].createElement("circle", {
345
- cx: "81.59",
346
- cy: "50",
347
- r: "10",
348
- fill: "currentColor"
349
- }, /*#__PURE__*/React__default["default"].createElement("animate", {
350
- attributeName: "r",
351
- values: "0;10;10;10;0",
352
- keyTimes: "0;0.25;0.5;0.75;1",
353
- keySplines: "0 0.5 0.5 1;0 0.5 0.5 1;0 0.5 0.5 1;0 0.5 0.5 1",
354
- calcMode: "spline",
355
- dur: "2s",
356
- repeatCount: "indefinite",
357
- begin: "-0.5s"
358
- }), /*#__PURE__*/React__default["default"].createElement("animate", {
359
- attributeName: "cx",
360
- values: "16;16;50;84;84",
361
- keyTimes: "0;0.25;0.5;0.75;1",
362
- keySplines: "0 0.5 0.5 1;0 0.5 0.5 1;0 0.5 0.5 1;0 0.5 0.5 1",
363
- calcMode: "spline",
364
- dur: "2s",
365
- repeatCount: "indefinite",
366
- begin: "-0.5s"
367
- })), /*#__PURE__*/React__default["default"].createElement("circle", {
368
- cx: "47.59",
369
- cy: "50",
370
- r: "10",
371
- fill: "currentColor"
372
- }, /*#__PURE__*/React__default["default"].createElement("animate", {
373
- attributeName: "r",
374
- values: "0;10;10;10;0",
375
- keyTimes: "0;0.25;0.5;0.75;1",
376
- keySplines: "0 0.5 0.5 1;0 0.5 0.5 1;0 0.5 0.5 1;0 0.5 0.5 1",
377
- calcMode: "spline",
378
- dur: "2s",
379
- repeatCount: "indefinite",
380
- begin: "0s"
381
- }), /*#__PURE__*/React__default["default"].createElement("animate", {
382
- attributeName: "cx",
383
- values: "16;16;50;84;84",
384
- keyTimes: "0;0.25;0.5;0.75;1",
385
- keySplines: "0 0.5 0.5 1;0 0.5 0.5 1;0 0.5 0.5 1;0 0.5 0.5 1",
386
- calcMode: "spline",
387
- dur: "2s",
388
- repeatCount: "indefinite",
389
- begin: "0s"
390
- })), /*#__PURE__*/React__default["default"].createElement("circle", {
391
- cx: "16",
392
- cy: "50",
393
- r: "9.291",
394
- fill: "currentColor"
395
- }, /*#__PURE__*/React__default["default"].createElement("animate", {
396
- attributeName: "r",
397
- values: "0;0;10;10;10",
398
- keyTimes: "0;0.25;0.5;0.75;1",
399
- keySplines: "0 0.5 0.5 1;0 0.5 0.5 1;0 0.5 0.5 1;0 0.5 0.5 1",
400
- calcMode: "spline",
401
- dur: "2s",
402
- repeatCount: "indefinite",
403
- begin: "0s"
404
- }), /*#__PURE__*/React__default["default"].createElement("animate", {
405
- attributeName: "cx",
406
- values: "16;16;16;50;84",
407
- keyTimes: "0;0.25;0.5;0.75;1",
408
- keySplines: "0 0.5 0.5 1;0 0.5 0.5 1;0 0.5 0.5 1;0 0.5 0.5 1",
409
- calcMode: "spline",
410
- dur: "2s",
411
- repeatCount: "indefinite",
412
- begin: "0s"
413
- }))));
414
- };
415
- Loading.propTypes = {
416
- width: PropTypes__default["default"].object,
417
- height: PropTypes__default["default"].object,
418
- iconColor: PropTypes__default["default"].object
419
- };
420
-
421
- var CrownIcon = function CrownIcon(_ref) {
422
- var height = _ref.height,
423
- width = _ref.width,
424
- _ref$color = _ref.color,
425
- color = _ref$color === void 0 ? "#D8D8D8" : _ref$color,
426
- positionTop = _ref.positionTop;
427
- return /*#__PURE__*/React__default["default"].createElement("svg", {
428
- xmlns: "http://www.w3.org/2000/svg",
429
- width: width,
430
- height: height,
431
- viewBox: "0 0 40 40",
432
- style: {
433
- position: "relative",
434
- top: positionTop
435
- }
436
- }, /*#__PURE__*/React__default["default"].createElement("g", {
437
- fill: "none",
438
- fillRule: "evenodd",
439
- stroke: "none",
440
- strokeWidth: "1"
441
- }, /*#__PURE__*/React__default["default"].createElement("g", null, /*#__PURE__*/React__default["default"].createElement("g", {
442
- transform: "translate(8 8)"
443
- }, /*#__PURE__*/React__default["default"].createElement("path", {
444
- d: "M0 0H24V24H0z"
445
- }), /*#__PURE__*/React__default["default"].createElement("g", {
446
- fill: color,
447
- fillRule: "nonzero",
448
- transform: "translate(0 2)"
449
- }, /*#__PURE__*/React__default["default"].createElement("path", {
450
- d: "M21.043 19.553c0-.743-.601-1.344-1.344-1.344h-15.4a1.343 1.343 0 100 2.688h15.4c.743 0 1.344-.603 1.344-1.344zM1.598 8.673c.022 0 .042 0 .064-.003l2.131 7.713h16.411l2.132-7.713c.022 0 .041.003.063.003a1.599 1.599 0 10-1.52-1.108L17.025 9.82 12.882 2.95a1.599 1.599 0 10-1.765 0L6.976 9.82 3.121 7.565a1.599 1.599 0 10-1.523 1.107z"
451
- }))))));
452
- };
453
- CrownIcon.propTypes = {
454
- height: PropTypes__default["default"].string,
455
- width: PropTypes__default["default"].string,
456
- color: PropTypes__default["default"].string,
457
- positionTop: PropTypes__default["default"].string
458
- };
459
-
460
- var KeyIcon = function KeyIcon(_ref) {
461
- var height = _ref.height,
462
- width = _ref.width,
463
- _ref$color = _ref.color,
464
- color = _ref$color === void 0 ? "#D5D5D5" : _ref$color,
465
- positionTop = _ref.positionTop;
466
- return /*#__PURE__*/React__default["default"].createElement("svg", {
467
- xmlns: "http://www.w3.org/2000/svg",
468
- width: width,
469
- height: height,
470
- viewBox: "0 0 40 40",
471
- style: {
472
- position: "relative",
473
- top: positionTop
474
- }
475
- }, /*#__PURE__*/React__default["default"].createElement("g", {
476
- fill: "none",
477
- fillRule: "evenodd",
478
- stroke: "none",
479
- strokeWidth: "1"
480
- }, /*#__PURE__*/React__default["default"].createElement("g", null, /*#__PURE__*/React__default["default"].createElement("g", {
481
- transform: "translate(8 8)"
482
- }, /*#__PURE__*/React__default["default"].createElement("path", {
483
- d: "M0 0H24V24H0z"
484
- }), /*#__PURE__*/React__default["default"].createElement("path", {
485
- fill: color,
486
- fillRule: "nonzero",
487
- d: "M12.71 4.364A6.54 6.54 0 000 6.545a6.54 6.54 0 0012.71 2.182h4.745v4.364h4.363V8.727H24V4.364H12.71zM6.544 8.727a2.181 2.181 0 110-4.362 2.181 2.181 0 010 4.362z",
488
- transform: "translate(0 5)"
489
- })))));
490
- };
491
- KeyIcon.propTypes = {
492
- height: PropTypes__default["default"].string,
493
- width: PropTypes__default["default"].string,
494
- color: PropTypes__default["default"].string,
495
- positionTop: PropTypes__default["default"].string
496
- };
497
-
498
- var LockIcon = function LockIcon(_ref) {
499
- var height = _ref.height,
500
- width = _ref.width,
501
- _ref$color = _ref.color,
502
- color = _ref$color === void 0 ? "#D5D5D5" : _ref$color,
503
- positionTop = _ref.positionTop;
504
- return /*#__PURE__*/React__default["default"].createElement("svg", {
505
- xmlns: "http://www.w3.org/2000/svg",
506
- width: width,
507
- height: height,
508
- viewBox: "0 0 40 40",
509
- style: {
510
- position: "relative",
511
- top: positionTop
512
- }
513
- }, /*#__PURE__*/React__default["default"].createElement("g", {
514
- fill: "none",
515
- fillRule: "evenodd",
516
- stroke: "none",
517
- strokeWidth: "1"
518
- }, /*#__PURE__*/React__default["default"].createElement("g", null, /*#__PURE__*/React__default["default"].createElement("g", {
519
- transform: "translate(8 8)"
520
- }, /*#__PURE__*/React__default["default"].createElement("path", {
521
- d: "M0 0H24V24H0z"
522
- }), /*#__PURE__*/React__default["default"].createElement("g", {
523
- fill: color,
524
- fillRule: "nonzero",
525
- transform: "translate(3)"
526
- }, /*#__PURE__*/React__default["default"].createElement("path", {
527
- d: "M15.692 9h-.747V6c0-3.31-2.681-6-5.978-6C5.67 0 2.989 2.69 2.989 6v3h-.747A2.249 2.249 0 000 11.25v10.5A2.249 2.249 0 002.242 24h13.45a2.249 2.249 0 002.242-2.25v-10.5A2.249 2.249 0 0015.692 9zM4.982 6c0-2.206 1.787-4 3.985-4s3.985 1.794 3.985 4v3h-7.97V6z"
528
- }))))));
529
- };
530
- LockIcon.propTypes = {
531
- height: PropTypes__default["default"].string,
532
- width: PropTypes__default["default"].string,
533
- color: PropTypes__default["default"].string,
534
- positionTop: PropTypes__default["default"].string
535
- };
536
-
537
- var StarIcon = function StarIcon(_ref) {
538
- var width = _ref.width,
539
- height = _ref.height,
540
- _ref$color = _ref.color,
541
- color = _ref$color === void 0 ? "#D5D5D5" : _ref$color,
542
- _ref$positionTop = _ref.positionTop,
543
- positionTop = _ref$positionTop === void 0 ? "" : _ref$positionTop;
544
- return /*#__PURE__*/React__default["default"].createElement("svg", {
545
- xmlns: "http://www.w3.org/2000/svg",
546
- width: width,
547
- height: height,
548
- viewBox: "0 0 40 40",
549
- style: {
550
- position: "relative",
551
- top: positionTop
552
- }
553
- }, /*#__PURE__*/React__default["default"].createElement("g", {
554
- fill: "none",
555
- fillRule: "evenodd",
556
- stroke: "none",
557
- strokeWidth: "1"
558
- }, /*#__PURE__*/React__default["default"].createElement("g", null, /*#__PURE__*/React__default["default"].createElement("path", {
559
- fill: color,
560
- d: "M20 26L12.946577 29.7082039 14.2936609 21.854102 8.5873218 16.2917961 16.4732885 15.145898 20 8 23.5267115 15.145898 31.4126782 16.2917961 25.7063391 21.854102 27.053423 29.7082039z"
561
- }))));
562
- };
563
- StarIcon.propTypes = {
564
- height: PropTypes__default["default"].string,
565
- width: PropTypes__default["default"].string,
566
- color: PropTypes__default["default"].string,
567
- positionTop: PropTypes__default["default"].string
568
- };
569
-
570
- var PremiumStoryIcon = function PremiumStoryIcon(_ref) {
571
- var width = _ref.width,
572
- height = _ref.height,
573
- color = _ref.color,
574
- iconType = _ref.iconType,
575
- positionTop = _ref.positionTop;
576
-
577
- switch (iconType) {
578
- case "crown":
579
- return /*#__PURE__*/React__default["default"].createElement(CrownIcon, {
580
- width: width,
581
- height: height,
582
- color: color,
583
- positionTop: positionTop
584
- });
585
-
586
- case "lock":
587
- return /*#__PURE__*/React__default["default"].createElement(LockIcon, {
588
- width: width,
589
- height: height,
590
- color: color,
591
- positionTop: positionTop
592
- });
593
-
594
- case "key":
595
- return /*#__PURE__*/React__default["default"].createElement(KeyIcon, {
596
- width: width,
597
- height: height,
598
- color: color,
599
- positionTop: positionTop
600
- });
601
-
602
- default:
603
- return /*#__PURE__*/React__default["default"].createElement(StarIcon, {
604
- width: width,
605
- height: height,
606
- color: color,
607
- positionTop: positionTop
608
- });
609
- }
610
- };
611
- PremiumStoryIcon.propTypes = {
612
- width: PropTypes__default["default"].string,
613
- height: PropTypes__default["default"].string,
614
- color: PropTypes__default["default"].string,
615
- iconType: PropTypes__default["default"].string,
616
- positionTop: PropTypes__default["default"].string
617
- };
618
-
619
- function LiveIcon() {
620
- return /*#__PURE__*/React__default["default"].createElement("svg", {
621
- className: "live-icon",
622
- xmlns: "http://www.w3.org/2000/svg",
623
- width: "25",
624
- height: "24",
625
- viewBox: "0 0 25 24"
626
- }, /*#__PURE__*/React__default["default"].createElement("path", {
627
- fill: "#ff5858",
628
- d: "M12 18a6 6 0 110-12 6 6 0 010 12zm0 2.5a8.5 8.5 0 110-17 8.5 8.5 0 010 17zm0-1a7.5 7.5 0 100-15 7.5 7.5 0 000 15z"
629
- }));
630
- }
631
-
632
- var _styleModuleImportMap$1 = {
633
- "./headline.m.css": {
634
- "wrapper": "headline-m_wrapper__3nUmh",
635
- "headline": "headline-m_headline__3_NhV",
636
- "dark": "headline-m_dark__en3hW",
637
- "light": "headline-m_light__3lKJB"
638
- }
639
- };
640
- var Headline = function Headline(_ref) {
641
- var story = _ref.story,
642
- headerLevel = _ref.headerLevel,
643
- _ref$premiumStoryIcon = _ref.premiumStoryIconConfig,
644
- premiumStoryIconConfig = _ref$premiumStoryIcon === void 0 ? {} : _ref$premiumStoryIcon,
645
- isLink = _ref.isLink;
646
- var configData = useStateValue() || {};
647
- var _premiumStoryIconConf = premiumStoryIconConfig.iconColor,
648
- iconColor = _premiumStoryIconConf === void 0 ? "#F7B500" : _premiumStoryIconConf,
649
- _premiumStoryIconConf2 = premiumStoryIconConfig.iconStyle,
650
- iconStyle = _premiumStoryIconConf2 === void 0 ? "star" : _premiumStoryIconConf2,
651
- _premiumStoryIconConf3 = premiumStoryIconConfig.enablePremiumStoryIcon,
652
- enablePremiumStoryIcon = _premiumStoryIconConf3 === void 0 ? false : _premiumStoryIconConf3,
653
- _premiumStoryIconConf4 = premiumStoryIconConfig.showLiveIcon,
654
- showLiveIcon = _premiumStoryIconConf4 === void 0 ? false : _premiumStoryIconConf4;
655
- var alternateHeadline = lodash.get(story, ["alternative", "home", "default", "headline"]);
656
- var premiumStory = enablePremiumStoryIcon && lodash.get(story, ["access"]) === "subscription";
657
- var headline = alternateHeadline || story.headline;
658
- var HeaderTag = "h" + headerLevel;
659
-
660
- var positionHeadline = function positionHeadline() {
661
- switch (parseInt(headerLevel)) {
662
- case 1:
663
- return "-2px";
664
-
665
- case 2:
666
- return "2px";
667
-
668
- case 3:
669
- return "4px";
670
-
671
- case 4:
672
- return "5px";
673
-
674
- default:
675
- return "6px";
676
- }
677
- };
678
-
679
- var textColor = getTextColor(configData.theme);
680
- var wrapperClass = premiumStory ? "wrapper" : "";
681
- var iconSize = "24px";
682
- var enableLiveIcon = showLiveIcon && story["story-template"] === "live-blog" && !lodash.get(story, ["metadata", "is-closed"], false);
683
- return /*#__PURE__*/React__default["default"].createElement("div", {
684
- "data-test-id": "headline",
685
- className: "arrow-component arr--headline " + _getClassName__default["default"](wrapperClass, _styleModuleImportMap$1)
686
- }, premiumStory && /*#__PURE__*/React__default["default"].createElement(PremiumStoryIcon, {
687
- width: iconSize,
688
- height: iconSize,
689
- color: iconColor,
690
- iconType: iconStyle,
691
- positionTop: positionHeadline()
692
- }), isLink ? /*#__PURE__*/React__default["default"].createElement(components.Link, {
693
- href: getStoryUrl(story, "/".concat(story.slug)),
694
- externalLink: isExternalStory(story),
695
- "aria-label": "headline"
696
- }, /*#__PURE__*/React__default["default"].createElement(HeaderTag, {
697
- className: _getClassName__default["default"]("headline ".concat(textColor), _styleModuleImportMap$1)
698
- }, enableLiveIcon && /*#__PURE__*/React__default["default"].createElement(LiveIcon, null), headline)) : /*#__PURE__*/React__default["default"].createElement(HeaderTag, {
699
- className: _getClassName__default["default"]("headline ".concat(textColor), _styleModuleImportMap$1)
700
- }, enableLiveIcon && /*#__PURE__*/React__default["default"].createElement(LiveIcon, null), headline));
701
- };
702
- Headline.propTypes = {
703
- /** The Story Object from the API response */
704
- story: PropTypes__default["default"].object.isRequired,
705
-
706
- /** Header tags ranging h1-h6, where h[headerLevel] */
707
- headerLevel: PropTypes__default["default"].string,
708
- premiumStoryIconConfig: PropTypes__default["default"].shape({
709
- iconColor: PropTypes__default["default"].string,
710
- iconType: PropTypes__default["default"].string,
711
- enablePremiumStoryIcon: PropTypes__default["default"].bool
712
- }),
713
- isLink: PropTypes__default["default"].bool
714
- };
715
- Headline.defaultProps = {
716
- headerLevel: "6",
717
- isLink: true
718
- };
719
-
720
- var _styleModuleImportMap = {
721
- "./listicles.m.css": {
722
- "wrapper": "listicles-m_wrapper__1jwTA",
723
- "child-collections": "listicles-m_child-collections__3kb_6",
724
- "child-collection": "listicles-m_child-collection__2fC4m",
725
- "dark": "listicles-m_dark__YTvdi",
726
- "light": "listicles-m_light__1bP7p",
727
- "child-collection-wrapper": "listicles-m_child-collection-wrapper__1z1Bd",
728
- "open-subchild": "listicles-m_open-subchild__1_Z98",
729
- "opinion-counter": "listicles-m_opinion-counter__2ntNh",
730
- "light-wrapper": "listicles-m_light-wrapper__36BfA",
731
- "arr--collection-name": "listicles-m_arr--collection-name__3tmEj",
732
- "arr--headline": "listicles-m_arr--headline__1mr6d",
733
- "opinions-wrapper": "listicles-m_opinions-wrapper__2fpO8",
734
- "six-opinions-container": "listicles-m_six-opinions-container__CbjCC",
735
- "opinion-wrapper": "listicles-m_opinion-wrapper__27oZ8",
736
- "fadeIn": "listicles-m_fadeIn__3M2xO"
737
- }
738
- };
739
-
740
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
741
-
742
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty__default["default"](target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
743
- var ListiclesBase = function ListiclesBase(_ref) {
744
- var collection = _ref.collection,
745
- _ref$config = _ref.config,
746
- config = _ref$config === void 0 ? {} : _ref$config;
747
- var _config$collectionNam = config.collectionNameBorderColor,
748
- collectionNameBorderColor = _config$collectionNam === void 0 ? "" : _config$collectionNam,
749
- _config$theme = config.theme,
750
- theme = _config$theme === void 0 ? "" : _config$theme,
751
- _config$collectionNam2 = config.collectionNameTemplate,
752
- collectionNameTemplate = _config$collectionNam2 === void 0 ? "" : _config$collectionNam2,
753
- _config$slotConfig = config.slotConfig,
754
- slotConfig = _config$slotConfig === void 0 ? null : _config$slotConfig;
755
-
756
- var _useState = React.useState([]),
757
- _useState2 = _slicedToArray__default["default"](_useState, 2),
758
- subCollectionStories = _useState2[0],
759
- handleApiData = _useState2[1];
760
-
761
- var _useState3 = React.useState({}),
762
- _useState4 = _slicedToArray__default["default"](_useState3, 2),
763
- cachedStories = _useState4[0],
764
- updateCachedStories = _useState4[1];
765
-
766
- var _useState5 = React.useState(0),
767
- _useState6 = _slicedToArray__default["default"](_useState5, 2),
768
- active = _useState6[0],
769
- handleActive = _useState6[1];
770
-
771
- var _useState7 = React.useState(true),
772
- _useState8 = _slicedToArray__default["default"](_useState7, 2),
773
- loading = _useState8[0],
774
- handleLoading = _useState8[1];
775
-
776
- var getFilteredCollection = lodash.get(collection, ["items"], []).filter(function (collections) {
777
- return collections.type === "collection";
778
- });
779
-
780
- if (getFilteredCollection.length < 1) {
781
- return null;
782
- }
783
-
784
- var filteredCollectionids = getFilteredCollection.map(function (subCol) {
785
- return subCol.id;
786
- });
787
-
788
- var memoizeStories = function memoizeStories(id, data) {
789
- updateCachedStories(function (cachedStories) {
790
- return _objectSpread(_objectSpread({}, cachedStories), {}, _defineProperty__default["default"]({}, id, data));
791
- });
792
- };
793
-
794
- function fetchSubCollectionData() {
795
- return _fetchSubCollectionData.apply(this, arguments);
796
- }
797
-
798
- function _fetchSubCollectionData() {
799
- _fetchSubCollectionData = _asyncToGenerator__default["default"]( /*#__PURE__*/_regeneratorRuntime__default["default"].mark(function _callee() {
800
- var id,
801
- data,
802
- res,
803
- childCollectionItems,
804
- _args = arguments;
805
- return _regeneratorRuntime__default["default"].wrap(function _callee$(_context) {
806
- while (1) {
807
- switch (_context.prev = _context.next) {
808
- case 0:
809
- id = _args.length > 0 && _args[0] !== undefined ? _args[0] : filteredCollectionids[0];
810
- handleLoading(true);
811
- _context.prev = 2;
812
- data = {};
813
-
814
- if (id in cachedStories) {
815
- _context.next = 11;
816
- break;
817
- }
818
-
819
- _context.next = 7;
820
- return axios__default["default"].get("/api/v1/collections/".concat(id, "?limit=9"));
821
-
822
- case 7:
823
- res = _context.sent;
824
- data = res.data;
825
- _context.next = 12;
826
- break;
827
-
828
- case 11:
829
- data = cachedStories[id];
830
-
831
- case 12:
832
- memoizeStories(id, data);
833
- childCollectionItems = components.collectionToStories(data);
834
- handleLoading(false);
835
- handleApiData(childCollectionItems);
836
- _context.next = 21;
837
- break;
838
-
839
- case 18:
840
- _context.prev = 18;
841
- _context.t0 = _context["catch"](2);
842
- // eslint-disable-next-line no-console
843
- console.error("API call failed", _context.t0);
844
-
845
- case 21:
846
- case "end":
847
- return _context.stop();
848
- }
849
- }
850
- }, _callee, null, [[2, 18]]);
851
- }));
852
- return _fetchSubCollectionData.apply(this, arguments);
853
- }
854
-
855
- React.useEffect(function (id) {
856
- fetchSubCollectionData(id);
857
- }, []);
858
- var items = subCollectionStories.slice(0, 9);
859
- var textColor = getTextColor(theme);
860
-
861
- var openChildCollectionItems = function openChildCollectionItems(event, index, slug) {
862
- event.stopPropagation();
863
- fetchSubCollectionData(slug);
864
- var activeIndex = active === index ? 0 : index;
865
- handleActive(activeIndex);
866
- };
867
-
868
- var getCustomStyleName = textColor === "light" ? "light-wrapper" : "";
869
-
870
- var generateOpinions = function generateOpinions() {
871
- if (slotConfig) {
872
- return /*#__PURE__*/React__default["default"].createElement("div", {
873
- className: "listicles-m_six-opinions-container__CbjCC"
874
- }, getOpinions(6), /*#__PURE__*/React__default["default"].createElement("div", null, slotConfig()));
875
- }
876
-
877
- return getOpinions();
878
- };
879
-
880
- var getOpinions = function getOpinions() {
881
- var numberOfStories = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 9;
882
- return /*#__PURE__*/React__default["default"].createElement("div", {
883
- className: "listicles-m_opinions-wrapper__2fpO8"
884
- }, items.slice(0, numberOfStories).map(function (story, index) {
885
- return /*#__PURE__*/React__default["default"].createElement("div", {
886
- className: "listicles-m_opinion-wrapper__27oZ8",
887
- key: index
888
- }, /*#__PURE__*/React__default["default"].createElement("div", {
889
- className: "listicles-m_opinion-counter__2ntNh"
890
- }, index + 1), /*#__PURE__*/React__default["default"].createElement(Headline, {
891
- story: story
892
- }));
893
- }));
894
- };
895
-
896
- return /*#__PURE__*/React__default["default"].createElement("div", {
897
- className: "full-width-with-padding arrow-component",
898
- "data-test-id": "collection-filter",
899
- style: {
900
- backgroundColor: theme,
901
- color: textColor
902
- }
903
- }, /*#__PURE__*/React__default["default"].createElement("div", {
904
- className: _getClassName__default["default"]("wrapper ".concat(getCustomStyleName), _styleModuleImportMap)
905
- }, /*#__PURE__*/React__default["default"].createElement(CollectionName, {
906
- collection: collection,
907
- collectionNameTemplate: collectionNameTemplate,
908
- collectionNameBorderColor: collectionNameBorderColor
909
- }), /*#__PURE__*/React__default["default"].createElement("div", {
910
- className: "child-collections listicles-m_child-collections__3kb_6"
911
- }, getFilteredCollection.map(function (subCollections, index) {
912
- return /*#__PURE__*/React__default["default"].createElement("div", {
913
- key: index,
914
- className: ((index === active ? "open-subchild" : "") ? (index === active ? "open-subchild" : "") + " " : "") + _getClassName__default["default"]("child-collection-wrapper ".concat(index === active ? "open-subchild" : ""), _styleModuleImportMap)
915
- }, /*#__PURE__*/React__default["default"].createElement("div", {
916
- onClick: function onClick(event) {
917
- return openChildCollectionItems(event, index, subCollections.id);
918
- },
919
- className: _getClassName__default["default"]("child-collection ".concat(textColor), _styleModuleImportMap)
920
- }, subCollections.name));
921
- })), /*#__PURE__*/React__default["default"].createElement("div", null, loading ? /*#__PURE__*/React__default["default"].createElement(Loading, null) : generateOpinions())));
922
- };
923
- ListiclesBase.propTypes = {
924
- /** collection is the array of objects which is returning by API */
925
- collection: PropTypes__default["default"].object.isRequired,
926
-
927
- /** The config for the Row */
928
- config: PropTypes__default["default"].shape({
929
- // background color of the row
930
- theme: PropTypes__default["default"].string,
931
- // configure ad slot widget and story
932
- slotConfig: PropTypes__default["default"].func,
933
- collectionNameTemplate: PropTypes__default["default"].string,
934
- collectionNameBorderColor: PropTypes__default["default"].string
935
- })
936
- };
937
- ListiclesBase.defaultProps = {
938
- theme: "#ffffff",
939
- slotConfig: "story",
940
- border: ""
941
- };
942
- var Listicles = StateProvider(ListiclesBase);
943
-
944
- exports.Listicles = Listicles;
945
- exports.ListiclesBase = ListiclesBase;