@mjhls/mjh-framework 1.0.884-gridcontent-paginated-v1 → 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 -695
  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 -684
  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,402 +0,0 @@
1
- import { _ as _toConsumableArray } from './toConsumableArray-f7074d7c.js';
2
- import { a as _asyncToGenerator, r as regenerator } from './asyncToGenerator-5ef104a7.js';
3
- import { _ as _extends } from './extends-6d8e3924.js';
4
- import { _ as _inherits, a as _classCallCheck, b as _possibleConstructorReturn, c as _Object$getPrototypeOf, d as _createClass } from './inherits-a6ba2ec4.js';
5
- import React__default from 'react';
6
- import { l as lib_3 } from './index-f0fc23eb.js';
7
- import Container from 'react-bootstrap/Container';
8
- import Row from 'react-bootstrap/Row';
9
- import Col from 'react-bootstrap/Col';
10
- import Card from 'react-bootstrap/Card';
11
- import { m as moment } from './moment-bc12cb97.js';
12
- import { withRouter } from 'next/router';
13
- import urlFor from './urlFor.js';
14
- import { L as LazyLoad } from './index-755f2cc2.js';
15
- import { m as main_43 } from './main-1894c974.js';
16
- import { c as clean_html_1 } from './entities-6d9154b4.js';
17
- import { A as ADInfeed } from './ADInfeed-0a55cd2d.js';
18
- import { P as Pagination } from './Pagination-481eaaf5.js';
19
- import Spinner from 'react-bootstrap/Spinner';
20
- import './_commonjsHelpers-0c4b6f40.js';
21
- import './core.get-iterator-method-ea258bb1.js';
22
- import './_iter-detect-98db3b07.js';
23
- import './web.dom.iterable-ab4dea5c.js';
24
- import './_library-528f1934.js';
25
- import './_object-pie-133f504a.js';
26
- import './_object-sap-7cee6f84.js';
27
- import './define-property-5f1bda73.js';
28
- import './typeof-e9fc0c5d.js';
29
- import './_is-array-8d21b9e3.js';
30
- import './events-6c3a7a63.js';
31
- import 'prop-types';
32
- import './slicedToArray-6ebcbfea.js';
33
- import './index-3f5c03b2.js';
34
- import 'react-dom';
35
- import './AdSlot.js';
36
- import './debounce-533d9748.js';
37
- import './isSymbol-a7e9aafe.js';
38
- import './toNumber-5aeba6e7.js';
39
- import './Beam.js';
40
- import './stringify-2b084bee.js';
41
- import './Segment.js';
42
-
43
- var DeckContent = function (_React$Component) {
44
- _inherits(DeckContent, _React$Component);
45
-
46
- function DeckContent() {
47
- var _ref,
48
- _this2 = this;
49
-
50
- var _temp, _this, _ret;
51
-
52
- _classCallCheck(this, DeckContent);
53
-
54
- for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
55
- args[_key] = arguments[_key];
56
- }
57
-
58
- return _ret = (_temp = (_this = _possibleConstructorReturn(this, (_ref = DeckContent.__proto__ || _Object$getPrototypeOf(DeckContent)).call.apply(_ref, [this].concat(args))), _this), _this.mapping = _this.props.mapping, _this.data = _this.props.dataRecord || [], _this.query = _this.props.query, _this.params = _this.props.params, _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.client = _this.props.client, _this.seoPaginate = _this.props.seoPaginate, _this.state = {
59
- data: _this.data,
60
- dataKeptToCompareNewDatarecord: _this.data,
61
- itemsPerPage: _this.params ? _this.params.itemsPerPage : _this.params.from && _this.params.to ? _this.params.to - _this.params.from : 30,
62
- page: _this.props.currentPage || 1,
63
- from: _this.params ? _this.params.from : 0,
64
- to: _this.params ? _this.params.to : 30,
65
- total_pages: null,
66
- query: _this.query,
67
- currentPage: _this.props.currentPage || 1,
68
- isDataLoading: false,
69
- totalDataCount: _this.props.totalDataCount
70
- }, _this.renderCardImage = function (row, page) {
71
- if (row.thumbnail && row.thumbnail.asset) {
72
- var url = urlFor({
73
- client: _this.client,
74
- source: row.thumbnail,
75
- imageHeight: _this.props.imageHeight || null,
76
- imageWidth: _this.props.imageWidth || null,
77
- imageFit: _this.props.imageFit || null
78
- });
79
- return url;
80
- } else {
81
- return _this.defaultImage;
82
- }
83
- }, _this.seoPagination = function (pageNumber) {
84
- var router = _this.props.router;
85
-
86
- var path = router.asPath;
87
- var qrIndex = path.indexOf('?');
88
- var pathname = router.pathname;
89
- var queryString = '';
90
- if (qrIndex > 0) {
91
- path = path.substring(1, qrIndex);
92
- var partialQS = router.asPath.substring(qrIndex + 1);
93
- var partialQSArr = partialQS.split('&');
94
- // exclude page=xxx from query string
95
- partialQSArr.map(function (item) {
96
- var itemArr = item.split('=');
97
- var key = itemArr[0];
98
- var val = itemArr[1];
99
- if (key !== 'page') queryString += (queryString.length === 0 ? '' : '&') + key + '=' + val;
100
- });
101
- }
102
- if (queryString.length > 0) path += '?' + queryString;
103
- pageNumber = parseInt(pageNumber);
104
- if (_this.state.page !== pageNumber) {
105
- if (path[0] !== '/') path = '/' + path;
106
- var newPath = pageNumber === 1 ? '' + path : '' + path + (queryString.length > 0 ? '&' : '?') + 'page=' + pageNumber;
107
- router.push(pathname, newPath, {
108
- shallow: true
109
- });
110
- }
111
- }, _this.handlePageChange = function () {
112
- var _ref2 = _asyncToGenerator( /*#__PURE__*/regenerator.mark(function _callee(selectedPage) {
113
- var start, newParams, newData;
114
- return regenerator.wrap(function _callee$(_context) {
115
- while (1) {
116
- switch (_context.prev = _context.next) {
117
- case 0:
118
- console.log('selectedPage', selectedPage);
119
- _this.setState({
120
- isDataLoading: true,
121
- currentPage: selectedPage
122
- });
123
- _this.seoPaginate && _this.seoPagination(selectedPage);
124
- lib_3.refresh();
125
- document.body.scrollTop = 0;
126
- document.documentElement.scrollTop = 0;
127
- start = (selectedPage - 1) * _this.state.itemsPerPage;
128
- newParams = _extends({}, _this.params, {
129
- from: start,
130
- to: start + _this.state.itemsPerPage
131
- });
132
- _context.prev = 8;
133
- _context.next = 11;
134
- return _this.client.fetch(_this.query, newParams);
135
-
136
- case 11:
137
- newData = _context.sent;
138
-
139
- if (_this.pointer && _this.pointerArray) newData = newData[pointerArray][pointer];
140
- if (newData && newData.length > 0) {
141
- _this.setState({
142
- isDataLoading: false,
143
- data: newData,
144
- page: selectedPage
145
- });
146
- }
147
- _context.next = 19;
148
- break;
149
-
150
- case 16:
151
- _context.prev = 16;
152
- _context.t0 = _context['catch'](8);
153
-
154
- console.error(_context.t0);
155
-
156
- case 19:
157
- case 'end':
158
- return _context.stop();
159
- }
160
- }
161
- }, _callee, _this2, [[8, 16]]);
162
- }));
163
-
164
- return function (_x) {
165
- return _ref2.apply(this, arguments);
166
- };
167
- }(), _this.renderAuthor = function (authorDetail, index, length) {
168
- if (authorDetail) {
169
- var _id = authorDetail._id,
170
- displayName = authorDetail.displayName,
171
- url = authorDetail.url;
172
-
173
- if (displayName && url && url.current) {
174
- return React__default.createElement(
175
- 'div',
176
- { key: _id },
177
- index === 0 && React__default.createElement(
178
- 'span',
179
- { className: 'pr-1' },
180
- 'By'
181
- ),
182
- React__default.createElement(
183
- 'a',
184
- { href: '/authors/${url.current}', className: 'text-muted' },
185
- displayName,
186
- length !== index + 1 && React__default.createElement('br', null)
187
- )
188
- );
189
- } else if (displayName) {
190
- return React__default.createElement(
191
- 'div',
192
- { key: _id },
193
- index === 0 && React__default.createElement(
194
- 'span',
195
- { className: 'pr-1' },
196
- 'By'
197
- ),
198
- React__default.createElement(
199
- 'span',
200
- { className: 'text-muted' },
201
- displayName,
202
- length !== index + 1 && React__default.createElement('br', null)
203
- )
204
- );
205
- }
206
- } else return null;
207
- }, _this.cardLoader = function (page, columns, variant, showBI, brandInsight) {
208
- var mode = variant && variant === 'bottom' ? 'column-reverse' : 'column';
209
-
210
- var itemCounter = 0;
211
- var lgVar = 12;
212
- var numberOfItemsBeforeAd = 6;
213
-
214
- var insert = function insert(arr, index, newElement) {
215
- return [].concat(_toConsumableArray(arr.slice(0, index)), [newElement], _toConsumableArray(arr.slice(index)));
216
- };
217
- var articles = [];
218
- if (showBI) {
219
- var data = _this.state.data;
220
- articles = data;
221
- var pos = 3;
222
- for (var i = 1; pos < articles.length; i++) {
223
- var inFeedAd = {
224
- adUnit: brandInsight.adUnit,
225
- className: brandInsight.className,
226
- networkID: brandInsight.networkID,
227
- sizes: brandInsight.sizes,
228
- slotId: brandInsight.slotId + '_' + i,
229
- targeting: {
230
- pos: 'infeed',
231
- content_placement: brandInsight.targeting.content_placement,
232
- document_url: brandInsight.targeting.document_url
233
- },
234
- _type: 'BrandInsight',
235
- /* Passing refresh flag */
236
- refreshFlag: brandInsight.refreshFlag ? brandInsight.refreshFlag : false
237
- };
238
-
239
- articles = insert(articles, pos, inFeedAd);
240
- pos += brandInsight.interval + 1;
241
- }
242
- } else {
243
- articles = _this.state.data;
244
- }
245
-
246
- return React__default.createElement(
247
- Row,
248
- null,
249
- articles && articles.map(function (row, index) {
250
- if (columns === 'rotate' && itemCounter % 3 === 0) {
251
- lgVar = 12;
252
- } else if (columns && columns !== 'rotate') {
253
- lgVar = Math.floor(12 / columns);
254
- } else {
255
- lgVar = 6;
256
- }
257
- if (row._type === 'BrandInsight' && row.adUnit) {
258
- return React__default.createElement(ADInfeed, { index: index, infeedAd: row });
259
- } else {
260
- var contentCategoryName = row.contentCategory && row.contentCategory.name && _this.mapping[row.contentCategory.name] ? row.contentCategory.name : 'Articles';
261
- return React__default.createElement(
262
- React__default.Fragment,
263
- { key: itemCounter },
264
- React__default.createElement(
265
- Col,
266
- { md: 12, lg: lgVar, counter: itemCounter++, style: { display: 'flex', flex: '1 0 auto' } },
267
- React__default.createElement(
268
- Card,
269
- { className: 'content-card', style: { flexDirection: mode } },
270
- (row.thumbnail && row.thumbnail.asset || _this.props.defaultImage) && React__default.createElement(
271
- 'a',
272
- { href: _this.mapping[contentCategoryName] + '/' + row.url.current },
273
- React__default.createElement(
274
- LazyLoad,
275
- { height: _this.props.imageHeight },
276
- React__default.createElement(Card.Img, { variant: 'top', src: _this.renderCardImage(row, page), alt: row.thumbnail && row.thumbnail.asset ? row.thumbnail.asset.originalFilename : '' })
277
- )
278
- ),
279
- React__default.createElement(
280
- Card.Body,
281
- null,
282
- React__default.createElement(
283
- 'a',
284
- { href: _this.mapping[contentCategoryName] + '/' + row.url.current },
285
- React__default.createElement(
286
- Card.Title,
287
- null,
288
- row.title
289
- )
290
- ),
291
- _this.props.showPublished && row.published && React__default.createElement(
292
- Card.Subtitle,
293
- null,
294
- moment(row.published).format('MMMM DD, YYYY')
295
- ),
296
- _this.props.showAuthor && row.authorMapping && row.authorMapping.length > 0 && row.authorMapping.map(function (authorDetail, index) {
297
- return _this.renderAuthor(authorDetail, index, row.authorMapping.length);
298
- }),
299
- React__default.createElement(
300
- Card.Text,
301
- null,
302
- clean_html_1(row.summary)
303
- )
304
- )
305
- )
306
- ),
307
- main_43 && _this.props.rightItems && (index + 1) % numberOfItemsBeforeAd === 0 && _this.renderMobileAd(index, numberOfItemsBeforeAd)
308
- );
309
- }
310
- })
311
- );
312
- }, _this.renderMobileAd = function (index, numberOfItemsBeforeAd) {
313
- var rightItems = _this.props.rightItems;
314
-
315
- var i = ((index + 1) / numberOfItemsBeforeAd - 1) % rightItems.length;
316
- return React__default.createElement(
317
- Col,
318
- { md: 12, style: { display: 'flex', flex: '1 0 auto' } },
319
- rightItems[i].component
320
- );
321
- }, _temp), _possibleConstructorReturn(_this, _ret);
322
- }
323
-
324
- _createClass(DeckContent, [{
325
- key: 'componentDidUpdate',
326
- value: function componentDidUpdate(prevProps, prevState) {
327
- if (this.state.dataKeptToCompareNewDatarecord !== this.props.dataRecord) {
328
- // eslint-disable-next-line react/no-did-update-set-state
329
- this.setState({
330
- data: this.props.dataRecord,
331
- dataKeptToCompareNewDatarecord: this.props.dataRecord,
332
- itemsPerPage: this.props.params ? this.props.params.to : 2,
333
- page: 1,
334
- from: this.props.params ? this.props.params.from : 0,
335
- to: this.props.params ? this.props.params.to : 2,
336
- total_pages: null,
337
- query: this.props.query,
338
- isDataLoading: false,
339
- totalDataCount: this.props.totalDataCount
340
- });
341
- }
342
- }
343
- }, {
344
- key: 'render',
345
- value: function render() {
346
- var _props = this.props,
347
- columns = _props.columns,
348
- variant = _props.variant,
349
- page = _props.page,
350
- showBI = _props.showBI,
351
- brandInsight = _props.brandInsight;
352
-
353
-
354
- return React__default.createElement(
355
- 'div',
356
- { className: 'contentDeck' },
357
- this.state.isDataLoading ? React__default.createElement(
358
- 'div',
359
- { className: 'd-flex justify-content-center', style: { marginTop: '100px' } },
360
- React__default.createElement(
361
- Spinner,
362
- { animation: 'border', role: 'status' },
363
- React__default.createElement(
364
- 'span',
365
- { className: 'sr-only' },
366
- 'Loading...'
367
- )
368
- )
369
- ) : React__default.createElement(
370
- React__default.Fragment,
371
- null,
372
- React__default.createElement(
373
- Container,
374
- null,
375
- this.cardLoader(page, columns, variant, showBI, brandInsight)
376
- ),
377
- React__default.createElement(
378
- 'div',
379
- { className: 'pagination-wrapper' },
380
- React__default.createElement(Pagination, {
381
- pageCount: Math.ceil(this.state.totalDataCount / this.state.itemsPerPage),
382
- pageRangeDisplayed: main_43 ? 3 : 9,
383
- currentPage: this.state.currentPage,
384
- onPageChange: this.handlePageChange
385
- }),
386
- React__default.createElement(
387
- 'style',
388
- { jsx: 'true' },
389
- '\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 '
390
- )
391
- )
392
- )
393
- );
394
- }
395
- }]);
396
-
397
- return DeckContent;
398
- }(React__default.Component);
399
-
400
- var ContentCardPaginated = withRouter(DeckContent);
401
-
402
- export default ContentCardPaginated;