@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,1822 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, '__esModule', { value: true });
4
-
5
- var _toArray = require('@babel/runtime/helpers/toArray');
6
- var React = require('react');
7
- var PropTypes = require('prop-types');
8
- var lodash = require('lodash');
9
- var components = require('@quintype/components');
10
- var _slicedToArray = require('@babel/runtime/helpers/slicedToArray');
11
- var _getClassName = require('babel-plugin-react-css-modules/dist/browser/getClassName');
12
- var reactRedux = require('react-redux');
13
- require('@babel/runtime/helpers/asyncToGenerator');
14
- var _typeof = require('@babel/runtime/helpers/typeof');
15
- require('@babel/runtime/regenerator');
16
- var Timeago = require('react-timeago');
17
- var dateFnsTz = require('date-fns-tz');
18
-
19
- function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
20
-
21
- var _toArray__default = /*#__PURE__*/_interopDefaultLegacy(_toArray);
22
- var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
23
- var PropTypes__default = /*#__PURE__*/_interopDefaultLegacy(PropTypes);
24
- var _slicedToArray__default = /*#__PURE__*/_interopDefaultLegacy(_slicedToArray);
25
- var _getClassName__default = /*#__PURE__*/_interopDefaultLegacy(_getClassName);
26
- var _typeof__default = /*#__PURE__*/_interopDefaultLegacy(_typeof);
27
- var Timeago__default = /*#__PURE__*/_interopDefaultLegacy(Timeago);
28
-
29
- function truncate() {
30
- var string = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : "";
31
- var limit = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 60;
32
- var ellipsis = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
33
- var putEllipsis = ellipsis ? " ..." : "";
34
- return typeof string === "string" && string.length > limit ? string.substring(0, limit) + putEllipsis : string;
35
- }
36
- var timestampToFormat = function timestampToFormat(value, unit, suffix, timestamp) {
37
- var config = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : {};
38
- var _config$showTime = config.showTime,
39
- showTime = _config$showTime === void 0 ? false : _config$showTime,
40
- _config$isTimeFirst = config.isTimeFirst,
41
- isTimeFirst = _config$isTimeFirst === void 0 ? false : _config$isTimeFirst,
42
- _config$isUpperCase = config.isUpperCase,
43
- isUpperCase = _config$isUpperCase === void 0 ? false : _config$isUpperCase,
44
- _config$disableMeridi = config.disableMeridiem,
45
- disableMeridiem = _config$disableMeridi === void 0 ? false : _config$disableMeridi,
46
- _config$timeFormat = config.timeFormat,
47
- timeFormat = _config$timeFormat === void 0 ? "12hours" : _config$timeFormat;
48
- var monthList = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"];
49
- var dateTime = new Date(timestamp);
50
- var date = dateTime.getDate().toString().padStart(2, 0);
51
- var month = monthList[dateTime.getMonth()];
52
- var localizedMonth = month;
53
-
54
- if (isUpperCase) {
55
- localizedMonth = lodash.upperCase(month);
56
- }
57
-
58
- var year = dateTime.getFullYear();
59
- var localizedMeridiem = config.localizedMeridiem,
60
- localizedMonths = config.localizedMonths,
61
- _config$direction = config.direction,
62
- direction = _config$direction === void 0 ? "ltr" : _config$direction;
63
- var time = formatAMPM(timestamp, timeFormat);
64
- var timeWithLocalizedMeridiem = time;
65
- var timetoShow;
66
-
67
- if (localizedMonths) {
68
- localizedMonth = lodash.get(localizedMonths, [lodash.lowerCase(month)]) || month;
69
- }
70
-
71
- if (localizedMeridiem) {
72
- var isAm = time.includes("am");
73
- var _localizedMeridiem$am = localizedMeridiem.am,
74
- am = _localizedMeridiem$am === void 0 ? "am" : _localizedMeridiem$am,
75
- _localizedMeridiem$pm = localizedMeridiem.pm,
76
- pm = _localizedMeridiem$pm === void 0 ? "pm" : _localizedMeridiem$pm;
77
- timeWithLocalizedMeridiem = (isAm ? time.replace("am", am) : time.replace("pm", pm)) || time;
78
- }
79
-
80
- if (direction === "rtl") {
81
- timetoShow = showTime ? "".concat(timeWithLocalizedMeridiem) : "";
82
- return "".concat(date, " ").concat(localizedMonth, ", ").concat(year, " ").concat(timetoShow, " ");
83
- } else {
84
- if (disableMeridiem) {
85
- return "".concat(localizedMonth, " ").concat(date, ", ").concat(year);
86
- } else if (isTimeFirst) {
87
- return "".concat(timeWithLocalizedMeridiem, ", ").concat(date, " ").concat(localizedMonth, " ").concat(year);
88
- } else {
89
- timetoShow = showTime ? ", ".concat(timeWithLocalizedMeridiem) : "";
90
- return "".concat(date, " ").concat(localizedMonth, ", ").concat(year).concat(timetoShow);
91
- }
92
- }
93
- };
94
- function formatter(value, unit, suffix, date, config) {
95
- var showDateForUnits = ["day", "week", "month", "year"]; // suffix here refers to ago
96
- // unit here refers to seconds, minute, minutes,...
97
-
98
- var localizedSuffix = lodash.get(config, ["localizedPublishTime", suffix]) || suffix;
99
- var localizedUnitOfTime;
100
-
101
- if (unit === "hour" && value > 23 || showDateForUnits.indexOf(unit) !== -1) {
102
- return timestampToFormat(value, unit, suffix, date, config);
103
- } else if (value > 1) {
104
- localizedUnitOfTime = lodash.get(config, ["localizedPublishTime", "".concat(unit, "s")]) || "".concat(unit, "s");
105
- return "".concat(value, " ").concat(localizedUnitOfTime, " ").concat(localizedSuffix);
106
- }
107
-
108
- localizedUnitOfTime = lodash.get(config, ["localizedPublishTime", unit]) || unit;
109
- return "".concat(value, " ").concat(localizedUnitOfTime, " ").concat(localizedSuffix, " ");
110
- }
111
-
112
- function formatAMPM(timestamp) {
113
- var timeFormat = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "12hours";
114
- var dateTime = new Date(timestamp);
115
- var hours = dateTime.getHours();
116
- var minutes = dateTime.getMinutes();
117
- var ampm = hours >= 12 ? "pm" : "am";
118
- hours = hours % 12;
119
- hours = hours || 12;
120
- minutes = minutes < 10 ? "0" + minutes : minutes;
121
- var strTime = hours + ":" + minutes + " " + ampm;
122
-
123
- if (timeFormat === "24hours") {
124
- return dateTime.toLocaleTimeString([], {
125
- hour: "2-digit",
126
- minute: "2-digit"
127
- });
128
- }
129
-
130
- return strTime;
131
- }
132
-
133
- var hexToRGB = function hexToRGB(hex) {
134
- var r = parseInt(hex.slice(1, 3), 16);
135
- var g = parseInt(hex.slice(3, 5), 16);
136
- var b = parseInt(hex.slice(5, 7), 16);
137
- return {
138
- r: r,
139
- g: g,
140
- b: b
141
- };
142
- };
143
- var getLuminanceOfColor = function getLuminanceOfColor(hex) {
144
- var _hexToRGB = hexToRGB(hex),
145
- r = _hexToRGB.r,
146
- g = _hexToRGB.g,
147
- b = _hexToRGB.b;
148
-
149
- return r * 0.299 + g * 0.587 + b * 0.114;
150
- };
151
- var rgbToHex = function rgbToHex() {
152
- var color = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : "rgba(255, 255, 255, 0)";
153
- var rgba = color.match(/^rgba?[\s+]?\([\s+]?(\d+)[\s+]?,[\s+]?(\d+)[\s+]?,[\s+]?(\d+)[\s+]?/i);
154
- 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;
155
- };
156
- var clientWidths = {
157
- mobile: 767,
158
- tablet: 1024
159
- };
160
- var clientWidth = function clientWidth(device) {
161
- var foundDeviceWidth = lodash.get(clientWidths, device);
162
-
163
- if (foundDeviceWidth) {
164
- return lodash.get(global, "document.documentElement.clientWidth") <= foundDeviceWidth;
165
- }
166
-
167
- return false;
168
- };
169
- var getTextColor = function getTextColor() {
170
- var theme = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : "rgb(255,255,255)";
171
- var isRegexCheck = /^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/.test(theme);
172
- var getHexValue = !isRegexCheck ? rgbToHex(theme) : theme;
173
- var textColor = getLuminanceOfColor(getHexValue) < 155 ? "light" : "dark";
174
- return textColor;
175
- };
176
- var getSlug = function getSlug(collection) {
177
- var config = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
178
- var _config$magazineSlug = config.magazineSlug,
179
- magazineSlug = _config$magazineSlug === void 0 ? "" : _config$magazineSlug,
180
- _config$isArchivePage = config.isArchivePage,
181
- isArchivePage = _config$isArchivePage === void 0 ? false : _config$isArchivePage;
182
-
183
- if (isArchivePage) {
184
- return "/magazine/archive/".concat(magazineSlug);
185
- }
186
-
187
- if (magazineSlug) {
188
- return "/magazine/".concat(magazineSlug, "/").concat(collection.slug);
189
- }
190
-
191
- var isSection = collection.template === "section";
192
-
193
- if (isSection) {
194
- var sectionId = lodash.get(collection, ["metadata", "section", "0", "id"], "");
195
- var sections = config.sections;
196
- var section = sections && sections.find(function (section) {
197
- return section.id === sectionId;
198
- });
199
- return section ? section["section-url"] : "/";
200
- }
201
-
202
- return "/collection/".concat(collection.slug);
203
- };
204
- function isExternalStory() {
205
- var story = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
206
- var _story$storyTemplate = story["story-template"],
207
- storyTemplate = _story$storyTemplate === void 0 ? "" : _story$storyTemplate,
208
- _story$metadata = story.metadata,
209
- metadata = _story$metadata === void 0 ? {} : _story$metadata;
210
- return storyTemplate === "news-elsewhere" ? lodash.get(metadata, ["reference-url"], "") : "";
211
- } // Adds target='_blank' attribute to anchor tags if not present
212
- var isEmpty = function isEmpty(value) {
213
- return value == null || // From standard.js: Always use === - but value == null is allowed to check null || undefined
214
- _typeof__default["default"](value) === "object" && Object.entries(value).length === 0 && value.constructor === Object || typeof value === "string" && value.trim().length === 0;
215
- };
216
- PropTypes__default["default"].shape({
217
- "sketches-host": PropTypes__default["default"].string,
218
- "cdn-name": PropTypes__default["default"].string,
219
- "cdn-image": PropTypes__default["default"].string
220
- });
221
- PropTypes__default["default"].shape({
222
- headline: PropTypes__default["default"].string,
223
- "last-published-at": PropTypes__default["default"].number,
224
- subheadline: PropTypes__default["default"].string
225
- });
226
- var getStoryUrl = function getStoryUrl(story) {
227
- var defaultValue = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "";
228
- return lodash.get(story, ["story-template"]) === "news-elsewhere" ? lodash.get(story, ["metadata", "reference-url"], "") : story.url || defaultValue;
229
- };
230
- var getTimeStamp = function getTimeStamp(date, _formatter) {
231
- var config = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
232
- var template = arguments.length > 3 ? arguments[3] : undefined;
233
- var timezone = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : null;
234
-
235
- if (timezone && template === "story") {
236
- var zonedTime = timezone && dateFnsTz.utcToZonedTime(date, timezone);
237
- var formatZonedTime = zonedTime && dateFnsTz.format(zonedTime, "yyyy-MM-dd'T'HH:mm:ssXXX", {
238
- timeZone: timezone
239
- });
240
- var timeStamp = timestampToFormat("", "", "", date, config);
241
- return /*#__PURE__*/React__default["default"].createElement("time", {
242
- dateTime: formatZonedTime
243
- }, timeStamp);
244
- }
245
-
246
- return /*#__PURE__*/React__default["default"].createElement(Timeago__default["default"], {
247
- date: date,
248
- formatter: function formatter(value, unit, suffix, date) {
249
- return _formatter(value, unit, suffix, date, config);
250
- }
251
- });
252
- };
253
-
254
- var StateContext = /*#__PURE__*/React.createContext(); // eslint-disable-next-line react/display-name
255
-
256
- var StateProvider = function StateProvider(RowComponent) {
257
- return function (props) {
258
- return (
259
- /*#__PURE__*/
260
- // eslint-disable-next-line react/prop-types
261
- React__default["default"].createElement(StateContext.Provider, {
262
- value: props.config
263
- }, /*#__PURE__*/React__default["default"].createElement(RowComponent, props))
264
- );
265
- };
266
- };
267
- var useStateValue = function useStateValue() {
268
- return React.useContext(StateContext);
269
- };
270
-
271
- var ImageFallbackIcon = function ImageFallbackIcon(_ref) {
272
- var _ref$width = _ref.width,
273
- width = _ref$width === void 0 ? 40 : _ref$width,
274
- _ref$height = _ref.height,
275
- height = _ref$height === void 0 ? 30 : _ref$height,
276
- _ref$iconColor = _ref.iconColor,
277
- iconColor = _ref$iconColor === void 0 ? "#99B0CB" : _ref$iconColor;
278
- return /*#__PURE__*/React__default["default"].createElement("svg", {
279
- width: width,
280
- height: height,
281
- viewBox: "0 0 102 76",
282
- version: "1.1"
283
- }, /*#__PURE__*/React__default["default"].createElement("g", {
284
- id: "demo-home-copy",
285
- stroke: "none",
286
- strokeWidth: "1",
287
- fill: "none",
288
- fillRule: "evenodd",
289
- transform: "translate(-377.000000, -314.000000)"
290
- }, /*#__PURE__*/React__default["default"].createElement("g", {
291
- id: "Group-13",
292
- transform: "translate(377.000000, 314.000000)"
293
- }, /*#__PURE__*/React__default["default"].createElement("path", {
294
- d: "M43.2,49.7 L62.2,19.2 L87.2,59.4 L17,59.4 L32.8,39.4 L43.2,49.7 Z M29.9,28.6 C25.8683213,28.6 22.6,25.3316787 22.6,21.3 C22.6,17.2683213 25.8683213,14 29.9,14 C33.9316787,14 37.2,17.2683213 37.2,21.3 C37.2,25.3316787 33.9316787,28.6 29.9,28.6 Z",
295
- id: "Combined-Shape",
296
- fill: iconColor,
297
- fillRule: "nonzero"
298
- }), /*#__PURE__*/React__default["default"].createElement("rect", {
299
- id: "Rectangle-19",
300
- stroke: iconColor,
301
- strokeWidth: "3",
302
- x: "1.5",
303
- y: "1.5",
304
- width: "99",
305
- height: "73",
306
- rx: "3"
307
- }))));
308
- };
309
- ImageFallbackIcon.propTypes = {
310
- width: PropTypes__default["default"].object,
311
- height: PropTypes__default["default"].object,
312
- iconColor: PropTypes__default["default"].object
313
- };
314
-
315
- var imageFallback = function imageFallback() {
316
- return /*#__PURE__*/React__default["default"].createElement("div", {
317
- className: "arr--fallback-image fallback-m_image__1GYCJ fallback-m_image-position__3KddP"
318
- }, /*#__PURE__*/React__default["default"].createElement("figure", {
319
- className: "arr--fallback-svg fallback-m_fallback-svg__tK9fL"
320
- }, /*#__PURE__*/React__default["default"].createElement(ImageFallbackIcon, null)));
321
- };
322
-
323
- var FallbackImage = function FallbackImage(_ref) {
324
- var slug = _ref.slug;
325
-
326
- if (slug) {
327
- return /*#__PURE__*/React__default["default"].createElement(components.Link, {
328
- href: slug,
329
- "aria-label": "image-fallback"
330
- }, imageFallback());
331
- } else {
332
- return imageFallback();
333
- }
334
- };
335
- FallbackImage.propTypes = {
336
- slug: PropTypes__default["default"].string
337
- };
338
-
339
- var HyperLinkIcon = function HyperLinkIcon() {
340
- return /*#__PURE__*/React__default["default"].createElement("svg", {
341
- xmlns: "http://www.w3.org/2000/svg",
342
- width: "36",
343
- height: "28"
344
- }, /*#__PURE__*/React__default["default"].createElement("g", {
345
- fill: "none",
346
- fillRule: "evenodd"
347
- }, /*#__PURE__*/React__default["default"].createElement("rect", {
348
- width: "36",
349
- height: "28",
350
- fill: "#3D6FCF",
351
- rx: "4"
352
- }), /*#__PURE__*/React__default["default"].createElement("path", {
353
- stroke: "#FFF",
354
- strokeLinecap: "round",
355
- strokeLinejoin: "round",
356
- strokeWidth: "2",
357
- d: "M22 14.667v4c0 .736-.597 1.333-1.333 1.333h-7.334A1.333 1.333 0 0112 18.667v-7.334c0-.736.597-1.333 1.333-1.333h4M20 8h4v4m-7.333 3.333L24 8"
358
- })));
359
- };
360
-
361
- var HyperLink = function HyperLink(_ref) {
362
- var _ref$hyperLink = _ref.hyperLink,
363
- hyperLink = _ref$hyperLink === void 0 ? "" : _ref$hyperLink;
364
- if (!hyperLink) return null;
365
- return /*#__PURE__*/React__default["default"].createElement(components.Link, {
366
- href: hyperLink,
367
- "aria-label": "hyperlink-button",
368
- className: "arr--hyperlink-button hyperlink-m_hyperlink-button__1CqWx",
369
- target: "_blank",
370
- rel: "noopener noreferrer"
371
- }, /*#__PURE__*/React__default["default"].createElement(HyperLinkIcon, null));
372
- };
373
- HyperLink.propTypes = {
374
- hyperLink: PropTypes__default["default"].string
375
- };
376
-
377
- var _styleModuleImportMap$b = {
378
- "./hero-image.m.css": {
379
- "hero-image": "hero-image-m_hero-image__3lraV",
380
- "right-padding": "hero-image-m_right-padding__1LkCe",
381
- "left-padding": "hero-image-m_left-padding__pYRAj",
382
- "right-padding-mob": "hero-image-m_right-padding-mob__3-uOU",
383
- "placeholder": "hero-image-m_placeholder__1omCm",
384
- "hero-image-mob": "hero-image-m_hero-image-mob__13JJp",
385
- "with-padding": "hero-image-m_with-padding__324G_",
386
- "image": "hero-image-m_image__1mz0U"
387
- }
388
- };
389
- var HeroImage = function HeroImage(_ref) {
390
- var story = _ref.story,
391
- FullBleed = _ref.FullBleed,
392
- aspectRatio = _ref.aspectRatio,
393
- defaultWidth = _ref.defaultWidth,
394
- widths = _ref.widths,
395
- isHorizontal = _ref.isHorizontal,
396
- isHorizontalMobile = _ref.isHorizontalMobile,
397
- isHorizontalWithImageLast = _ref.isHorizontalWithImageLast,
398
- defaultFallback = _ref.defaultFallback,
399
- isStoryPageImage = _ref.isStoryPageImage,
400
- config = _ref.config;
401
-
402
- var _ref2 = useStateValue() || {},
403
- _ref2$fallbackImageUr = _ref2.fallbackImageUrl,
404
- fallbackImageUrl = _ref2$fallbackImageUr === void 0 ? "" : _ref2$fallbackImageUr;
405
-
406
- var _config$StoryTemplate = config.StoryTemplateIcon,
407
- StoryTemplateIcon = _config$StoryTemplate === void 0 ? function () {
408
- return null;
409
- } : _config$StoryTemplate;
410
- var showImagePlaceholder = reactRedux.useSelector(function (state) {
411
- return lodash.get(state, ["qt", "config", "showPlaceholder"]);
412
- });
413
- var getPlaceholderStyleName = showImagePlaceholder ? "placeholder" : "";
414
- var fullBleed = FullBleed ? "" : "with-padding";
415
- var heroImageClass = "hero-image";
416
- if (isHorizontal) heroImageClass = "right-padding";else if (isHorizontalWithImageLast) heroImageClass = "left-padding";
417
- var heroImageMobClasses = isHorizontalMobile ? "right-padding-mob" : "";
418
-
419
- var getPadding = function getPadding(aspectRatio) {
420
- var _aspectRatio = _slicedToArray__default["default"](aspectRatio, 2),
421
- height = _aspectRatio[0],
422
- width = _aspectRatio[1];
423
-
424
- if (height > 0 && width > 0) {
425
- var padding = width / height * 100;
426
- return padding;
427
- }
428
-
429
- return 0;
430
- };
431
-
432
- var _aspectRatio2 = _slicedToArray__default["default"](aspectRatio, 2),
433
- mobileAspectRatio = _aspectRatio2[0],
434
- _aspectRatio2$ = _aspectRatio2[1],
435
- desktopAspectRatio = _aspectRatio2$ === void 0 ? mobileAspectRatio : _aspectRatio2$;
436
-
437
- var isMobile = clientWidth("mobile");
438
- var imageAspectRatio = isMobile ? mobileAspectRatio : desktopAspectRatio;
439
- var imagePadding = isMobile ? getPadding(mobileAspectRatio) : getPadding(desktopAspectRatio);
440
- var slug = lodash.get(story, ["hero-image-s3-key"]) || lodash.get(story, ["alternative", "home", "default", "hero-image", "hero-image-s3-key"]);
441
- var hyperLink = lodash.get(story, ["hero-image-hyperlink"], "");
442
-
443
- var fallbackImage = function fallbackImage() {
444
- if (!slug) {
445
- if (fallbackImageUrl && !isStoryPageImage) {
446
- return /*#__PURE__*/React__default["default"].createElement("figure", {
447
- style: {
448
- paddingTop: imagePadding + "%"
449
- },
450
- className: "arr--responsive-hero-image " + _getClassName__default["default"]("image ".concat(getPlaceholderStyleName), _styleModuleImportMap$b)
451
- }, /*#__PURE__*/React__default["default"].createElement("img", {
452
- className: "qt-image",
453
- "data-src": "".concat(fallbackImageUrl),
454
- alt: "image-fallback"
455
- }));
456
- }
457
-
458
- return /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, defaultFallback ? /*#__PURE__*/React__default["default"].createElement("div", {
459
- "data-test-id": "arr--fallback-hero-image",
460
- style: {
461
- paddingTop: imagePadding + "%"
462
- },
463
- className: "arr--fallback-hero-image " + _getClassName__default["default"]("image ".concat(getPlaceholderStyleName), _styleModuleImportMap$b)
464
- }, /*#__PURE__*/React__default["default"].createElement(StoryTemplateIcon, {
465
- storyTemplate: story["story-template"]
466
- }), /*#__PURE__*/React__default["default"].createElement(FallbackImage, null)) : null);
467
- }
468
-
469
- return /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, /*#__PURE__*/React__default["default"].createElement("figure", {
470
- style: {
471
- paddingTop: imagePadding + "%"
472
- },
473
- className: "arr--responsive-hero-image " + _getClassName__default["default"]("image ".concat(getPlaceholderStyleName), _styleModuleImportMap$b)
474
- }, /*#__PURE__*/React__default["default"].createElement(StoryTemplateIcon, {
475
- storyTemplate: story["story-template"]
476
- }), /*#__PURE__*/React__default["default"].createElement(components.ResponsiveHeroImage, {
477
- story: story,
478
- aspectRatio: imageAspectRatio,
479
- defaultWidth: defaultWidth,
480
- widths: widths,
481
- imgParams: {
482
- auto: ["format", "compress"],
483
- fit: "max"
484
- }
485
- })), isStoryPageImage && hyperLink && /*#__PURE__*/React__default["default"].createElement(HyperLink, {
486
- hyperLink: hyperLink
487
- }));
488
- };
489
-
490
- return story && (isStoryPageImage ? /*#__PURE__*/React__default["default"].createElement("div", {
491
- "data-test-id": "arr--hero-image",
492
- className: "arr--hero-image " + _getClassName__default["default"]("".concat(heroImageClass, " ").concat(fullBleed, " ").concat(heroImageMobClasses), _styleModuleImportMap$b)
493
- }, fallbackImage()) : /*#__PURE__*/React__default["default"].createElement(components.Link, {
494
- "data-test-id": "arr--hero-image",
495
- href: getStoryUrl(story, "/".concat(story.slug)),
496
- externalLink: isExternalStory(story),
497
- "aria-label": "fallback-hero-image",
498
- className: "arr--hero-image " + _getClassName__default["default"]("".concat(heroImageClass, " ").concat(fullBleed, " ").concat(heroImageMobClasses), _styleModuleImportMap$b)
499
- }, fallbackImage()));
500
- };
501
- HeroImage.propTypes = {
502
- /** The Story Object from the API response */
503
- story: PropTypes__default["default"].object.isRequired,
504
-
505
- /** Removes the Hero Image padding for the image to bleed over the margin */
506
- FullBleed: PropTypes__default["default"].bool,
507
-
508
- /** The default width for the image, in case the browser does not support srcset */
509
- defaultWidth: PropTypes__default["default"].number,
510
-
511
- /** The list of available widths */
512
- widths: PropTypes__default["default"].array,
513
- // fatch the correct hero image
514
- aspectRatio: PropTypes__default["default"].array,
515
- // Hints for the browser to choose the best size
516
-
517
- /** This prop is responsible for adding padding-right of the image and remove padding bottom of the image */
518
- isHorizontal: PropTypes__default["default"].bool,
519
-
520
- /** This prop is responsible for adding padding-bottom in desktop and padding-right in mobile */
521
- isHorizontalMobile: PropTypes__default["default"].bool,
522
- // this prop is responsive for rendering fallback image on story page
523
- defaultFallback: PropTypes__default["default"].bool,
524
- isHorizontalWithImageLast: PropTypes__default["default"].bool,
525
- isStoryPageImage: PropTypes__default["default"].bool,
526
- config: PropTypes__default["default"].object
527
- };
528
- HeroImage.defaultProps = {
529
- FullBleed: true,
530
- aspectRatio: [[1, 1], [16, 9]],
531
- defaultWidth: 480,
532
- widths: [250, 480, 640],
533
- isHorizontal: false,
534
- isHorizontalMobile: false,
535
- defaultFallback: true,
536
- isStoryPageImage: false,
537
- isHorizontalWithImageLast: false,
538
- config: {}
539
- };
540
-
541
- var _styleModuleImportMap$a = {
542
- "./section.m.css": {
543
- "section": "section-m_section__2N4S3",
544
- "section-borderBottomSml": "section-m_section-borderBottomSml__2GNbo",
545
- "border-bottom": "section-m_border-bottom__3cRoD",
546
- "section-borderLeft": "section-m_section-borderLeft__3hKVj",
547
- "border-left": "section-m_border-left__2oUyp",
548
- "section-solid": "section-m_section-solid__1vB1Q",
549
- "dark": "section-m_dark__1r3C4",
550
- "light": "section-m_light__306hW"
551
- }
552
- };
553
- var SectionTag = function SectionTag(_ref) {
554
- var story = _ref.story,
555
- _ref$template = _ref.template,
556
- template = _ref$template === void 0 ? "" : _ref$template,
557
- _ref$borderColor = _ref.borderColor,
558
- borderColor = _ref$borderColor === void 0 ? "" : _ref$borderColor,
559
- isLightTheme = _ref.isLightTheme;
560
- var config = useStateValue() || {};
561
- var isSection = lodash.get(config, ["showSection"], true);
562
- var templateFromRowContext = lodash.get(config, ["sectionTagTemplate"]);
563
- var section = lodash.get(story, ["sections", 0], "");
564
- var supportedTemplates = ["borderBottomSml", "borderLeft", "solid"];
565
- var getUrl = section ? section["section-url"] : "/";
566
- var colorToApplyContrast = template === "solid" || templateFromRowContext === "solid" ? borderColor : config.theme;
567
- var textColor = isLightTheme ? "light" : getTextColor(colorToApplyContrast);
568
- var sectionTagBorderColor = rgbToHex(borderColor);
569
- var templateStyle = supportedTemplates.includes(template) ? "section section-".concat(template) : "section";
570
-
571
- if (templateFromRowContext) {
572
- templateStyle = supportedTemplates.includes(templateFromRowContext) ? "section section-".concat(templateFromRowContext) : "section";
573
- }
574
-
575
- if (!isSection) return null;
576
- return /*#__PURE__*/React__default["default"].createElement(components.Link, {
577
- href: getUrl,
578
- className: "arrow-component arr--section-name",
579
- "aria-label": "section-name"
580
- }, /*#__PURE__*/React__default["default"].createElement("div", {
581
- "data-test-id": "sectionTag",
582
- style: {
583
- backgroundColor: templateStyle.includes("section-solid") ? sectionTagBorderColor : ""
584
- },
585
- className: "section-tag arrow-component " + _getClassName__default["default"]("".concat(textColor, " ").concat(templateStyle), _styleModuleImportMap$a)
586
- }, templateStyle.includes("section-borderLeft") && /*#__PURE__*/React__default["default"].createElement("span", {
587
- className: "section-m_border-left__2oUyp",
588
- style: {
589
- color: sectionTagBorderColor
590
- }
591
- }), section["display-name"] || section["name"], /*#__PURE__*/React__default["default"].createElement("div", {
592
- className: "section-m_border-bottom__3cRoD",
593
- style: {
594
- backgroundColor: "".concat(template === "solid" ? "" : sectionTagBorderColor)
595
- }
596
- })));
597
- };
598
- SectionTag.propTypes = {
599
- /** The Story Object from the API response */
600
- story: PropTypes__default["default"].object.isRequired,
601
-
602
- /** The style template for section tag */
603
- template: PropTypes__default["default"].oneOf(["", "borderBottomSml", "borderLeft", "solid"]),
604
- borderColor: PropTypes__default["default"].string,
605
- solidBorderColor: PropTypes__default["default"].string,
606
- isLightTheme: PropTypes__default["default"].bool
607
- };
608
- SectionTag.defaultProps = {
609
- template: "",
610
- isLightTheme: false
611
- };
612
-
613
- var _styleModuleImportMap$9 = {
614
- "./timestamp.m.css": {
615
- "time": "timestamp-m_time__2v46i",
616
- "time-wrapper": "timestamp-m_time-wrapper__3O2lM",
617
- "bottom-fix": "timestamp-m_bottom-fix__1Zh8r",
618
- "dark": "timestamp-m_dark__2lk9E",
619
- "light": "timestamp-m_light__2QlrI"
620
- }
621
- };
622
- var TimeStamp = function TimeStamp(_ref) {
623
- var story = _ref.story,
624
- isBottom = _ref.isBottom,
625
- _ref$config = _ref.config,
626
- config = _ref$config === void 0 ? {} : _ref$config;
627
- var configState = useStateValue() || {};
628
- var isTime = lodash.get(config, ["showTime"], lodash.get(configState, ["showTime"], true));
629
- var time = story["last-published-at"] || story["first-published-at"];
630
- var isBottomClasses = isBottom ? "bottom-fix" : "";
631
- var textColor = getTextColor(configState.theme);
632
- return /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, isTime && /*#__PURE__*/React__default["default"].createElement("div", {
633
- "data-test-id": "publish-time",
634
- className: "time arr--publish-time " + _getClassName__default["default"]("time ".concat(textColor, " ").concat(isBottomClasses), _styleModuleImportMap$9)
635
- }, /*#__PURE__*/React__default["default"].createElement("div", {
636
- className: "timestamp-m_time-wrapper__3O2lM"
637
- }, getTimeStamp(time, formatter, config))));
638
- };
639
- TimeStamp.propTypes = {
640
- /** The Story Object from the API response */
641
- story: PropTypes__default["default"].object,
642
- isBottom: PropTypes__default["default"].bool,
643
- config: PropTypes__default["default"].object
644
- };
645
-
646
- var _styleModuleImportMap$8 = {
647
- "./author.m.css": {
648
- "author": "author-m_author__WRuLm",
649
- "author-image": "author-m_author-image__3q2oc",
650
- "author-name": "author-m_author-name__3WP-O",
651
- "bottom-fix": "author-m_bottom-fix__223TT",
652
- "prefix": "author-m_prefix__YSInK",
653
- "rtl-image": "author-m_rtl-image__2nglD",
654
- "ltr-image": "author-m_ltr-image__3bc0L",
655
- "dark": "author-m_dark__2TTlp",
656
- "light": "author-m_light__3y8_x"
657
- }
658
- };
659
-
660
- var AuthorBase = function AuthorBase(_ref) {
661
- var story = _ref.story,
662
- hideAuthorImage = _ref.hideAuthorImage,
663
- isBottom = _ref.isBottom,
664
- _ref$prefix = _ref.prefix,
665
- prefix = _ref$prefix === void 0 ? "" : _ref$prefix,
666
- _ref$config = _ref.config,
667
- config = _ref$config === void 0 ? {} : _ref$config;
668
- var configData = useStateValue() || {};
669
- var isAuthor = lodash.get(configData, ["showAuthor"], true);
670
-
671
- var _get = lodash.get(story, ["authors", "0"], ""),
672
- avatarUrl = _get["avatar-url"],
673
- avatarS3Key = _get["avatar-s3-key"],
674
- authorName = _get.name,
675
- slug = _get.slug;
676
-
677
- var isBottomClasses = isBottom ? "bottom-fix" : "";
678
- var textColor = getTextColor(configData.theme);
679
- var mountAt = lodash.get(config, ["mountAt"], "");
680
-
681
- var authorImage = function authorImage(dir) {
682
- if (!avatarUrl && !avatarS3Key) {
683
- return null;
684
- }
685
-
686
- return /*#__PURE__*/React__default["default"].createElement("div", {
687
- "data-test-id": "author-image",
688
- className: _getClassName__default["default"]("author-image ".concat(dir, "-image"), _styleModuleImportMap$8)
689
- }, /*#__PURE__*/React__default["default"].createElement("figure", null, avatarS3Key ? /*#__PURE__*/React__default["default"].createElement(components.ResponsiveImage, {
690
- slug: avatarS3Key,
691
- "aspect-ratio": [1, 1],
692
- defaultWidth: 400,
693
- imgParams: {
694
- auto: ["format", "compress"]
695
- },
696
- alt: authorName
697
- }) : /*#__PURE__*/React__default["default"].createElement("img", {
698
- src: avatarUrl
699
- })));
700
- };
701
-
702
- var isPrefix = function isPrefix(dir) {
703
- if (prefix) {
704
- return /*#__PURE__*/React__default["default"].createElement("div", {
705
- className: "arr-author-prefix " + _getClassName__default["default"]("prefix ".concat(textColor), _styleModuleImportMap$8)
706
- }, prefix);
707
- }
708
-
709
- return !hideAuthorImage && authorImage(dir);
710
- };
711
-
712
- return /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, isAuthor && /*#__PURE__*/React__default["default"].createElement(components.Link, {
713
- href: "".concat(mountAt, "/author/") + slug,
714
- "aria-label": "author-name",
715
- className: "author-name arr-author-name arrow-component " + _getClassName__default["default"]("author ".concat(isBottomClasses), _styleModuleImportMap$8)
716
- }, isPrefix("ltr"), /*#__PURE__*/React__default["default"].createElement("div", {
717
- "data-test-id": "author-name",
718
- className: "author-name " + _getClassName__default["default"]("author-name ".concat(textColor), _styleModuleImportMap$8)
719
- }, authorName || story["author-name"]), !prefix && isPrefix("rtl")));
720
- };
721
-
722
- function mapStateToProps$1(state) {
723
- return {
724
- config: lodash.get(state, ["qt", "config"], {})
725
- };
726
- }
727
-
728
- var Author = reactRedux.connect(mapStateToProps$1)(AuthorBase);
729
- AuthorBase.propTypes = {
730
- /** The Story Object from the API response */
731
- story: PropTypes__default["default"].object.isRequired,
732
-
733
- /** Hide Author Avatar Image */
734
- hideAuthorImage: PropTypes__default["default"].bool,
735
- // fix Author bottom of the storyCard
736
- isBottom: PropTypes__default["default"].bool,
737
- // fix prefix before the author name
738
- prefix: PropTypes__default["default"].string,
739
- config: PropTypes__default["default"].object
740
- };
741
- AuthorBase.defaultProps = {
742
- hideAuthorImage: false,
743
- isBottom: false,
744
- prefix: ""
745
- };
746
-
747
- var _styleModuleImportMap$7 = {
748
- "./dot.m.css": {
749
- "dark": "dot-m_dark__1Njxl",
750
- "light": "dot-m_light__27IA3"
751
- }
752
- };
753
- var Dot = function Dot(_ref) {
754
- var _ref$width = _ref.width,
755
- width = _ref$width === void 0 ? "3px" : _ref$width,
756
- _ref$height = _ref.height,
757
- height = _ref$height === void 0 ? "3px" : _ref$height,
758
- _ref$color = _ref.color,
759
- color = _ref$color === void 0 ? "light" : _ref$color;
760
- return /*#__PURE__*/React__default["default"].createElement("div", {
761
- className: _getClassName__default["default"](color, _styleModuleImportMap$7)
762
- }, /*#__PURE__*/React__default["default"].createElement("svg", {
763
- xmlns: "http://www.w3.org/2000/svg",
764
- width: width,
765
- height: height,
766
- viewBox: "0 0 3 3"
767
- }, /*#__PURE__*/React__default["default"].createElement("circle", {
768
- cx: "87",
769
- cy: "9",
770
- r: "1",
771
- fill: "inherit",
772
- fillRule: "nonzero",
773
- transform: "translate(-86 -8)"
774
- })));
775
- };
776
- Dot.propTypes = {
777
- /** height , width and color of the dot icon */
778
- color: PropTypes__default["default"].string,
779
- width: PropTypes__default["default"].string,
780
- height: PropTypes__default["default"].string
781
- };
782
-
783
- var _styleModuleImportMap$6 = {
784
- "./divider.m.css": {
785
- "dark": "divider-m_dark__26FRi",
786
- "light": "divider-m_light__w-7sy"
787
- }
788
- };
789
- var Divider = function Divider(_ref) {
790
- var _ref$width = _ref.width,
791
- width = _ref$width === void 0 ? "1" : _ref$width,
792
- _ref$height = _ref.height,
793
- height = _ref$height === void 0 ? "10" : _ref$height,
794
- _ref$color = _ref.color,
795
- color = _ref$color === void 0 ? "light" : _ref$color;
796
- return /*#__PURE__*/React__default["default"].createElement("div", {
797
- className: _getClassName__default["default"](color, _styleModuleImportMap$6)
798
- }, /*#__PURE__*/React__default["default"].createElement("svg", {
799
- xmlns: "http://www.w3.org/2000/svg",
800
- width: width,
801
- height: height
802
- }, /*#__PURE__*/React__default["default"].createElement("path", {
803
- fill: "inherit",
804
- d: "M0 0h1v10H0z"
805
- })));
806
- };
807
- Divider.propTypes = {
808
- /** height , width and color of the dot icon */
809
- color: PropTypes__default["default"].string,
810
- width: PropTypes__default["default"].string,
811
- height: PropTypes__default["default"].string
812
- };
813
-
814
- var _styleModuleImportMap$5 = {
815
- "./read-time.m.css": {
816
- "read-time-wrapper": "read-time-m_read-time-wrapper__3GyC_",
817
- "dot-indicator": "read-time-m_dot-indicator__3Sqh2",
818
- "dark": "read-time-m_dark__3yRaK",
819
- "light": "read-time-m_light__1GAZu"
820
- }
821
- };
822
- var ReadTime = function ReadTime(_ref) {
823
- var story = _ref.story,
824
- _ref$opts = _ref.opts,
825
- opts = _ref$opts === void 0 ? {} : _ref$opts,
826
- _ref$isLightTheme = _ref.isLightTheme,
827
- isLightTheme = _ref$isLightTheme === void 0 ? false : _ref$isLightTheme;
828
- var config = useStateValue() || {};
829
- var showReadTime = lodash.get(config, ["showReadTime"]) || lodash.get(opts, ["showReadTime"], true);
830
- var readTime = lodash.get(story, ["read-time"], 0);
831
- var textColor = isLightTheme ? "light" : getTextColor(config.theme);
832
- if (!showReadTime || !readTime) return null;
833
- var timeToRead = lodash.get(opts, ["localizedTimeToRead"]) || "min read";
834
- return /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, /*#__PURE__*/React__default["default"].createElement("div", {
835
- "data-test-id": "read-time",
836
- className: "arrow-component arr--read-time " + _getClassName__default["default"]("read-time-wrapper ".concat(textColor), _styleModuleImportMap$5)
837
- }, /*#__PURE__*/React__default["default"].createElement("span", {
838
- className: "read-time-indicator read-time-m_dot-indicator__3Sqh2"
839
- }, /*#__PURE__*/React__default["default"].createElement(Dot, {
840
- color: textColor
841
- })), /*#__PURE__*/React__default["default"].createElement("span", null, readTime, " ", timeToRead)));
842
- };
843
- ReadTime.propTypes = {
844
- story: PropTypes__default["default"].shape({
845
- "read-time": PropTypes__default["default"].number
846
- }),
847
- opts: PropTypes__default["default"].shape({
848
- showReadTime: PropTypes__default["default"].bool
849
- }),
850
- isLightTheme: PropTypes__default["default"].bool
851
- };
852
-
853
- var _styleModuleImportMap$4 = {
854
- "./author-with-timestamp.m.css": {
855
- "author-time-wrapper": "author-with-timestamp-m_author-time-wrapper__G7_eI",
856
- "author-image": "author-with-timestamp-m_author-image__24xrD",
857
- "dot": "author-with-timestamp-m_dot__1LHXD",
858
- "bottom-fix": "author-with-timestamp-m_bottom-fix__1rWGv",
859
- "dash": "author-with-timestamp-m_dash__2L5XC"
860
- }
861
- };
862
- var AuthorWithTime = function AuthorWithTime(_ref) {
863
- var story = _ref.story,
864
- separator = _ref.separator,
865
- isBottom = _ref.isBottom,
866
- hideAuthorImage = _ref.hideAuthorImage,
867
- prefix = _ref.prefix,
868
- _ref$config = _ref.config,
869
- config = _ref$config === void 0 ? {} : _ref$config,
870
- isLightTheme = _ref.isLightTheme;
871
- var configState = useStateValue() || {};
872
- var isAuthor = lodash.get(config, ["showAuthor"], lodash.get(configState, ["showAuthor"], true));
873
- var isTime = lodash.get(config, ["showTime"], lodash.get(configState, ["showTime"], true));
874
- var isReadTime = lodash.get(configState, ["showReadTime"], true);
875
- var isBottomClasses = isBottom ? "bottom-fix" : "";
876
- var seperatorStyle = separator === "dot" ? "dot" : "dash";
877
- var textColor = isLightTheme ? "light" : getTextColor(configState.theme);
878
-
879
- var getSeparator = function getSeparator() {
880
- if (separator === "divider") {
881
- return /*#__PURE__*/React__default["default"].createElement(Divider, {
882
- color: textColor
883
- });
884
- }
885
-
886
- return /*#__PURE__*/React__default["default"].createElement(Dot, {
887
- color: textColor
888
- });
889
- };
890
-
891
- var getTimeStamp = function getTimeStamp() {
892
- if (!isTime) return null;
893
- return /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, isAuthor && /*#__PURE__*/React__default["default"].createElement("span", {
894
- className: "arr-separator " + _getClassName__default["default"]("".concat(seperatorStyle), _styleModuleImportMap$4)
895
- }, getSeparator()), /*#__PURE__*/React__default["default"].createElement(TimeStamp, {
896
- story: story,
897
- config: config
898
- }), isReadTime && /*#__PURE__*/React__default["default"].createElement(ReadTime, {
899
- story: story,
900
- opts: config,
901
- isLightTheme: isLightTheme
902
- }));
903
- };
904
-
905
- return /*#__PURE__*/React__default["default"].createElement("div", {
906
- className: "arr--author-time " + _getClassName__default["default"]("author-time-wrapper ".concat(isBottomClasses), _styleModuleImportMap$4)
907
- }, isAuthor ? /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, /*#__PURE__*/React__default["default"].createElement(Author, {
908
- story: story,
909
- isBottom: true,
910
- hideAuthorImage: hideAuthorImage,
911
- prefix: prefix
912
- }), getTimeStamp()) : getTimeStamp());
913
- };
914
- AuthorWithTime.propTypes = {
915
- story: PropTypes__default["default"].object,
916
-
917
- /** Style of separator between the Author & Timestamp */
918
- separator: PropTypes__default["default"].oneOf(["dot", "divider"]),
919
-
920
- /** hide the author image */
921
- hideAuthorImage: PropTypes__default["default"].bool,
922
- // fix author and time at the end
923
- isBottom: PropTypes__default["default"].bool,
924
- // fix prefix before the author name
925
- prefix: PropTypes__default["default"].string,
926
- config: PropTypes__default["default"].object,
927
- isLightTheme: PropTypes__default["default"].bool
928
- };
929
- AuthorWithTime.defaultProps = {
930
- separator: "dot",
931
- isBottom: false,
932
- hideAuthorImage: true,
933
- prefix: "",
934
- isLightTheme: false
935
- };
936
-
937
- var _styleModuleImportMap$3 = {
938
- "./collection-name.m.css": {
939
- "collection": "collection-name-m_collection__JD6sx",
940
- "collection-borderLeft": "collection-name-m_collection-borderLeft__3Dznk",
941
- "border-left": "collection-name-m_border-left__3_pYw",
942
- "collection-borderBottomFull": "collection-name-m_collection-borderBottomFull__Dkq3K",
943
- "collection-borderBottom": "collection-name-m_collection-borderBottom__2rdQM",
944
- "collection-crossLine": "collection-name-m_collection-crossLine__1sIpN",
945
- "border-bottom": "collection-name-m_border-bottom__1MnlV",
946
- "dark": "collection-name-m_dark__nMe5H",
947
- "light": "collection-name-m_light__1vFDN"
948
- }
949
- };
950
- var CollectionNameBase = function CollectionNameBase(_ref) {
951
- var _ref$collectionNameBo = _ref.collectionNameBorderColor,
952
- collectionNameBorderColor = _ref$collectionNameBo === void 0 ? "" : _ref$collectionNameBo,
953
- collection = _ref.collection,
954
- config = _ref.config,
955
- collectionNameTemplate = _ref.collectionNameTemplate,
956
- headerLevel = _ref.headerLevel,
957
- _ref$customCollection = _ref.customCollectionName,
958
- customCollectionName = _ref$customCollection === void 0 ? "" : _ref$customCollection,
959
- _ref$navigate = _ref.navigate,
960
- navigate = _ref$navigate === void 0 ? true : _ref$navigate;
961
- var collectionTitle = useStateValue() || {};
962
- var showRowTitle = lodash.get(collectionTitle, ["showRowTitle"], true);
963
- var supportedTemplates = ["borderLeft", "borderBottom", "crossLine", "borderBottomFull"];
964
- var templateStyle = supportedTemplates.includes(collectionNameTemplate) ? " collection-".concat(collectionNameTemplate) : "";
965
- var slug = navigate && collection && getSlug(collection, config) || "";
966
- var collectionName = customCollectionName || collection.name || "";
967
- var textColor = getTextColor(collectionTitle.theme);
968
- var HeaderTag = "h" + headerLevel;
969
- var CollectionNameBorderColor = rgbToHex(collectionNameBorderColor);
970
- var borderBottomFullStyle = templateStyle.includes("collection-borderBottomFull") ? "4px solid ".concat(CollectionNameBorderColor) : "";
971
-
972
- var borderBottomStyle = function borderBottomStyle() {
973
- return templateStyle.includes("collection-borderBottom") && !templateStyle.includes("collection-borderBottomFull") ? /*#__PURE__*/React__default["default"].createElement("div", {
974
- className: "collection-name-m_border-bottom__1MnlV",
975
- style: {
976
- borderBottom: "4px solid ".concat(CollectionNameBorderColor)
977
- }
978
- }) : "";
979
- };
980
-
981
- var isMobile = clientWidth("mobile");
982
-
983
- var getBorderHeight = function getBorderHeight() {
984
- if (isMobile) {
985
- switch (headerLevel) {
986
- case "1":
987
- return "32px";
988
-
989
- case "2":
990
- return "24px";
991
-
992
- case "3":
993
- return "20px";
994
-
995
- case "4":
996
- return "18px";
997
-
998
- case "5":
999
- return "16px";
1000
-
1001
- case "6":
1002
- return "16px";
1003
-
1004
- default:
1005
- return "20px";
1006
- }
1007
- }
1008
-
1009
- switch (headerLevel) {
1010
- case "1":
1011
- return "40px";
1012
-
1013
- case "2":
1014
- return "32px";
1015
-
1016
- case "3":
1017
- return "24px";
1018
-
1019
- case "4":
1020
- return "20px";
1021
-
1022
- case "5":
1023
- return "18px";
1024
-
1025
- case "6":
1026
- return "16px";
1027
-
1028
- default:
1029
- return "24px";
1030
- }
1031
- };
1032
-
1033
- return /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, showRowTitle && collectionName && /*#__PURE__*/React__default["default"].createElement("div", {
1034
- style: {
1035
- borderBottom: borderBottomFullStyle
1036
- },
1037
- "data-test-id": "collection-name",
1038
- className: ("arr--collection-name arrow-component ".concat(templateStyle) ? "arr--collection-name arrow-component ".concat(templateStyle) + " " : "") + _getClassName__default["default"]("collection ".concat(textColor, " ").concat(templateStyle), _styleModuleImportMap$3)
1039
- }, templateStyle.includes("collection-borderLeft") && /*#__PURE__*/React__default["default"].createElement("span", {
1040
- className: "arr-collection-name-border-left collection-name-m_border-left__3_pYw",
1041
- style: {
1042
- color: CollectionNameBorderColor,
1043
- fontSize: getBorderHeight()
1044
- }
1045
- }), slug && !slug.includes(undefined) ? /*#__PURE__*/React__default["default"].createElement(components.Link, {
1046
- href: slug,
1047
- "aria-label": "collection-name"
1048
- }, /*#__PURE__*/React__default["default"].createElement(HeaderTag, null, collectionName)) : /*#__PURE__*/React__default["default"].createElement(HeaderTag, null, collectionName), borderBottomStyle()));
1049
- };
1050
- CollectionNameBase.propTypes = {
1051
- /** Collection name border color */
1052
- collectionNameBorderColor: PropTypes.PropTypes.string,
1053
-
1054
- /** The Collection Object from the API response */
1055
- collection: PropTypes.PropTypes.object,
1056
-
1057
- /** The publisher config from the API response */
1058
- config: PropTypes.PropTypes.object,
1059
-
1060
- /** The style template for the component */
1061
- collectionNameTemplate: PropTypes.PropTypes.oneOf(["", "borderLeft", "borderBottom", "crossLine", "borderBottomFull"]),
1062
-
1063
- /** Header tags ranging h1-h6, where h[headerLevel] */
1064
- headerLevel: PropTypes.PropTypes.string,
1065
- customCollectionName: PropTypes.PropTypes.string,
1066
- navigate: PropTypes.PropTypes.bool
1067
- };
1068
- CollectionNameBase.defaultProps = {
1069
- collectionNameTemplate: "",
1070
- headerLevel: "3"
1071
- };
1072
-
1073
- function mapStateToProps(state) {
1074
- return {
1075
- config: lodash.get(state, ["qt", "config"], {})
1076
- };
1077
- }
1078
-
1079
- var CollectionName = reactRedux.connect(mapStateToProps)(CollectionNameBase);
1080
-
1081
- var CrownIcon = function CrownIcon(_ref) {
1082
- var height = _ref.height,
1083
- width = _ref.width,
1084
- _ref$color = _ref.color,
1085
- color = _ref$color === void 0 ? "#D8D8D8" : _ref$color,
1086
- positionTop = _ref.positionTop;
1087
- return /*#__PURE__*/React__default["default"].createElement("svg", {
1088
- xmlns: "http://www.w3.org/2000/svg",
1089
- width: width,
1090
- height: height,
1091
- viewBox: "0 0 40 40",
1092
- style: {
1093
- position: "relative",
1094
- top: positionTop
1095
- }
1096
- }, /*#__PURE__*/React__default["default"].createElement("g", {
1097
- fill: "none",
1098
- fillRule: "evenodd",
1099
- stroke: "none",
1100
- strokeWidth: "1"
1101
- }, /*#__PURE__*/React__default["default"].createElement("g", null, /*#__PURE__*/React__default["default"].createElement("g", {
1102
- transform: "translate(8 8)"
1103
- }, /*#__PURE__*/React__default["default"].createElement("path", {
1104
- d: "M0 0H24V24H0z"
1105
- }), /*#__PURE__*/React__default["default"].createElement("g", {
1106
- fill: color,
1107
- fillRule: "nonzero",
1108
- transform: "translate(0 2)"
1109
- }, /*#__PURE__*/React__default["default"].createElement("path", {
1110
- 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"
1111
- }))))));
1112
- };
1113
- CrownIcon.propTypes = {
1114
- height: PropTypes__default["default"].string,
1115
- width: PropTypes__default["default"].string,
1116
- color: PropTypes__default["default"].string,
1117
- positionTop: PropTypes__default["default"].string
1118
- };
1119
-
1120
- var KeyIcon = function KeyIcon(_ref) {
1121
- var height = _ref.height,
1122
- width = _ref.width,
1123
- _ref$color = _ref.color,
1124
- color = _ref$color === void 0 ? "#D5D5D5" : _ref$color,
1125
- positionTop = _ref.positionTop;
1126
- return /*#__PURE__*/React__default["default"].createElement("svg", {
1127
- xmlns: "http://www.w3.org/2000/svg",
1128
- width: width,
1129
- height: height,
1130
- viewBox: "0 0 40 40",
1131
- style: {
1132
- position: "relative",
1133
- top: positionTop
1134
- }
1135
- }, /*#__PURE__*/React__default["default"].createElement("g", {
1136
- fill: "none",
1137
- fillRule: "evenodd",
1138
- stroke: "none",
1139
- strokeWidth: "1"
1140
- }, /*#__PURE__*/React__default["default"].createElement("g", null, /*#__PURE__*/React__default["default"].createElement("g", {
1141
- transform: "translate(8 8)"
1142
- }, /*#__PURE__*/React__default["default"].createElement("path", {
1143
- d: "M0 0H24V24H0z"
1144
- }), /*#__PURE__*/React__default["default"].createElement("path", {
1145
- fill: color,
1146
- fillRule: "nonzero",
1147
- 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",
1148
- transform: "translate(0 5)"
1149
- })))));
1150
- };
1151
- KeyIcon.propTypes = {
1152
- height: PropTypes__default["default"].string,
1153
- width: PropTypes__default["default"].string,
1154
- color: PropTypes__default["default"].string,
1155
- positionTop: PropTypes__default["default"].string
1156
- };
1157
-
1158
- var LockIcon = function LockIcon(_ref) {
1159
- var height = _ref.height,
1160
- width = _ref.width,
1161
- _ref$color = _ref.color,
1162
- color = _ref$color === void 0 ? "#D5D5D5" : _ref$color,
1163
- positionTop = _ref.positionTop;
1164
- return /*#__PURE__*/React__default["default"].createElement("svg", {
1165
- xmlns: "http://www.w3.org/2000/svg",
1166
- width: width,
1167
- height: height,
1168
- viewBox: "0 0 40 40",
1169
- style: {
1170
- position: "relative",
1171
- top: positionTop
1172
- }
1173
- }, /*#__PURE__*/React__default["default"].createElement("g", {
1174
- fill: "none",
1175
- fillRule: "evenodd",
1176
- stroke: "none",
1177
- strokeWidth: "1"
1178
- }, /*#__PURE__*/React__default["default"].createElement("g", null, /*#__PURE__*/React__default["default"].createElement("g", {
1179
- transform: "translate(8 8)"
1180
- }, /*#__PURE__*/React__default["default"].createElement("path", {
1181
- d: "M0 0H24V24H0z"
1182
- }), /*#__PURE__*/React__default["default"].createElement("g", {
1183
- fill: color,
1184
- fillRule: "nonzero",
1185
- transform: "translate(3)"
1186
- }, /*#__PURE__*/React__default["default"].createElement("path", {
1187
- 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"
1188
- }))))));
1189
- };
1190
- LockIcon.propTypes = {
1191
- height: PropTypes__default["default"].string,
1192
- width: PropTypes__default["default"].string,
1193
- color: PropTypes__default["default"].string,
1194
- positionTop: PropTypes__default["default"].string
1195
- };
1196
-
1197
- var StarIcon = function StarIcon(_ref) {
1198
- var width = _ref.width,
1199
- height = _ref.height,
1200
- _ref$color = _ref.color,
1201
- color = _ref$color === void 0 ? "#D5D5D5" : _ref$color,
1202
- _ref$positionTop = _ref.positionTop,
1203
- positionTop = _ref$positionTop === void 0 ? "" : _ref$positionTop;
1204
- return /*#__PURE__*/React__default["default"].createElement("svg", {
1205
- xmlns: "http://www.w3.org/2000/svg",
1206
- width: width,
1207
- height: height,
1208
- viewBox: "0 0 40 40",
1209
- style: {
1210
- position: "relative",
1211
- top: positionTop
1212
- }
1213
- }, /*#__PURE__*/React__default["default"].createElement("g", {
1214
- fill: "none",
1215
- fillRule: "evenodd",
1216
- stroke: "none",
1217
- strokeWidth: "1"
1218
- }, /*#__PURE__*/React__default["default"].createElement("g", null, /*#__PURE__*/React__default["default"].createElement("path", {
1219
- fill: color,
1220
- 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"
1221
- }))));
1222
- };
1223
- StarIcon.propTypes = {
1224
- height: PropTypes__default["default"].string,
1225
- width: PropTypes__default["default"].string,
1226
- color: PropTypes__default["default"].string,
1227
- positionTop: PropTypes__default["default"].string
1228
- };
1229
-
1230
- var PremiumStoryIcon = function PremiumStoryIcon(_ref) {
1231
- var width = _ref.width,
1232
- height = _ref.height,
1233
- color = _ref.color,
1234
- iconType = _ref.iconType,
1235
- positionTop = _ref.positionTop;
1236
-
1237
- switch (iconType) {
1238
- case "crown":
1239
- return /*#__PURE__*/React__default["default"].createElement(CrownIcon, {
1240
- width: width,
1241
- height: height,
1242
- color: color,
1243
- positionTop: positionTop
1244
- });
1245
-
1246
- case "lock":
1247
- return /*#__PURE__*/React__default["default"].createElement(LockIcon, {
1248
- width: width,
1249
- height: height,
1250
- color: color,
1251
- positionTop: positionTop
1252
- });
1253
-
1254
- case "key":
1255
- return /*#__PURE__*/React__default["default"].createElement(KeyIcon, {
1256
- width: width,
1257
- height: height,
1258
- color: color,
1259
- positionTop: positionTop
1260
- });
1261
-
1262
- default:
1263
- return /*#__PURE__*/React__default["default"].createElement(StarIcon, {
1264
- width: width,
1265
- height: height,
1266
- color: color,
1267
- positionTop: positionTop
1268
- });
1269
- }
1270
- };
1271
- PremiumStoryIcon.propTypes = {
1272
- width: PropTypes__default["default"].string,
1273
- height: PropTypes__default["default"].string,
1274
- color: PropTypes__default["default"].string,
1275
- iconType: PropTypes__default["default"].string,
1276
- positionTop: PropTypes__default["default"].string
1277
- };
1278
-
1279
- function LiveIcon() {
1280
- return /*#__PURE__*/React__default["default"].createElement("svg", {
1281
- className: "live-icon",
1282
- xmlns: "http://www.w3.org/2000/svg",
1283
- width: "25",
1284
- height: "24",
1285
- viewBox: "0 0 25 24"
1286
- }, /*#__PURE__*/React__default["default"].createElement("path", {
1287
- fill: "#ff5858",
1288
- 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"
1289
- }));
1290
- }
1291
-
1292
- var _styleModuleImportMap$2 = {
1293
- "./headline.m.css": {
1294
- "wrapper": "headline-m_wrapper__3nUmh",
1295
- "headline": "headline-m_headline__3_NhV",
1296
- "dark": "headline-m_dark__en3hW",
1297
- "light": "headline-m_light__3lKJB"
1298
- }
1299
- };
1300
- var Headline = function Headline(_ref) {
1301
- var story = _ref.story,
1302
- headerLevel = _ref.headerLevel,
1303
- _ref$premiumStoryIcon = _ref.premiumStoryIconConfig,
1304
- premiumStoryIconConfig = _ref$premiumStoryIcon === void 0 ? {} : _ref$premiumStoryIcon,
1305
- isLink = _ref.isLink;
1306
- var configData = useStateValue() || {};
1307
- var _premiumStoryIconConf = premiumStoryIconConfig.iconColor,
1308
- iconColor = _premiumStoryIconConf === void 0 ? "#F7B500" : _premiumStoryIconConf,
1309
- _premiumStoryIconConf2 = premiumStoryIconConfig.iconStyle,
1310
- iconStyle = _premiumStoryIconConf2 === void 0 ? "star" : _premiumStoryIconConf2,
1311
- _premiumStoryIconConf3 = premiumStoryIconConfig.enablePremiumStoryIcon,
1312
- enablePremiumStoryIcon = _premiumStoryIconConf3 === void 0 ? false : _premiumStoryIconConf3,
1313
- _premiumStoryIconConf4 = premiumStoryIconConfig.showLiveIcon,
1314
- showLiveIcon = _premiumStoryIconConf4 === void 0 ? false : _premiumStoryIconConf4;
1315
- var alternateHeadline = lodash.get(story, ["alternative", "home", "default", "headline"]);
1316
- var premiumStory = enablePremiumStoryIcon && lodash.get(story, ["access"]) === "subscription";
1317
- var headline = alternateHeadline || story.headline;
1318
- var HeaderTag = "h" + headerLevel;
1319
-
1320
- var positionHeadline = function positionHeadline() {
1321
- switch (parseInt(headerLevel)) {
1322
- case 1:
1323
- return "-2px";
1324
-
1325
- case 2:
1326
- return "2px";
1327
-
1328
- case 3:
1329
- return "4px";
1330
-
1331
- case 4:
1332
- return "5px";
1333
-
1334
- default:
1335
- return "6px";
1336
- }
1337
- };
1338
-
1339
- var textColor = getTextColor(configData.theme);
1340
- var wrapperClass = premiumStory ? "wrapper" : "";
1341
- var iconSize = "24px";
1342
- var enableLiveIcon = showLiveIcon && story["story-template"] === "live-blog" && !lodash.get(story, ["metadata", "is-closed"], false);
1343
- return /*#__PURE__*/React__default["default"].createElement("div", {
1344
- "data-test-id": "headline",
1345
- className: "arrow-component arr--headline " + _getClassName__default["default"](wrapperClass, _styleModuleImportMap$2)
1346
- }, premiumStory && /*#__PURE__*/React__default["default"].createElement(PremiumStoryIcon, {
1347
- width: iconSize,
1348
- height: iconSize,
1349
- color: iconColor,
1350
- iconType: iconStyle,
1351
- positionTop: positionHeadline()
1352
- }), isLink ? /*#__PURE__*/React__default["default"].createElement(components.Link, {
1353
- href: getStoryUrl(story, "/".concat(story.slug)),
1354
- externalLink: isExternalStory(story),
1355
- "aria-label": "headline"
1356
- }, /*#__PURE__*/React__default["default"].createElement(HeaderTag, {
1357
- className: _getClassName__default["default"]("headline ".concat(textColor), _styleModuleImportMap$2)
1358
- }, enableLiveIcon && /*#__PURE__*/React__default["default"].createElement(LiveIcon, null), headline)) : /*#__PURE__*/React__default["default"].createElement(HeaderTag, {
1359
- className: _getClassName__default["default"]("headline ".concat(textColor), _styleModuleImportMap$2)
1360
- }, enableLiveIcon && /*#__PURE__*/React__default["default"].createElement(LiveIcon, null), headline));
1361
- };
1362
- Headline.propTypes = {
1363
- /** The Story Object from the API response */
1364
- story: PropTypes__default["default"].object.isRequired,
1365
-
1366
- /** Header tags ranging h1-h6, where h[headerLevel] */
1367
- headerLevel: PropTypes__default["default"].string,
1368
- premiumStoryIconConfig: PropTypes__default["default"].shape({
1369
- iconColor: PropTypes__default["default"].string,
1370
- iconType: PropTypes__default["default"].string,
1371
- enablePremiumStoryIcon: PropTypes__default["default"].bool
1372
- }),
1373
- isLink: PropTypes__default["default"].bool
1374
- };
1375
- Headline.defaultProps = {
1376
- headerLevel: "6",
1377
- isLink: true
1378
- };
1379
-
1380
- var _styleModuleImportMap$1 = {
1381
- "./subheadline.m.css": {
1382
- "subheadline": "subheadline-m_subheadline__3fd7z",
1383
- "dark": "subheadline-m_dark__28u00",
1384
- "light": "subheadline-m_light__2YUOe"
1385
- }
1386
- };
1387
- var Subheadline = function Subheadline(_ref) {
1388
- var story = _ref.story,
1389
- _ref$truncateChars = _ref.truncateChars,
1390
- truncateChars = _ref$truncateChars === void 0 ? 200 : _ref$truncateChars,
1391
- lineClamp = _ref.lineClamp,
1392
- _ref$clazzName = _ref.clazzName,
1393
- clazzName = _ref$clazzName === void 0 ? "" : _ref$clazzName,
1394
- forceShowAtom = _ref.forceShowAtom,
1395
- showFullContent = _ref.showFullContent;
1396
- var config = useStateValue() || {};
1397
- var subheadline = forceShowAtom || lodash.get(config, ["showSubheadline"], true);
1398
- if (!subheadline) return null;
1399
- var textColor = getTextColor(config.theme);
1400
- return /*#__PURE__*/React__default["default"].createElement("div", {
1401
- style: {
1402
- WebkitLineClamp: lineClamp
1403
- },
1404
- "data-test-id": "subheadline",
1405
- className: ("p-alt arr--sub-headline arrow-component ".concat(clazzName) ? "p-alt arr--sub-headline arrow-component ".concat(clazzName) + " " : "") + _getClassName__default["default"]("subheadline ".concat(textColor), _styleModuleImportMap$1)
1406
- }, showFullContent || typeof lineClamp === "number" ? story.subheadline : truncate(story.subheadline, truncateChars, true));
1407
- };
1408
- Subheadline.propTypes = {
1409
- /** The Story Object from the API response */
1410
- story: PropTypes__default["default"].object.isRequired,
1411
- // Restricts the number of lines for subheadline.
1412
- lineClamp: PropTypes__default["default"].number,
1413
-
1414
- /** Number of characters to truncate the subheadline */
1415
- truncateChars: PropTypes__default["default"].number,
1416
- clazzName: PropTypes__default["default"].string,
1417
- forceShowAtom: PropTypes__default["default"].bool,
1418
- showFullContent: PropTypes__default["default"].bool
1419
- };
1420
- Subheadline.defaultProps = {
1421
- forceShowAtom: false,
1422
- showFullContent: false
1423
- };
1424
-
1425
- var _styleModuleImportMap = {
1426
- "./storycard.m.css": {
1427
- "author-timestamp-wrapper": "storycard-m_author-timestamp-wrapper__20yjp",
1428
- "default-card": "storycard-m_default-card__1-POn",
1429
- "horizontal-card": "storycard-m_horizontal-card___7afz",
1430
- "backgroung-img": "storycard-m_backgroung-img__1FMJT",
1431
- "content-overlap": "storycard-m_content-overlap__1yNHR",
1432
- "border-full": "storycard-m_border-full__1nhy7",
1433
- "light": "storycard-m_light__3EhXN",
1434
- "dark": "storycard-m_dark__2wCTq",
1435
- "border-bottom": "storycard-m_border-bottom__2_E-I",
1436
- "border-boxShadow": "storycard-m_border-boxShadow__2-k3Z",
1437
- "center-align": "storycard-m_center-align__1Sn8-",
1438
- "content-bottom": "storycard-m_content-bottom__1QHeC",
1439
- "content-full": "storycard-m_content-full__2zJmU",
1440
- "content-boxShadow": "storycard-m_content-boxShadow__2IAWZ",
1441
- "hero-image": "storycard-m_hero-image__1H3MB",
1442
- "right-padding": "storycard-m_right-padding__12-lQ",
1443
- "horizontal-mob": "storycard-m_horizontal-mob__17JG2",
1444
- "content": "storycard-m_content__1Q9vq",
1445
- "border-default": "storycard-m_border-default__PEZ1x",
1446
- "card": "storycard-m_card__KJwRa",
1447
- "horizontal-image-last": "storycard-m_horizontal-image-last__3o6LY"
1448
- }
1449
- };
1450
- var StoryCard = function StoryCard(_ref) {
1451
- var story = _ref.story,
1452
- children = _ref.children,
1453
- isHorizontal = _ref.isHorizontal,
1454
- aspectRatio = _ref.aspectRatio,
1455
- border = _ref.border,
1456
- useImageAsBackground = _ref.useImageAsBackground,
1457
- bgImgContentOverlap = _ref.bgImgContentOverlap,
1458
- theme = _ref.theme,
1459
- borderColor = _ref.borderColor,
1460
- isHorizontalMobile = _ref.isHorizontalMobile,
1461
- centerAlign = _ref.centerAlign,
1462
- headerLevel = _ref.headerLevel,
1463
- hideAuthorImage = _ref.hideAuthorImage,
1464
- prefix = _ref.prefix,
1465
- config = _ref.config,
1466
- isHorizontalWithImageLast = _ref.isHorizontalWithImageLast;
1467
- if (!story || isEmpty(story)) return /*#__PURE__*/React__default["default"].createElement("div", null);
1468
- var borderOptions = ["default", "full", "bottom", "boxShadow"];
1469
- var borderTemplate = borderOptions.includes(border) ? "border-".concat(border) : ""; // TODO optimize conditions
1470
-
1471
- var horizontalCardStyle = "default-card";
1472
- if (isHorizontal) horizontalCardStyle = "horizontal-card";else if (isHorizontalWithImageLast) horizontalCardStyle = "horizontal-image-last";
1473
- var bgImageClasses = useImageAsBackground ? "backgroung-img" : "";
1474
- var bgImgContentOverlapClass = bgImgContentOverlap ? "content-overlap" : "";
1475
- var textColor = getTextColor(theme);
1476
- var horizontalMobileClasses = isHorizontalMobile ? "horizontal-mob" : "";
1477
- var defaultStorycard = /*#__PURE__*/React__default["default"].createElement(DefaultStoryCard, {
1478
- story: story,
1479
- aspectRatio: aspectRatio,
1480
- border: border,
1481
- isHorizontalMobile: isHorizontalMobile,
1482
- isHorizontal: isHorizontal,
1483
- centerAlign: centerAlign,
1484
- headerLevel: headerLevel,
1485
- borderColor: borderColor,
1486
- hideAuthorImage: hideAuthorImage,
1487
- prefix: prefix,
1488
- config: config,
1489
- isHorizontalWithImageLast: isHorizontalWithImageLast
1490
- });
1491
- return /*#__PURE__*/React__default["default"].createElement("div", {
1492
- "data-test-id": "story-card",
1493
- style: {
1494
- backgroundColor: theme,
1495
- color: textColor
1496
- },
1497
- className: "arr--story-card " + _getClassName__default["default"]("card ".concat(horizontalCardStyle, " ").concat(borderTemplate, " ").concat(textColor, " ").concat(bgImageClasses, " ").concat(bgImgContentOverlapClass, " ").concat(horizontalMobileClasses), _styleModuleImportMap)
1498
- }, children || defaultStorycard);
1499
- };
1500
-
1501
- var DefaultStoryCard = function DefaultStoryCard(_ref2) {
1502
- var story = _ref2.story;
1503
- _ref2.border;
1504
- var isHorizontal = _ref2.isHorizontal,
1505
- aspectRatio = _ref2.aspectRatio,
1506
- headerLevel = _ref2.headerLevel,
1507
- _ref2$isHorizontalMob = _ref2.isHorizontalMobile,
1508
- isHorizontalMobile = _ref2$isHorizontalMob === void 0 ? false : _ref2$isHorizontalMob,
1509
- _ref2$centerAlign = _ref2.centerAlign,
1510
- centerAlign = _ref2$centerAlign === void 0 ? false : _ref2$centerAlign,
1511
- borderColor = _ref2.borderColor,
1512
- hideAuthorImage = _ref2.hideAuthorImage,
1513
- prefix = _ref2.prefix,
1514
- isHorizontalWithImageLast = _ref2.isHorizontalWithImageLast,
1515
- config = _ref2.config;
1516
- var alignment = centerAlign ? "center-align" : "";
1517
- var SectionTagborderColor = rgbToHex(borderColor);
1518
- var _config$localizationC = config.localizationConfig,
1519
- localizationConfig = _config$localizationC === void 0 ? {} : _config$localizationC;
1520
- return /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, isHorizontal ? /*#__PURE__*/React__default["default"].createElement(HeroImage, {
1521
- config: config,
1522
- story: story,
1523
- isHorizontal: true,
1524
- isHorizontalMobile: isHorizontalMobile,
1525
- aspectRatio: aspectRatio
1526
- }) : isHorizontalWithImageLast ? /*#__PURE__*/React__default["default"].createElement(HeroImage, {
1527
- config: config,
1528
- story: story,
1529
- isHorizontalWithImageLast: true,
1530
- isHorizontalMobile: isHorizontalMobile,
1531
- aspectRatio: aspectRatio
1532
- }) : /*#__PURE__*/React__default["default"].createElement(HeroImage, {
1533
- story: story,
1534
- config: config,
1535
- isHorizontalMobile: isHorizontalMobile,
1536
- aspectRatio: aspectRatio
1537
- }), /*#__PURE__*/React__default["default"].createElement("div", {
1538
- className: "arr--story-content " + _getClassName__default["default"]("content ".concat(alignment), _styleModuleImportMap)
1539
- }, /*#__PURE__*/React__default["default"].createElement(SectionTag, {
1540
- story: story,
1541
- borderColor: SectionTagborderColor
1542
- }), /*#__PURE__*/React__default["default"].createElement(Headline, {
1543
- story: story,
1544
- headerLevel: headerLevel,
1545
- premiumStoryIconConfig: config
1546
- }), /*#__PURE__*/React__default["default"].createElement(AuthorWithTime, {
1547
- config: localizationConfig,
1548
- story: story,
1549
- isBottom: true,
1550
- prefix: prefix,
1551
- hideAuthorImage: hideAuthorImage
1552
- }), /*#__PURE__*/React__default["default"].createElement(Subheadline, {
1553
- story: story
1554
- })));
1555
- };
1556
-
1557
- DefaultStoryCard.propTypes = {
1558
- story: PropTypes__default["default"].object.isRequired,
1559
- border: PropTypes__default["default"].oneOfType([PropTypes__default["default"].string]),
1560
- isBottom: PropTypes__default["default"].bool,
1561
- isHorizontal: PropTypes__default["default"].bool,
1562
- aspectRatio: PropTypes__default["default"].oneOfType([PropTypes__default["default"].array]),
1563
- isHorizontalMobile: PropTypes__default["default"].bool,
1564
- centerAlign: PropTypes__default["default"].bool,
1565
- headerLevel: PropTypes__default["default"].string,
1566
- borderColor: PropTypes__default["default"].string,
1567
- hideAuthorImage: PropTypes__default["default"].bool,
1568
- prefix: PropTypes__default["default"].string,
1569
- config: PropTypes__default["default"].object,
1570
- isHorizontalWithImageLast: PropTypes__default["default"].bool
1571
- };
1572
- StoryCard.propTypes = {
1573
- /** The Story Object from the API response */
1574
- story: PropTypes__default["default"].object.isRequired,
1575
- children: PropTypes__default["default"].node,
1576
-
1577
- /** Flip the Story Card to Horizonal mode */
1578
- isHorizontal: PropTypes__default["default"].bool,
1579
-
1580
- /** Add border to the Story Card */
1581
- border: PropTypes__default["default"].oneOfType([PropTypes__default["default"].string]),
1582
- // story card with background image
1583
- useImageAsBackground: PropTypes__default["default"].bool,
1584
- // story card content overlap with image
1585
- bgImgContentOverlap: PropTypes__default["default"].bool,
1586
-
1587
- /** add aspect ratio for hero image */
1588
- aspectRatio: PropTypes__default["default"].oneOfType([PropTypes__default["default"].array]),
1589
-
1590
- /** add theme(dark /light/custom color) for storycard */
1591
- theme: PropTypes__default["default"].string,
1592
-
1593
- /** flip the story card mobile design horizontal */
1594
- isHorizontalMobile: PropTypes__default["default"].bool,
1595
- // make content center align in desktop and left align in mobile
1596
- centerAlign: PropTypes__default["default"].bool,
1597
- headerLevel: PropTypes__default["default"].string,
1598
- borderColor: PropTypes__default["default"].string,
1599
- // handle author image through storycard
1600
- hideAuthorImage: PropTypes__default["default"].bool,
1601
- // handle author prefix through storycard
1602
- prefix: PropTypes__default["default"].string,
1603
- config: PropTypes__default["default"].object,
1604
- isHorizontalWithImageLast: PropTypes__default["default"].bool
1605
- };
1606
- StoryCard.defaultProps = {
1607
- isHorizontal: false,
1608
- isHorizontalMobile: false,
1609
- border: "default",
1610
- theme: "",
1611
- centerAlign: false,
1612
- borderColor: "",
1613
- isHorizontalWithImageLast: false
1614
- };
1615
-
1616
- function OtherNewsLinkComp(_ref) {
1617
- var slug = _ref.slug,
1618
- textColor = _ref.textColor,
1619
- Icon = _ref.Icon,
1620
- text = _ref.text;
1621
- return /*#__PURE__*/React__default["default"].createElement(components.Link, {
1622
- href: slug,
1623
- "aria-label": "arrow-icon"
1624
- }, /*#__PURE__*/React__default["default"].createElement("div", {
1625
- className: "four-col-twelve-story-m_other-news-container__37wlp"
1626
- }, /*#__PURE__*/React__default["default"].createElement("div", {
1627
- className: "four-col-twelve-story-m_other-news-text__1zKt-",
1628
- style: {
1629
- color: textColor
1630
- }
1631
- }, text), /*#__PURE__*/React__default["default"].createElement("div", {
1632
- className: "four-col-twelve-story-m_arrow-icon__2u_kA"
1633
- }, /*#__PURE__*/React__default["default"].createElement(Icon, null))));
1634
- }
1635
-
1636
- var SingleCol3Story = function SingleCol3Story(_ref2) {
1637
- var collection = _ref2.collection,
1638
- border = _ref2.border,
1639
- collectionNameTemplate = _ref2.collectionNameTemplate,
1640
- otherTextData = _ref2.otherTextData,
1641
- slug = _ref2.slug,
1642
- theme = _ref2.theme,
1643
- _ref2$config = _ref2.config,
1644
- config = _ref2$config === void 0 ? {} : _ref2$config;
1645
- var items = components.collectionToStories(collection);
1646
-
1647
- if (items.length < 1) {
1648
- return null;
1649
- }
1650
-
1651
- var _ref3 = items || [],
1652
- _ref4 = _toArray__default["default"](_ref3),
1653
- firstStory = _ref4[0],
1654
- rest = _ref4.slice(1);
1655
-
1656
- var text;
1657
- var Icon;
1658
- var textColor;
1659
- var contentPosition = "top";
1660
- var _config$localizationC = config.localizationConfig,
1661
- localizationConfig = _config$localizationC === void 0 ? {} : _config$localizationC;
1662
-
1663
- if (otherTextData) {
1664
- text = otherTextData.text;
1665
- Icon = otherTextData.Icon;
1666
- textColor = otherTextData.textColor;
1667
- contentPosition = otherTextData.contentPosition || contentPosition;
1668
- }
1669
-
1670
- return /*#__PURE__*/React__default["default"].createElement("div", null, /*#__PURE__*/React__default["default"].createElement("div", {
1671
- className: "four-col-twelve-story-m_collection-name-container__1yTXx"
1672
- }, /*#__PURE__*/React__default["default"].createElement(CollectionName, {
1673
- collection: collection,
1674
- headerLevel: "4",
1675
- collectionNameTemplate: collectionNameTemplate
1676
- }), contentPosition === "top" && text && Icon && /*#__PURE__*/React__default["default"].createElement("div", {
1677
- className: "four-col-twelve-story-m_other-news-top-container__32-SF"
1678
- }, /*#__PURE__*/React__default["default"].createElement(OtherNewsLinkComp, {
1679
- textColor: textColor,
1680
- Icon: Icon,
1681
- slug: slug,
1682
- text: text
1683
- }))), /*#__PURE__*/React__default["default"].createElement("div", {
1684
- className: "first-card"
1685
- }, /*#__PURE__*/React__default["default"].createElement(StoryCard, {
1686
- story: firstStory,
1687
- border: border,
1688
- theme: theme,
1689
- config: config
1690
- }, /*#__PURE__*/React__default["default"].createElement(HeroImage, {
1691
- story: firstStory,
1692
- aspectRatio: [[16, 9], [16, 9]]
1693
- }), /*#__PURE__*/React__default["default"].createElement(SectionTag, {
1694
- story: firstStory
1695
- }), /*#__PURE__*/React__default["default"].createElement(Headline, {
1696
- story: firstStory,
1697
- headerLevel: "4",
1698
- premiumStoryIconConfig: config
1699
- }), /*#__PURE__*/React__default["default"].createElement(AuthorWithTime, {
1700
- config: localizationConfig,
1701
- story: firstStory
1702
- }))), /*#__PURE__*/React__default["default"].createElement("div", {
1703
- className: "second-card"
1704
- }, rest.slice(0, 2).map(function (story, index) {
1705
- return /*#__PURE__*/React__default["default"].createElement(StoryCard, {
1706
- key: index,
1707
- story: story,
1708
- isHorizontal: true,
1709
- theme: theme,
1710
- border: border
1711
- }, /*#__PURE__*/React__default["default"].createElement(HeroImage, {
1712
- story: story,
1713
- aspectRatio: [[4, 3], [4, 3]]
1714
- }), /*#__PURE__*/React__default["default"].createElement("div", {
1715
- className: "small-card-container four-col-twelve-story-m_small-card-content-container__1Lu7D"
1716
- }, /*#__PURE__*/React__default["default"].createElement(Headline, {
1717
- story: story,
1718
- premiumStoryIconConfig: config
1719
- }), /*#__PURE__*/React__default["default"].createElement(AuthorWithTime, {
1720
- config: localizationConfig,
1721
- story: story
1722
- })));
1723
- })), contentPosition === "bottom" && text && Icon && /*#__PURE__*/React__default["default"].createElement("div", {
1724
- className: "four-col-twelve-story-m_other-news-link__1PEl4"
1725
- }, /*#__PURE__*/React__default["default"].createElement(OtherNewsLinkComp, {
1726
- textColor: textColor,
1727
- Icon: Icon,
1728
- slug: slug,
1729
- text: text
1730
- })));
1731
- };
1732
-
1733
- var FourColTwelveStoriesBase = function FourColTwelveStoriesBase(_ref5) {
1734
- var _ref5$collection = _ref5.collection,
1735
- collection = _ref5$collection === void 0 ? {} : _ref5$collection,
1736
- _ref5$publisherConfig = _ref5.publisherConfig,
1737
- publisherConfig = _ref5$publisherConfig === void 0 ? {} : _ref5$publisherConfig,
1738
- _ref5$config = _ref5.config,
1739
- config = _ref5$config === void 0 ? {} : _ref5$config,
1740
- otherTextData = _ref5.otherTextData;
1741
- var _config$theme = config.theme,
1742
- theme = _config$theme === void 0 ? "" : _config$theme,
1743
- _config$border = config.border,
1744
- border = _config$border === void 0 ? "" : _config$border,
1745
- _config$footerSlotCon = config.footerSlotConfig,
1746
- footerSlotConfig = _config$footerSlotCon === void 0 ? {} : _config$footerSlotCon,
1747
- _config$collectionNam = config.collectionNameTemplate,
1748
- collectionNameTemplate = _config$collectionNam === void 0 ? "" : _config$collectionNam;
1749
- var footerSlot = footerSlotConfig.footerSlot;
1750
- var footerSlotComp = footerSlot ? footerSlot() : null;
1751
- var getFilteredCollection = lodash.get(collection, ["items"], []).filter(function (collections) {
1752
- return collections.type === "collection";
1753
- }); // if number of collection is less than 4 return null
1754
-
1755
- if (getFilteredCollection.length < 4) return null;
1756
- var textColor = getTextColor(theme);
1757
- return /*#__PURE__*/React__default["default"].createElement("div", {
1758
- className: "full-width-with-padding arrow-component",
1759
- "data-test-id": "four-col-twelve-stories",
1760
- style: {
1761
- backgroundColor: theme,
1762
- color: textColor
1763
- }
1764
- }, /*#__PURE__*/React__default["default"].createElement("div", {
1765
- className: "four-col-twelve-story-m_columns-container__1YHu8"
1766
- }, getFilteredCollection.slice(0, 4).map(function (collection, index) {
1767
- var slugName = getSlug(collection, publisherConfig);
1768
- return /*#__PURE__*/React__default["default"].createElement(SingleCol3Story, {
1769
- border: border,
1770
- collection: collection,
1771
- collectionNameTemplate: collectionNameTemplate,
1772
- key: index,
1773
- slug: slugName,
1774
- otherTextData: otherTextData,
1775
- theme: theme
1776
- });
1777
- })), footerSlotComp);
1778
- };
1779
- FourColTwelveStoriesBase.propTypes = {
1780
- collection: PropTypes__default["default"].object.isRequired,
1781
- publisherConfig: PropTypes__default["default"].object,
1782
- otherTextData: PropTypes__default["default"].shape({
1783
- text: PropTypes__default["default"].string,
1784
- Icon: PropTypes__default["default"].func,
1785
- textColor: PropTypes__default["default"].string
1786
- }),
1787
- config: PropTypes__default["default"].shape({
1788
- theme: PropTypes__default["default"].string,
1789
- border: PropTypes__default["default"].string,
1790
- showSection: PropTypes__default["default"].bool,
1791
- showSubheadline: PropTypes__default["default"].bool,
1792
- showAuthor: PropTypes__default["default"].bool,
1793
- showTime: PropTypes__default["default"].bool,
1794
- showRowTitle: PropTypes__default["default"].bool,
1795
- collectionNameTemplate: PropTypes__default["default"].string
1796
- })
1797
- };
1798
- SingleCol3Story.propTypes = {
1799
- collection: PropTypes__default["default"].object.isRequired,
1800
- border: PropTypes__default["default"].string,
1801
- collectionNameTemplate: PropTypes__default["default"].string,
1802
- slug: PropTypes__default["default"].string,
1803
- theme: PropTypes__default["default"].string,
1804
- otherTextData: PropTypes__default["default"].shape({
1805
- text: PropTypes__default["default"].string,
1806
- Icon: PropTypes__default["default"].func,
1807
- textColor: PropTypes__default["default"].string,
1808
- // can be either 'top' or 'bottom'
1809
- contentPosition: PropTypes__default["default"].string
1810
- }),
1811
- config: PropTypes__default["default"].object
1812
- };
1813
- OtherNewsLinkComp.propTypes = {
1814
- slug: PropTypes__default["default"].string,
1815
- textColor: PropTypes__default["default"].string,
1816
- Icon: PropTypes__default["default"].func,
1817
- text: PropTypes__default["default"].string
1818
- };
1819
- var FourColTwelveStories = StateProvider(FourColTwelveStoriesBase);
1820
-
1821
- exports.FourColTwelveStories = FourColTwelveStories;
1822
- exports.FourColTwelveStoriesBase = FourColTwelveStoriesBase;