@mjhls/mjh-framework 1.0.884-gridcontent-paginated-v2 → 1.0.884

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