@mjhls/mjh-framework 1.0.884-content-card-pagination-v1 → 1.0.884-gridcontent-paginated-v1

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