@mjhls/mjh-framework 1.0.885 → 1.0.886

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