@mjhls/mjh-framework 1.0.884-beta.0 → 1.0.884-beta.1

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 (91) hide show
  1. package/dist/cjs/AD.js +1 -1
  2. package/dist/cjs/AlgoliaSearch.js +1 -1
  3. package/dist/cjs/ArticleProgramLandingPage.js +6 -6
  4. package/dist/cjs/ArticleSeriesLandingPage.js +4 -4
  5. package/dist/cjs/ArticleSeriesListing.js +1 -1
  6. package/dist/cjs/ContentCardPaginated.js +409 -0
  7. package/dist/cjs/DeckContent.js +1 -1
  8. package/dist/cjs/DeckQueue.js +1 -1
  9. package/dist/cjs/DeckQueuePaginated.js +340 -0
  10. package/dist/cjs/{Dfp-14d2455c.js → Dfp-f492f985.js} +2 -2
  11. package/dist/cjs/ExternalResources.js +2 -2
  12. package/dist/cjs/GridContent.js +4 -116
  13. package/dist/cjs/GridContentPaginated.js +699 -0
  14. package/dist/cjs/HorizontalArticleListing.js +2 -2
  15. package/dist/cjs/ImageSlider-38f25e66.js +3989 -0
  16. package/dist/cjs/IssueLanding.js +2 -2
  17. package/dist/cjs/MasterDeck.js +1 -1
  18. package/dist/cjs/MasterDeckPaginated.js +444 -0
  19. package/dist/cjs/MediaSeriesCard-8d27612b.js +9411 -0
  20. package/dist/cjs/MediaSeriesLanding.js +26 -9415
  21. package/dist/cjs/MediaSeriesLandingPaginated.js +522 -0
  22. package/dist/cjs/Pagination-2f76381b.js +51 -0
  23. package/dist/cjs/PartnerDetailListing.js +15 -3986
  24. package/dist/cjs/PartnerDetailListingPaginated.js +312 -0
  25. package/dist/cjs/PublicationFeature-28c549f2.js +126 -0
  26. package/dist/cjs/QueueDeckExpandedPaginated.js +1378 -0
  27. package/dist/cjs/TaxonomyDescription.js +2 -2
  28. package/dist/cjs/VideoProgramLandingPage.js +5 -5
  29. package/dist/cjs/VideoSeriesLandingPage.js +4 -4
  30. package/dist/cjs/VideoSeriesListing.js +1 -1
  31. package/dist/cjs/View.js +83 -3
  32. package/dist/cjs/faundadb.js +15 -15
  33. package/dist/cjs/getRootDocGroup.js +3 -3
  34. package/dist/cjs/getSerializers.js +2 -2
  35. package/dist/cjs/{index-396089c0.js → index-54adcbc3.js} +1 -1
  36. package/dist/cjs/index.js +4 -4
  37. package/dist/cjs/{inherits-cba9c846.js → inherits-12d44cca.js} +2 -2
  38. package/dist/esm/{ADInfeed-8a038df9.js → ADInfeed-d767ebe2.js} +2 -2
  39. package/dist/esm/ArticleProgramLandingPage.js +1 -1
  40. package/dist/esm/ArticleSeriesLandingPage.js +1 -1
  41. package/dist/esm/ArticleSeriesListing.js +2 -2
  42. package/dist/esm/Column1.js +4 -4
  43. package/dist/esm/Column2.js +5 -5
  44. package/dist/esm/Column3.js +6 -6
  45. package/dist/esm/ContentCardPaginated.js +403 -0
  46. package/dist/esm/DeckContent.js +16 -16
  47. package/dist/esm/DeckQueue.js +18 -18
  48. package/dist/esm/DeckQueuePaginated.js +334 -0
  49. package/dist/esm/EventsDeck.js +26 -26
  50. package/dist/esm/ExternalResources.js +3 -3
  51. package/dist/esm/GridContent.js +38 -150
  52. package/dist/esm/GridContentPaginated.js +693 -0
  53. package/dist/esm/HamMagazine.js +4 -4
  54. package/dist/esm/HorizontalArticleListing.js +1 -1
  55. package/dist/esm/ImageSlider-a3154b97.js +3980 -0
  56. package/dist/esm/IssueContentDeck.js +14 -14
  57. package/dist/esm/IssueDeck.js +22 -22
  58. package/dist/esm/IssueLanding.js +2 -2
  59. package/dist/esm/MasterDeck.js +4 -4
  60. package/dist/esm/MasterDeckPaginated.js +438 -0
  61. package/dist/esm/MediaSeriesCard-1dd7eae8.js +9403 -0
  62. package/dist/esm/MediaSeriesLanding.js +23 -9411
  63. package/dist/esm/MediaSeriesLandingPaginated.js +517 -0
  64. package/dist/esm/NavDvm.js +3 -3
  65. package/dist/esm/NavMagazine.js +4 -4
  66. package/dist/esm/NavNative.js +5 -5
  67. package/dist/esm/Pagination-c0db7ca1.js +46 -0
  68. package/dist/esm/PartnerDetailListing.js +12 -3982
  69. package/dist/esm/PartnerDetailListingPaginated.js +307 -0
  70. package/dist/esm/PubSection.js +1 -1
  71. package/dist/esm/PublicationDeck.js +18 -18
  72. package/dist/esm/PublicationFeature-fa24dedb.js +121 -0
  73. package/dist/esm/PublicationLanding.js +22 -22
  74. package/dist/esm/QueueDeckExpanded.js +1 -1
  75. package/dist/esm/QueueDeckExpandedPaginated.js +1372 -0
  76. package/dist/esm/RolesDeck.js +12 -12
  77. package/dist/esm/Search.js +2 -2
  78. package/dist/esm/{SocialSearchComponent-b5be0e6c.js → SocialSearchComponent-dca69151.js} +3 -3
  79. package/dist/esm/TaxonomyCard.js +16 -16
  80. package/dist/esm/TaxonomyDescription.js +1 -1
  81. package/dist/esm/TemplateNormal.js +4 -4
  82. package/dist/esm/VideoProgramLandingPage.js +6 -6
  83. package/dist/esm/VideoSeriesLandingPage.js +1 -1
  84. package/dist/esm/VideoSeriesListing.js +3 -3
  85. package/dist/esm/View.js +84 -4
  86. package/dist/esm/getSerializers.js +1 -1
  87. package/dist/esm/{index-0e04b7d7.js → index-d1476645.js} +19 -19
  88. package/dist/esm/index.js +10 -9
  89. package/package.json +2 -1
  90. package/dist/cjs/Schema.js +0 -100
  91. package/dist/esm/Schema.js +0 -95
