@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,437 +0,0 @@
1
- import { _ as _JSON$stringify } from './stringify-2b084bee.js';
2
- import { a as _asyncToGenerator, r as regenerator, _ as _Promise } from './asyncToGenerator-5ef104a7.js';
3
- import { _ as _extends } from './extends-6d8e3924.js';
4
- import { _ as _toConsumableArray } from './toConsumableArray-f7074d7c.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 Spinner from 'react-bootstrap/Spinner';
10
- import { withRouter } from 'next/router';
11
- import { l as lodash } from './lodash-f97fd99a.js';
12
- import { m as main_43 } from './main-1894c974.js';
13
- import { A as ADlgInfeed } from './ADlgInfeed-013e1f4a.js';
14
- import { A as ADInfeed } from './ADInfeed-0a55cd2d.js';
15
- import { P as Pagination } from './Pagination-481eaaf5.js';
16
- import './_commonjsHelpers-0c4b6f40.js';
17
- import './core.get-iterator-method-ea258bb1.js';
18
- import './web.dom.iterable-ab4dea5c.js';
19
- import './_library-528f1934.js';
20
- import './_iter-detect-98db3b07.js';
21
- import './_object-pie-133f504a.js';
22
- import './_object-sap-7cee6f84.js';
23
- import './define-property-5f1bda73.js';
24
- import './typeof-e9fc0c5d.js';
25
- import './_is-array-8d21b9e3.js';
26
- import './events-6c3a7a63.js';
27
- import 'prop-types';
28
- import './slicedToArray-6ebcbfea.js';
29
- import 'react-bootstrap/Card';
30
- import './AdSlot.js';
31
- import './debounce-533d9748.js';
32
- import './isSymbol-a7e9aafe.js';
33
- import './toNumber-5aeba6e7.js';
34
- import './Beam.js';
35
- import './Segment.js';
36
-
37
- var MasterDeck = function (_React$Component) {
38
- _inherits(MasterDeck, _React$Component);
39
-
40
- function MasterDeck() {
41
- var _ref,
42
- _this2 = this;
43
-
44
- var _temp, _this, _ret;
45
-
46
- _classCallCheck(this, MasterDeck);
47
-
48
- for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
49
- args[_key] = arguments[_key];
50
- }
51
-
52
- return _ret = (_temp = (_this = _possibleConstructorReturn(this, (_ref = MasterDeck.__proto__ || _Object$getPrototypeOf(MasterDeck)).call.apply(_ref, [this].concat(args))), _this), _this.Deck = _this.props.deck, _this.data = _this.props.dataRecord || [], _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.rightItems = _this.props.rightItems ? _this.props.rightItems : false, _this.isSeriesLanding = _this.props.isSeriesLanding ? _this.props.isSeriesLanding : false, _this.state = {
53
- isDataLoading: false,
54
- data: _this.data,
55
- prevData: _this.data,
56
- currentPage: _this.props.currentPage || 1,
57
- dataRemapped: !_this.props.showBI || !_this.props.brandInsightAd,
58
- itemsPerPage: _this.props.params ? _this.props.params.to - _this.props.params.from : 2,
59
- mobileView: false
60
- }, _this.seoPagination = function (pageNumber) {
61
- var _this$props = _this.props,
62
- pageview = _this$props.pageview,
63
- router = _this$props.router;
64
-
65
- var path = router.asPath;
66
- var qrIndex = path.indexOf('?');
67
- var pathname = router.pathname;
68
- var queryString = '';
69
-
70
- if (qrIndex > 0) {
71
- path = path.substring(1, qrIndex);
72
-
73
- var partialQS = router.asPath.substring(qrIndex + 1);
74
- var partialQSArr = partialQS.split('&');
75
-
76
- // exclude page=xxx from query string
77
- partialQSArr.map(function (item) {
78
- var itemArr = item.split('=');
79
- var key = itemArr[0];
80
- var val = itemArr[1];
81
-
82
- if (key !== 'page') {
83
- queryString += (queryString.length === 0 ? '' : '&') + key + '=' + val;
84
- }
85
- });
86
- }
87
-
88
- if (queryString.length > 0) {
89
- path += '?' + queryString;
90
- }
91
-
92
- pageNumber = parseInt(pageNumber);
93
-
94
- if (path[0] !== '/') {
95
- path = '/' + path;
96
- }
97
- var newPath = pageNumber === 1 ? '' + path : path + '?page=' + pageNumber;
98
- if (window.location.href.includes('?')) {
99
- if (window.location.href.includes('?page')) {
100
- newPath = pageNumber === 1 ? '' + path : path + '?page=' + pageNumber;
101
- } else {
102
- newPath = pageNumber === 1 ? '' + path : path + '&page=' + pageNumber;
103
- }
104
- }
105
-
106
- // please leave this for later debug purpose : Yong Jun.
107
- /* console.log('page change reported', {
108
- currentPage: currentPage,
109
- pageNumber: pageNumber,
110
- pathname: pathname,
111
- path: path,
112
- newPath: newPath,
113
- firstPage: pageNumber === 1,
114
- queryString: queryString
115
- }) */
116
-
117
- if (pageview) {
118
- pageview(newPath);
119
- }
120
-
121
- router.push(pathname, newPath, {
122
- shallow: true
123
- });
124
- }, _this.cardLoader = function (_ref2) {
125
- var variant = _ref2.variant,
126
- brandInsightAd = _ref2.brandInsightAd,
127
- showBI = _ref2.showBI,
128
- lgInfeedAd = _ref2.lgInfeedAd;
129
-
130
- var numberOfItemsBeforeAd = 6;
131
- var data = _this.state.data;
132
- var insertBrandInsightAd = function insertBrandInsightAd(arr, index, newElement) {
133
- return [].concat(_toConsumableArray(arr.slice(0, index)), [newElement], _toConsumableArray(arr.slice(index)));
134
- };
135
- // Need to pass flag "lgInfeedAd={true}" along with brandInsightAd from site level for large infeed-ad to render
136
- // Checking lgInfeedAd flag in desktop view ( window >= 1400px ).
137
- // Integrating large infeed AD
138
- if (lgInfeedAd && brandInsightAd && typeof window !== 'undefined' && window.innerWidth >= 1400) {
139
- var lgInfeed = {
140
- _type: 'lg-infeed',
141
- adUnit: brandInsightAd.adUnit,
142
- className: 'lg-infeed',
143
- networkID: brandInsightAd.networkID,
144
- sizes: [728, 90],
145
- sizeMapping: [{
146
- viewport: [1400, 0],
147
- sizes: [[728, 90]]
148
- }, { viewport: [0, 0], sizes: [] }],
149
- targeting: {
150
- content_placement: brandInsightAd.targeting.content_placement,
151
- document_url: brandInsightAd.targeting.document_url,
152
- rootDocumentGroup: brandInsightAd.targeting.rootDocumentGroup
153
- },
154
- /* Passing refresh flag */
155
- refreshFlag: brandInsightAd.refreshFlag ? brandInsightAd.refreshFlag : false
156
- };
157
-
158
- var chunks = lodash.chunk(data, 6).map(function (chunk) {
159
- var set = lodash.chunk(chunk, 2);
160
- for (var i = 0; i < set.length; i++) {
161
- if (i !== set.length - 1) {
162
- set[i].push(lgInfeed);
163
- }
164
- }
165
- return lodash.flattenDeep(set);
166
- });
167
- data = lodash.flatten(chunks);
168
- !_this.state.dataRemapped && _this.setState({ dataRemapped: true }); // To detect if appending of insights ads are completed
169
- }
170
-
171
- // Integrating infeed AD
172
- if (showBI && brandInsightAd) {
173
- // Checking lgInfeedAd flag in desktop view ( window >= 1400px ).
174
- if (lgInfeedAd && typeof window !== 'undefined' && window.innerWidth >= 1400) brandInsightAd.interval = 8;
175
- var pos = 0;
176
- for (var i = 1; pos < data.length; i++) {
177
- var inFeedAd = {
178
- adUnit: brandInsightAd.adUnit,
179
- className: brandInsightAd.className,
180
- networkID: brandInsightAd.networkID,
181
- sizes: brandInsightAd.sizes,
182
- slotId: brandInsightAd.slotId + '_' + i,
183
- targeting: {
184
- pos: 'infeed',
185
- content_placement: brandInsightAd.targeting.content_placement,
186
- document_url: brandInsightAd.targeting.document_url,
187
- rootDocumentGroup: brandInsightAd.targeting.rootDocumentGroup
188
- },
189
- _type: 'brandInsightAd',
190
- /* Passing refresh flag */
191
- refreshFlag: brandInsightAd.refreshFlag ? brandInsightAd.refreshFlag : false
192
- };
193
-
194
- data = insertBrandInsightAd(data, pos, inFeedAd);
195
- pos += brandInsightAd.interval + 1;
196
- }
197
- }
198
-
199
- // 'index' was including the indexes for infeed ads along with article count making the page number change before it reaches last article.
200
- data = data.map(function (ele, i) {
201
- if (ele._type === 'lg-infeed') {
202
- // Setting pos as top2 for the first occurence of large infeed ad
203
- // const pos = data.indexOf(data.find((d) => d._type === 'lg-infeed')) === i ? 'top2' : `lg-infeed_${i}`
204
- return _extends({}, ele, { slotId: 'lg-infeed_' + i, targeting: _extends({}, ele.targeting, { pos: 'lg-infeed' }) });
205
- } else {
206
- return ele;
207
- }
208
- });
209
-
210
- return React__default.createElement(
211
- 'div',
212
- null,
213
- data && _this.state.dataRemapped && data.length > 0 ? // If JS enabled and Data remapped with ads
214
- data.map(function (row, index) {
215
- if (row._type === 'lg-infeed' && row.adUnit) {
216
- return React__default.createElement(ADlgInfeed, _extends({ index: index }, row));
217
- // Returning view for infeed Ad
218
- } else if (row._type === 'brandInsightAd' && row.adUnit) {
219
- return React__default.createElement(ADInfeed, { index: index, infeedAd: row });
220
- } else if (!row._type || !['lg-infeed', 'brandInsightAd'].includes(row._type)) {
221
- // Returning view for articles
222
- return React__default.createElement(
223
- React__default.Fragment,
224
- { key: index },
225
- React__default.createElement(_this2.Deck, { data: row, variant: variant, index: index, client: _this.props.client, defaultImage: _this.defaultImage, isSeriesLanding: _this.isSeriesLanding }),
226
- _this.state.mobileView && _this.rightItems && (index + 1) % numberOfItemsBeforeAd === 0 && React__default.createElement(
227
- 'div',
228
- { className: 'ad-container', style: { margin: '0 auto' } },
229
- _this.renderMobileAd(index, numberOfItemsBeforeAd, _this.rightItems)
230
- )
231
- );
232
- } else {
233
- return null;
234
- }
235
- }) : data && data.length > 0 ? // For Javascript Disabled Cases. data is not remapped if JS is disabled.
236
- data.map(function (row, index) {
237
- if (!row._type || !['lg-infeed', 'brandInsightAd'].includes(row._type)) {
238
- return React__default.createElement(
239
- React__default.Fragment,
240
- { key: index },
241
- React__default.createElement(_this2.Deck, { data: row, variant: variant, index: index, client: _this.props.client, defaultImage: _this.defaultImage, isSeriesLanding: _this.isSeriesLanding })
242
- );
243
- }
244
- }) : React__default.createElement(
245
- 'div',
246
- null,
247
- React__default.createElement(
248
- 'em',
249
- null,
250
- 'New content coming soon, please check back later.'
251
- )
252
- )
253
- );
254
- }, _this.renderMobileAd = function (index, numberOfItemsBeforeAd, rightItems) {
255
- var i = ((index + 1) / numberOfItemsBeforeAd - 1) % rightItems.length;
256
- return React__default.createElement(
257
- 'div',
258
- { className: 'ad-container', style: { display: 'flex', flex: '1 0 auto', width: '100%', textAlign: 'center', marginBottom: '2rem' } },
259
- rightItems[i].component
260
- );
261
- }, _this.handlePageChange = function () {
262
- var _ref3 = _asyncToGenerator( /*#__PURE__*/regenerator.mark(function _callee(selectedPage) {
263
- var itemsPerPage, _this$props2, query, params, client, dataHandler, seoPaginate, start, newParams, dataHandlerPromise, newData;
264
-
265
- return regenerator.wrap(function _callee$(_context) {
266
- while (1) {
267
- switch (_context.prev = _context.next) {
268
- case 0:
269
- itemsPerPage = _this.state.itemsPerPage;
270
- _this$props2 = _this.props, query = _this$props2.query, params = _this$props2.params, client = _this$props2.client, dataHandler = _this$props2.dataHandler, seoPaginate = _this$props2.seoPaginate;
271
-
272
- _this.setState({ isDataLoading: true, currentPage: selectedPage });
273
- seoPaginate && _this.seoPagination(selectedPage);
274
- lib_3.refresh();
275
- document.body.scrollTop = 0;
276
- document.documentElement.scrollTop = 0;
277
- start = (selectedPage - 1) * itemsPerPage;
278
- newParams = _extends({}, params, {
279
- from: start,
280
- to: start + itemsPerPage
281
- });
282
- dataHandlerPromise = null;
283
-
284
- if (dataHandler) {
285
- dataHandlerPromise = new _Promise(function (resolve, reject) {
286
- try {
287
- var result = dataHandler(newParams);
288
- resolve(result);
289
- } catch (e) {
290
- reject(e);
291
- }
292
- });
293
- }
294
-
295
- _context.prev = 11;
296
-
297
- if (!dataHandlerPromise) {
298
- _context.next = 18;
299
- break;
300
- }
301
-
302
- _context.next = 15;
303
- return dataHandlerPromise;
304
-
305
- case 15:
306
- _context.t0 = _context.sent;
307
- _context.next = 21;
308
- break;
309
-
310
- case 18:
311
- _context.next = 20;
312
- return client.fetch(query, newParams);
313
-
314
- case 20:
315
- _context.t0 = _context.sent;
316
-
317
- case 21:
318
- newData = _context.t0;
319
-
320
- if (_this.pointer && _this.pointerArray) newData = newData[_this.pointerArray][_this.pointer];
321
- if (newData && newData.length > 0) {
322
- _this.setState({ isDataLoading: false, data: newData });
323
- }
324
- _context.next = 29;
325
- break;
326
-
327
- case 26:
328
- _context.prev = 26;
329
- _context.t1 = _context['catch'](11);
330
-
331
- console.error(_context.t1);
332
-
333
- case 29:
334
- case 'end':
335
- return _context.stop();
336
- }
337
- }
338
- }, _callee, _this2, [[11, 26]]);
339
- }));
340
-
341
- return function (_x) {
342
- return _ref3.apply(this, arguments);
343
- };
344
- }(), _temp), _possibleConstructorReturn(_this, _ret);
345
- }
346
-
347
- _createClass(MasterDeck, [{
348
- key: 'componentDidUpdate',
349
- value: function componentDidUpdate(prevProps, prevState) {
350
- if (_JSON$stringify(this.state.prevData) !== _JSON$stringify(prevState.prevData) && this.props.seoPaginate) {
351
- this.seoPagination(this.state.currentPage);
352
- }
353
- // set dataRemap to true as there are no infeed or BI ads or window width is less than limit
354
- if (typeof window !== 'undefined' && (!this.props.lgInfeedAd || !this.props.brandInsightAd || window.innerWidth < 1400) && !this.state.dataRemapped) {
355
- !this.state.dataRemapped && this.setState({ dataRemapped: true });
356
- }
357
- if (typeof window !== 'undefined' && window.innerWidth <= 1191) {
358
- !this.state.mobileView && this.setState({ mobileView: true });
359
- }
360
- }
361
- }, {
362
- key: 'render',
363
- value: function render() {
364
- // Setting default value for 'showBI' and 'lgInfeedAd'
365
- var _props = this.props,
366
- variant = _props.variant,
367
- brandInsightAd = _props.brandInsightAd,
368
- _props$showBI = _props.showBI,
369
- showBI = _props$showBI === undefined ? false : _props$showBI,
370
- _props$lgInfeedAd = _props.lgInfeedAd,
371
- lgInfeedAd = _props$lgInfeedAd === undefined ? false : _props$lgInfeedAd,
372
- totalDataCount = _props.totalDataCount;
373
- var _state = this.state,
374
- data = _state.data,
375
- itemsPerPage = _state.itemsPerPage,
376
- currentPage = _state.currentPage,
377
- isDataLoading = _state.isDataLoading;
378
-
379
- return React__default.createElement(
380
- 'div',
381
- { className: 'contentDeck' },
382
- isDataLoading ? React__default.createElement(
383
- 'div',
384
- { className: 'd-flex justify-content-center', style: { marginTop: '100px' } },
385
- React__default.createElement(
386
- Spinner,
387
- { animation: 'border', role: 'status' },
388
- React__default.createElement(
389
- 'span',
390
- { className: 'sr-only' },
391
- 'Loading...'
392
- )
393
- )
394
- ) : data && data.length > 0 ? React__default.createElement(
395
- Container,
396
- null,
397
- this.cardLoader({ variant: variant, brandInsightAd: brandInsightAd, showBI: showBI, lgInfeedAd: lgInfeedAd }),
398
- React__default.createElement(
399
- 'div',
400
- { className: 'pagination-wrapper' },
401
- React__default.createElement(Pagination, {
402
- pageCount: Math.ceil(totalDataCount / itemsPerPage),
403
- pageRangeDisplayed: main_43 ? 3 : 9,
404
- currentPage: currentPage,
405
- onPageChange: this.handlePageChange
406
- }),
407
- React__default.createElement(
408
- 'style',
409
- { jsx: 'true' },
410
- '\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 '
411
- )
412
- )
413
- ) : null
414
- );
415
- }
416
- }], [{
417
- key: 'getDerivedStateFromProps',
418
- value: function getDerivedStateFromProps(props, state) {
419
- if (_JSON$stringify(props.dataRecord) !== _JSON$stringify(state.prevData)) {
420
- return {
421
- data: props.dataRecord,
422
- prevData: props.dataRecord,
423
- currentPage: props.currentPage
424
- };
425
- }
426
- return null;
427
- }
428
- // Passing 'brandInsightAd','showBI' and 'lgInfeedAd'
429
-
430
- }]);
431
-
432
- return MasterDeck;
433
- }(React__default.Component);
434
-
435
- var MasterDeck$1 = withRouter(MasterDeck);
436
-
437
- export default MasterDeck$1;