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