@@ -0,0 +1,693 @@
1
+ import './_commonjsHelpers-0c4b6f40.js';
2
+ import './core.get-iterator-method-86d4db69.js';
3
+ import './_library-528f1934.js';
4
+ import './_iter-detect-130ee549.js';
5
+ import { _ as _toConsumableArray } from './toConsumableArray-32282905.js';
6
+ import './_object-pie-33c40e79.js';
7
+ import { _ as _extends } from './extends-5b1796d4.js';
8
+ import './_object-sap-8b8ea5a9.js';
9
+ import { _ as _inherits, a as _classCallCheck, b as _possibleConstructorReturn, c as _Object$getPrototypeOf, d as _createClass } from './inherits-2409637d.js';
10
+ import './define-property-6d26cb48.js';
11
+ import './web.dom.iterable-f8f967cd.js';
12
+ import './typeof-c05a82ba.js';
13
+ import './_is-array-4df618a6.js';
14
+ import React__default from 'react';
15
+ import './events-6c3a7a63.js';
16
+ import { l as lib_3 } from './index-41a678ea.js';
17
+ import 'prop-types';
18
+ import Container from 'react-bootstrap/Container';
19
+ import Row from 'react-bootstrap/Row';
20
+ import Col from 'react-bootstrap/Col';
21
+ import Card from 'react-bootstrap/Card';
22
+ import { m as moment } from './moment-e2f9b20c.js';
23
+ import { withRouter } from 'next/router';
24
+ import './isSymbol-1981418f.js';
25
+ import './debounce-9207d8ee.js';
26
+ import './toNumber-2f7a84cd.js';
27
+ import 'react-dom';
28
+ import './slicedToArray-67a08c9c.js';
29
+ import './index-73819142.js';
30
+ import urlFor from './urlFor.js';
31
+ import { L as LazyLoad } from './index-5f7e79e7.js';
32
+ import { m as main_36 } from './main-c0612122.js';
33
+ import { c as clean_html_1 } from './entities-7cc3bf45.js';
34
+ import { _ as _JSON$stringify } from './stringify-70b72959.js';
35
+ import { a as _asyncToGenerator, r as regenerator } from './asyncToGenerator-7bf8bc4d.js';
36
+ import './Segment.js';
37
+ import './Beam.js';
38
+ import './AdSlot.js';
39
+ import { A as ADInfeed } from './ADInfeed-d767ebe2.js';
40
+ import { l as lodash } from './lodash-17fdfebb.js';
41
+ import { A as ADlgInfeed } from './ADlgInfeed-cee95aa2.js';
42
+ import { g as getContentCategory } from './getContentCategory-15dcc413.js';
43
+ import { g as get_1 } from './get-1e515072.js';
44
+ import './eq-b470f743.js';
45
+ import { A as AuthorComponent } from './AuthorComponent-e6f95c2f.js';
46
+ import 'react-bootstrap/Button';
47
+ import { P as PublicationFeature } from './PublicationFeature-fa24dedb.js';
48
+ import Spinner from 'react-bootstrap/Spinner';
49
+ import 'react-paginate';
50
+ import { P as Pagination } from './Pagination-c0db7ca1.js';
51
+
52
+ var GridContent = function (_React$Component) {
53
+ _inherits(GridContent, _React$Component);
54
+
55
+ function GridContent() {
56
+ var _ref,
57
+ _this2 = this;
58
+
59
+ var _temp, _this, _ret;
60
+
61
+ _classCallCheck(this, GridContent);
62
+
63
+ for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
64
+ args[_key] = arguments[_key];
65
+ }
66
+
67
+ return _ret = (_temp = (_this = _possibleConstructorReturn(this, (_ref = GridContent.__proto__ || _Object$getPrototypeOf(GridContent)).call.apply(_ref, [this].concat(args))), _this), _this.page = _this.props.page, _this.mapping = _this.props.mapping, _this.data = _this.props.dataRecord, _this.query = _this.props.query, _this.params = _this.props.params, _this.client = _this.props.client, _this.seoPaginate = _this.props.seoPaginate, _this.pointer = _this.props.pointer ? _this.props.pointer : false, _this.pointerArray = _this.props.pointerArray ? _this.props.pointerArray : false, _this.defaultImage = _this.props.defaultImage ? _this.props.defaultImage : '/placeholder.jpg', _this.state = {
68
+ isDataLoading: false,
69
+ data: _this.data,
70
+ prevData: _this.data,
71
+ itemsPerPage: _this.params ? _this.params.itemsPerPage : _this.params.from && _this.params.to ? _this.params.to - _this.params.from : 30,
72
+ currentPage: _this.props.currentPage || 1,
73
+ lgInfeedAd: _this.props.lgInfeedAd ? _this.props.lgInfeedAd : false,
74
+ showCategory: _this.props.showCategory ? _this.props.showCategory : false,
75
+ contentCategoryMapping: _this.props.contentCategoryMapping ? contentCategoryMapping : [],
76
+ totalDataCount: _this.props.totalDataCount
77
+ }, _this.componentDidUpdate = function (prevProps, prevState) {
78
+ var _this$props = _this.props,
79
+ pageview = _this$props.pageview,
80
+ currentPath = _this$props.router.asPath;
81
+ var prevPath = prevProps.router.asPath;
82
+
83
+ if (pageview && currentPath !== prevPath) {
84
+ pageview(currentPath);
85
+ }
86
+ }, _this.renderCardImage = function (row, page) {
87
+ if (row.thumbnail && row.thumbnail.asset) {
88
+ var url = urlFor({
89
+ client: _this.client,
90
+ source: row.thumbnail,
91
+ imageHeight: _this.props.imageHeight || null,
92
+ imageWidth: _this.props.imageWidth || null,
93
+ imageFit: _this.props.imageFit || null
94
+ });
95
+ return url;
96
+ } else {
97
+ return _this.defaultImage;
98
+ }
99
+ }, _this.seoPagination = function (pageNumber) {
100
+ var router = _this.props.router;
101
+
102
+ var path = router.asPath;
103
+ var qrIndex = path.indexOf('?');
104
+ var pathname = router.pathname;
105
+ var queryString = '';
106
+ if (qrIndex > 0) {
107
+ path = path.substring(1, qrIndex);
108
+ var partialQS = router.asPath.substring(qrIndex + 1);
109
+ var partialQSArr = partialQS.split('&');
110
+ // exclude page=xxx from query string
111
+ partialQSArr.map(function (item) {
112
+ var itemArr = item.split('=');
113
+ var key = itemArr[0];
114
+ var val = itemArr[1];
115
+ if (key !== 'page') queryString += (queryString.length === 0 ? '' : '&') + key + '=' + val;
116
+ });
117
+ }
118
+ if (queryString.length > 0) path += '?' + queryString;
119
+ pageNumber = parseInt(pageNumber);
120
+ if (_this.state.page !== pageNumber) {
121
+ if (path[0] !== '/') path = '/' + path;
122
+ var newPath = pageNumber === 1 ? '' + path : '' + path + (queryString.length > 0 ? '&' : '?') + 'page=' + pageNumber;
123
+ router.push(pathname, newPath, {
124
+ shallow: true
125
+ });
126
+ }
127
+ }, _this.handlePageChange = function () {
128
+ var _ref2 = _asyncToGenerator( /*#__PURE__*/regenerator.mark(function _callee(selectedPage) {
129
+ var start, newParams, newData;
130
+ return regenerator.wrap(function _callee$(_context) {
131
+ while (1) {
132
+ switch (_context.prev = _context.next) {
133
+ case 0:
134
+ console.log('selectedPage', selectedPage);
135
+ _this.setState({
136
+ isDataLoading: true,
137
+ currentPage: selectedPage
138
+ });
139
+ _this.seoPaginate && _this.seoPagination(selectedPage);
140
+ lib_3.refresh();
141
+ document.body.scrollTop = 0;
142
+ document.documentElement.scrollTop = 0;
143
+ start = (selectedPage - 1) * _this.state.itemsPerPage;
144
+ newParams = _extends({}, _this.params, {
145
+ from: start,
146
+ to: start + _this.state.itemsPerPage
147
+ });
148
+ _context.prev = 8;
149
+ _context.next = 11;
150
+ return _this.client.fetch(_this.query, newParams);
151
+
152
+ case 11:
153
+ newData = _context.sent;
154
+
155
+ if (_this.pointer && _this.pointerArray) newData = newData[pointerArray][pointer];
156
+ if (newData && newData.length > 0) {
157
+ _this.setState({
158
+ isDataLoading: false,
159
+ data: newData,
160
+ page: selectedPage
161
+ });
162
+ }
163
+ _context.next = 19;
164
+ break;
165
+
166
+ case 16:
167
+ _context.prev = 16;
168
+ _context.t0 = _context['catch'](8);
169
+
170
+ console.error(_context.t0);
171
+
172
+ case 19:
173
+ case 'end':
174
+ return _context.stop();
175
+ }
176
+ }
177
+ }, _callee, _this2, [[8, 16]]);
178
+ }));
179
+
180
+ return function (_x) {
181
+ return _ref2.apply(this, arguments);
182
+ };
183
+ }(), _this.checkExternalUrl = function (url) {
184
+ return new RegExp(['http', 'https'].join('|')).test(url);
185
+ }, _this.renderMobileAd = function (index, numberOfItemsBeforeAd) {
186
+ var rightItems = _this.props.rightItems;
187
+
188
+ var i = ((index + 1) / numberOfItemsBeforeAd - 1) % rightItems.length;
189
+ return React__default.createElement(
190
+ 'div',
191
+ { style: { display: 'flex', flex: '1 0 auto' } },
192
+ rightItems[i].component
193
+ );
194
+ }, _temp), _possibleConstructorReturn(_this, _ret);
195
+ }
196
+
197
+ _createClass(GridContent, [{
198
+ key: 'cardLoader',
199
+ value: function cardLoader(page, columns, variant, showVideo, VideoPlayer, showBI, brandInsight, lgInfeedAd, contentCategoryMapping) {
200
+ var _this3 = this;
201
+
202
+ var lgVar = Math.floor(12 / columns);
203
+ var itemCounter = 0;
204
+ var numberOfItemsBeforeAd = 6;
205
+ var numberOfItemsBeforeVideo = 3;
206
+ if (variant === 'stack') {
207
+ return React__default.createElement(
208
+ Row,
209
+ null,
210
+ this.state.data && this.state.data.length > 0 ? this.state.data.map(function (row, index) {
211
+ // const thumbnailURL = get(row, 'thumbnail.asset.url', this.props.defaultImage)
212
+ return React__default.createElement(
213
+ Col,
214
+ { key: index, md: 12, lg: lgVar, style: { display: 'flex', flex: '1 0 auto' } },
215
+ React__default.createElement(
216
+ Card,
217
+ { className: 'queue-card', style: { borderTop: '1px solid #EEE' } },
218
+ React__default.createElement(
219
+ Row,
220
+ { style: { flexDirection: 'row' } },
221
+ React__default.createElement(
222
+ Col,
223
+ { md: 12, lg: 4 },
224
+ React__default.createElement(
225
+ 'a',
226
+ { href: _this3.page + '/' + get_1(row, 'url.current') },
227
+ React__default.createElement(
228
+ LazyLoad,
229
+ { height: _this3.props.imageHeight },
230
+ React__default.createElement(Card.Img, { variant: 'top', src: _this3.renderCardImage(row, page), alt: row.thumbnail && row.thumbnail.asset ? row.thumbnail.asset.originalFilename : '' })
231
+ )
232
+ )
233
+ ),
234
+ React__default.createElement(
235
+ Col,
236
+ null,
237
+ React__default.createElement(
238
+ Card.Body,
239
+ { style: { padding: '20px' } },
240
+ React__default.createElement(
241
+ Card.Title,
242
+ null,
243
+ React__default.createElement(
244
+ 'a',
245
+ { href: _this3.page + '/' + get_1(row, 'url.current') },
246
+ row.title
247
+ )
248
+ ),
249
+ _this3.props.showPublished && row.published && React__default.createElement(
250
+ Card.Subtitle,
251
+ { style: { marginTop: 0 } },
252
+ moment(row.published).format('MMMM DD, YYYY')
253
+ ),
254
+ _this3.props.showAuthor && row.authorMapping && row.authorMapping.length > 0 && React__default.createElement(
255
+ LazyLoad,
256
+ { height: 50 },
257
+ React__default.createElement(AuthorComponent, { key: index.toString(), index: index, authors: row.authorMapping })
258
+ ),
259
+ _this3.props.showCategory && row.contentCategory && React__default.createElement(
260
+ LazyLoad,
261
+ { height: 50 },
262
+ React__default.createElement(
263
+ 'p',
264
+ {
265
+ className: 'article-category',
266
+ style: {
267
+ background: '#3FB618',
268
+ color: '#ffffff',
269
+ marginBottom: '.25rem',
270
+ display: 'inline-block',
271
+ padding: '0 .25rem',
272
+ fontSize: '.8rem'
273
+ } },
274
+ getContentCategory(row.contentCategory.name, contentCategoryMapping)
275
+ )
276
+ ),
277
+ React__default.createElement(
278
+ Card.Text,
279
+ null,
280
+ clean_html_1(row.summary)
281
+ )
282
+ )
283
+ )
284
+ )
285
+ )
286
+ );
287
+ }) : React__default.createElement(
288
+ 'div',
289
+ null,
290
+ React__default.createElement(
291
+ 'h5',
292
+ null,
293
+ React__default.createElement(
294
+ 'em',
295
+ null,
296
+ 'New content coming soon, please check back later.'
297
+ )
298
+ )
299
+ )
300
+ );
301
+ }
302
+
303
+ var insert = function insert(arr, index, newElement) {
304
+ return [].concat(_toConsumableArray(arr.slice(0, index)), [newElement], _toConsumableArray(arr.slice(index)));
305
+ };
306
+ var posts = [];
307
+ if (brandInsight && (lgInfeedAd || showBI)) {
308
+ var firstThree = this.state.data.slice(0, 3);
309
+ var data = this.state.data.slice(3);
310
+
311
+ // Need to pass flag "lgInfeedAd={true}" along with brandInsight from site level for large infeed-ad to render
312
+ // Checking lgInfeedAd flag in desktop view ( window >= 1400px ).
313
+ if (lgInfeedAd && typeof window !== 'undefined' && window.innerWidth >= 1400) {
314
+ var lgInFeedAd = {
315
+ _type: 'lg-infeed',
316
+ adUnit: brandInsight.adUnit,
317
+ className: 'lg-infeed',
318
+ networkID: brandInsight.networkID,
319
+ sizes: [728, 90],
320
+ // Adding sizeMapping for showing ad above 1400px
321
+ sizeMapping: [{
322
+ viewport: [1400, 0],
323
+ sizes: [[728, 90]]
324
+ }, { viewport: [0, 0], sizes: [] }],
325
+ targeting: {
326
+ content_placement: brandInsight.targeting.content_placement,
327
+ document_url: brandInsight.targeting.document_url,
328
+ rootDocumentGroup: brandInsight.targeting.rootDocumentGroup
329
+ },
330
+ /* Passing refresh flag */
331
+ refreshFlag: brandInsight.refreshFlag ? brandInsight.refreshFlag : false
332
+ };
333
+ var chunks = lodash.chunk(data, 6).map(function (chunk) {
334
+ var set = lodash.chunk(chunk, 2);
335
+ for (var i = 0; i < set.length; i++) {
336
+ if (i !== set.length - 1) {
337
+ set[i].push(lgInFeedAd);
338
+ }
339
+ }
340
+ return lodash.flattenDeep(set);
341
+ });
342
+
343
+ posts = lodash.flatten(chunks);
344
+ }
345
+
346
+ if (showBI) {
347
+ // Checking lgInfeedAd flag in desktop view ( window >= 1400px ).
348
+ if (lgInfeedAd && typeof window !== 'undefined' && window.innerWidth >= 1400) {
349
+ brandInsight.interval = 8;
350
+ } else if (typeof window !== 'undefined' && window.innerWidth < 1400) {
351
+ brandInsight.interval = 5;
352
+ posts = data;
353
+ }
354
+
355
+ var pos = 0;
356
+ for (var i = 1; pos < posts.length; i++) {
357
+ var inFeedAd = {
358
+ adUnit: brandInsight.adUnit,
359
+ className: brandInsight.className,
360
+ networkID: brandInsight.networkID,
361
+ sizes: brandInsight.sizes,
362
+ slotId: brandInsight.slotId + '_' + i,
363
+ targeting: {
364
+ pos: 'infeed',
365
+ content_placement: brandInsight.targeting.content_placement,
366
+ document_url: brandInsight.targeting.document_url,
367
+ rootDocumentGroup: brandInsight.targeting.rootDocumentGroup
368
+ },
369
+ _type: 'brandInsightAd',
370
+ /* Passing refresh flag */
371
+ refreshFlag: brandInsight.refreshFlag ? brandInsight.refreshFlag : false
372
+ };
373
+
374
+ posts = insert(posts, pos, inFeedAd);
375
+ pos += brandInsight.interval + 1;
376
+ }
377
+ }
378
+ posts = firstThree.concat(posts);
379
+ } else {
380
+ posts = this.state.data;
381
+ }
382
+
383
+ // 'articleCount' is New parameter to use instead of 'index' while passing to 'changePageNumber()'
384
+ // 'index' was including the indexes for infeed ads along with article count making the page number change before it reaches last article.
385
+ // 'articleCount' will be the indexes of only the articles in the deck.
386
+ var articleCount = -1;
387
+ posts = posts.map(function (ele, i) {
388
+ if (ele._type === 'lg-infeed') {
389
+ // Setting pos as top2 for the first occurence of large infeed ad
390
+ // const pos = posts.indexOf(posts.find((d) => d._type === 'lg-infeed')) === i ? 'top2' : `lg-infeed_${i}`
391
+ return _extends({}, ele, { slotId: 'lg-infeed_' + i, targeting: _extends({}, ele.targeting, { pos: 'lg-infeed' }) });
392
+ } else if (ele._type === 'article') {
393
+ // incrementing 'articleCount' for each article.
394
+ ++articleCount;
395
+ return _extends({}, ele, { articleCount: articleCount });
396
+ } else {
397
+ return ele;
398
+ }
399
+ });
400
+
401
+ var publicationFeature = this.props.publicationFeature;
402
+
403
+ if (publicationFeature) posts = insert(posts, 3, publicationFeature);
404
+
405
+ var itemsPerPage = this.props.params && this.props.params.itemsPerPage ? this.props.params.itemsPerPage : 10;
406
+ var heroContent = this.props.heroContent ? this.props.heroContent : 0;
407
+ var featureCount = 0;
408
+ return React__default.createElement(
409
+ 'div',
410
+ { className: 'grid-container' },
411
+ posts && posts.length > 0 ? posts.map(function (row, index) {
412
+ var contentCategoryName = row.contentCategory && row.contentCategory.name && _this3.mapping[row.contentCategory.name] ? row.contentCategory.name : 'Articles';
413
+ var linkHref = row.url && row.url.current ? _this3.mapping[contentCategoryName] + '/' + row.url.current : '';
414
+ if (row._type === 'feature') {
415
+ featureCount++;
416
+ if (row.blank || _this3.checkExternalUrl(row.url.current)) {
417
+ return React__default.createElement(
418
+ React__default.Fragment,
419
+ { key: itemCounter },
420
+ React__default.createElement(
421
+ 'div',
422
+ { counter: itemCounter++, style: { display: 'flex', flex: '1 0 auto' } },
423
+ React__default.createElement(
424
+ Card,
425
+ { className: 'content-card', style: { flexDirection: index === 0 || index % 4 === 0 ? 'top' : 'row' } },
426
+ (row.thumbnail && row.thumbnail.asset || _this3.props.defaultImage) && React__default.createElement(
427
+ 'a',
428
+ { rel: 'noopener', href: row.url.current, target: '_blank', className: index === 0 || index % 4 === 0 ? '' : 'card-image' },
429
+ React__default.createElement(
430
+ LazyLoad,
431
+ { height: _this3.props.imageHeight },
432
+ React__default.createElement(Card.Img, {
433
+ variant: 'top',
434
+ src: _this3.renderCardImage(row, page),
435
+ alt: row.thumbnail && row.thumbnail.asset ? row.thumbnail.asset.originalFilename : ''
436
+ })
437
+ )
438
+ ),
439
+ React__default.createElement(
440
+ Card.Body,
441
+ null,
442
+ React__default.createElement(
443
+ 'a',
444
+ { rel: 'noopener', href: row.url.current, target: '_blank' },
445
+ React__default.createElement(
446
+ Card.Title,
447
+ null,
448
+ row.title
449
+ )
450
+ ),
451
+ _this3.props.showPublished && row.published && React__default.createElement(
452
+ Card.Subtitle,
453
+ { style: { marginTop: 0 } },
454
+ moment(row.published).format('MMMM DD, YYYY')
455
+ ),
456
+ _this3.props.showAuthor && row.authorMapping && row.authorMapping.length > 0 && React__default.createElement(
457
+ LazyLoad,
458
+ { height: 50 },
459
+ React__default.createElement(AuthorComponent, { key: index.toString(), index: index, authors: row.authorMapping })
460
+ ),
461
+ React__default.createElement(
462
+ Card.Text,
463
+ { className: index === 0 || index % 4 === 0 ? '' : 'card-subtext' },
464
+ clean_html_1(row.summary)
465
+ )
466
+ )
467
+ )
468
+ ),
469
+ showVideo && (posts.length < numberOfItemsBeforeVideo || index + 1 === numberOfItemsBeforeVideo) && React__default.createElement(VideoPlayer, null),
470
+ main_36 && _this3.props.rightItems && (index + 1) % numberOfItemsBeforeAd === 0 && _this3.renderMobileAd(index, numberOfItemsBeforeAd)
471
+ );
472
+ } else {
473
+ return React__default.createElement(
474
+ React__default.Fragment,
475
+ { key: itemCounter },
476
+ React__default.createElement(
477
+ 'div',
478
+ { counter: itemCounter++, style: { display: 'flex', flex: '1 0 auto' } },
479
+ React__default.createElement(
480
+ Card,
481
+ { className: 'content-card', style: { flexDirection: index === 0 || index % 4 === 0 ? 'top' : 'row' } },
482
+ (row.thumbnail && row.thumbnail.asset || _this3.props.defaultImage) && React__default.createElement(
483
+ 'a',
484
+ { href: row.url.current, className: index === 0 || index % 4 === 0 ? '' : 'card-image' },
485
+ React__default.createElement(
486
+ LazyLoad,
487
+ { height: _this3.props.imageHeight },
488
+ React__default.createElement(Card.Img, {
489
+ variant: 'top',
490
+ src: _this3.renderCardImage(row, page),
491
+ alt: row.thumbnail && row.thumbnail.asset ? row.thumbnail.asset.originalFilename : ''
492
+ })
493
+ )
494
+ ),
495
+ React__default.createElement(
496
+ Card.Body,
497
+ null,
498
+ React__default.createElement(
499
+ 'a',
500
+ { href: row.url.current },
501
+ React__default.createElement(
502
+ Card.Title,
503
+ null,
504
+ row.title
505
+ )
506
+ ),
507
+ _this3.props.showPublished && row.published && React__default.createElement(
508
+ Card.Subtitle,
509
+ { style: { marginTop: 0 } },
510
+ moment(row.published).format('MMMM DD, YYYY')
511
+ ),
512
+ _this3.props.showAuthor && row.authorMapping && row.authorMapping.length > 0 && React__default.createElement(
513
+ LazyLoad,
514
+ { height: 50 },
515
+ React__default.createElement(AuthorComponent, { key: index.toString(), index: index, authors: row.authorMapping })
516
+ ),
517
+ React__default.createElement(
518
+ Card.Text,
519
+ { className: index === 0 || index % 4 === 0 ? '' : 'card-subtext' },
520
+ clean_html_1(row.summary)
521
+ )
522
+ )
523
+ )
524
+ ),
525
+ showVideo && (posts.length < numberOfItemsBeforeVideo || index + 1 === numberOfItemsBeforeVideo) && React__default.createElement(VideoPlayer, null),
526
+ main_36 && _this3.props.rightItems && (index + 1) % numberOfItemsBeforeAd === 0 && _this3.renderMobileAd(index, numberOfItemsBeforeAd)
527
+ );
528
+ }
529
+ } else if (row._type === 'lg-infeed' && row.adUnit) {
530
+ return React__default.createElement(ADlgInfeed, _extends({ index: index }, row));
531
+ } else if (row._type === 'brandInsightAd' && row.adUnit) {
532
+ return React__default.createElement(ADInfeed, { index: index, infeedAd: row });
533
+ } else if (row._type === 'publication') return React__default.createElement(PublicationFeature, { data: row, defaultImage: _this3.defaultImage, issueMapping: _this3.props.issueMapping, client: _this3.client });
534
+ if (index + 1 > heroContent + featureCount && (!row._type || !['lg-infeed', 'brandInsightAd'].includes(row._type))) {
535
+ return React__default.createElement(
536
+ React__default.Fragment,
537
+ { key: itemCounter },
538
+ React__default.createElement(
539
+ 'div',
540
+ { counter: itemCounter++, style: { display: 'flex', flex: '1 0 auto' } },
541
+ React__default.createElement(
542
+ Card,
543
+ { className: 'content-card', style: { flexDirection: index === 0 || index % 4 === 0 ? 'top' : 'row' } },
544
+ (row.thumbnail && row.thumbnail.asset || _this3.props.defaultImage) && React__default.createElement(
545
+ 'a',
546
+ { href: linkHref, className: index === 0 || index % 4 === 0 ? '' : 'card-image' },
547
+ React__default.createElement(
548
+ LazyLoad,
549
+ { height: _this3.props.imageHeight },
550
+ React__default.createElement(Card.Img, { variant: 'top', src: _this3.renderCardImage(row, page), alt: row.thumbnail && row.thumbnail.asset ? row.thumbnail.asset.originalFilename : '' })
551
+ )
552
+ ),
553
+ React__default.createElement(
554
+ Card.Body,
555
+ null,
556
+ React__default.createElement(
557
+ 'a',
558
+ { href: linkHref },
559
+ React__default.createElement(
560
+ Card.Title,
561
+ null,
562
+ row.title
563
+ )
564
+ ),
565
+ _this3.props.showPublished && row.published && React__default.createElement(
566
+ Card.Subtitle,
567
+ { style: { marginTop: 0 } },
568
+ moment(row.published).format('MMMM DD, YYYY')
569
+ ),
570
+ _this3.props.showAuthor && row.authorMapping && row.authorMapping.length > 0 && React__default.createElement(
571
+ LazyLoad,
572
+ { height: 50 },
573
+ React__default.createElement(AuthorComponent, { key: index.toString(), index: index, authors: row.authorMapping })
574
+ ),
575
+ _this3.props.showCategory && row.contentCategory && React__default.createElement(
576
+ LazyLoad,
577
+ { height: 50 },
578
+ React__default.createElement(
579
+ 'p',
580
+ {
581
+ className: 'article-category',
582
+ style: {
583
+ background: '#3FB618',
584
+ color: '#ffffff',
585
+ marginBottom: '.25rem',
586
+ display: 'inline-block',
587
+ padding: '0 .25rem',
588
+ fontSize: '.8rem'
589
+ } },
590
+ getContentCategory(row.contentCategory.name, contentCategoryMapping)
591
+ )
592
+ ),
593
+ React__default.createElement(
594
+ Card.Text,
595
+ { className: index === 0 || index % 4 === 0 ? '' : 'card-subtext' },
596
+ clean_html_1(row.summary)
597
+ )
598
+ )
599
+ )
600
+ ),
601
+ showVideo && (posts.length < numberOfItemsBeforeVideo || index + 1 === numberOfItemsBeforeVideo) && React__default.createElement(VideoPlayer, null),
602
+ main_36 && _this3.props.rightItems && (index + 1) % numberOfItemsBeforeAd === 0 && _this3.renderMobileAd(index, numberOfItemsBeforeAd)
603
+ );
604
+ } else return null;
605
+ }) : React__default.createElement(
606
+ 'div',
607
+ null,
608
+ React__default.createElement(
609
+ 'h5',
610
+ null,
611
+ React__default.createElement(
612
+ 'em',
613
+ null,
614
+ 'New content coming soon, please check back later.'
615
+ )
616
+ )
617
+ )
618
+ );
619
+ }
620
+ }, {
621
+ key: 'render',
622
+ value: function render() {
623
+ var _props = this.props,
624
+ columns = _props.columns,
625
+ variant = _props.variant,
626
+ page = _props.page,
627
+ showVideo = _props.showVideo,
628
+ VideoPlayer = _props.VideoPlayer,
629
+ showBI = _props.showBI,
630
+ brandInsight = _props.brandInsight;
631
+
632
+
633
+ return React__default.createElement(
634
+ 'div',
635
+ { className: 'contentDeck' },
636
+ this.state.isDataLoading ? React__default.createElement(
637
+ 'div',
638
+ { className: 'd-flex justify-content-center', style: { marginTop: '100px' } },
639
+ React__default.createElement(
640
+ Spinner,
641
+ { animation: 'border', role: 'status' },
642
+ React__default.createElement(
643
+ 'span',
644
+ { className: 'sr-only' },
645
+ 'Loading...'
646
+ )
647
+ )
648
+ ) : React__default.createElement(
649
+ React__default.Fragment,
650
+ null,
651
+ React__default.createElement(
652
+ 'div',
653
+ { className: 'pagination-wrapper' },
654
+ React__default.createElement(
655
+ Container,
656
+ null,
657
+ this.cardLoader(page, columns, variant, showVideo, VideoPlayer, showBI, brandInsight, this.state.lgInfeedAd, this.state.contentCategoryMapping)
658
+ ),
659
+ React__default.createElement(Pagination, {
660
+ pageCount: Math.ceil(this.state.totalDataCount / this.state.itemsPerPage),
661
+ pageRangeDisplayed: main_36 ? 3 : 9,
662
+ currentPage: this.state.currentPage,
663
+ onPageChange: this.handlePageChange
664
+ }),
665
+ React__default.createElement(
666
+ 'style',
667
+ { jsx: 'true' },
668
+ '\n .pagination-wrapper {\n margin: 3rem 0;\n }\n @media only screen and (max-width: 768px) {\n .pagination-wrapper {\n margin-bottom: 6rem;\n }\n }\n '
669
+ )
670
+ )
671
+ )
672
+ );
673
+ }
674
+ }], [{
675
+ key: 'getDerivedStateFromProps',
676
+ value: function getDerivedStateFromProps(props, state) {
677
+ if (_JSON$stringify(props.dataRecord) !== _JSON$stringify(state.prevData)) {
678
+ return {
679
+ data: props.dataRecord,
680
+ prevData: props.dataRecord,
681
+ currentPage: props.currentPage
682
+ };
683
+ }
684
+ return null;
685
+ }
686
+ }]);
687
+
688
+ return GridContent;
689
+ }(React__default.Component);
690
+
691
+ var GridContentPaginated = React__default.memo(withRouter(GridContent));
692
+
693
+ export default GridContentPaginated;