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