@mjhls/mjh-framework 1.0.365 → 1.0.367

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.
package/dist/esm/index.js CHANGED
@@ -1,14 +1,14 @@
1
1
  import { c as createCommonjsModule, a as commonjsGlobal, g as getCjsExportFromNamespace, u as unwrapExports } from './_commonjsHelpers-0c4b6f40.js';
2
2
  import { _ as _objectKeys, a as _toObject, b as _core } from './_to-object-b9b796ec.js';
3
3
  import './web.dom.iterable-7e9bebf9.js';
4
- import { d as debounce_1, l as lib_3, a as lib_1, i as isObjectLike_1, _ as _baseGetTag, t as toNumber_1, b as _root, c as _freeGlobal } from './debounce-702eb224.js';
4
+ import { l as lib_3, d as debounce_1, a as lib_1, i as isObjectLike_1, _ as _baseGetTag, t as toNumber_1, b as _root, c as _freeGlobal } from './debounce-702eb224.js';
5
5
  import { m as main_39, a as main_16, b as main_38 } from './main-cb86f95d.js';
6
6
  import { _ as _toConsumableArray, a as _Array$from } from './toConsumableArray-2718dc16.js';
7
7
  import { _ as _extends$2, a as _Object$assign } from './extends-26d3b609.js';
8
8
  import { _ as _objectSap, a as _inherits$1, b as _classCallCheck$1, c as _possibleConstructorReturn$1, d as _Object$getPrototypeOf, e as _createClass$1 } from './inherits-4b85034c.js';
9
9
  import React__default, { useState, useEffect, useRef } from 'react';
10
10
  import PropTypes from 'prop-types';
11
- import Container from 'react-bootstrap/Container';
11
+ import Container$1 from 'react-bootstrap/Container';
12
12
  import Row from 'react-bootstrap/Row';
13
13
  import Col from 'react-bootstrap/Col';
14
14
  import Card from 'react-bootstrap/Card';
@@ -18,12 +18,12 @@ import { I as InfiniteScroll, V as VisibilitySensor } from './visibility-sensor-
18
18
  import 'react-dom';
19
19
  import { i as imageUrlBuilder } from './index-51a80699.js';
20
20
  import { L as LazyLoad } from './index-5f9f807a.js';
21
- import { h as html_decode_1, c as clean_html_1 } from './entities-7cc3bf45.js';
21
+ import { c as clean_html_1, h as html_decode_1 } from './entities-7cc3bf45.js';
22
22
  import { _ as _slicedToArray, a as _getIterator } from './slicedToArray-a47a84a4.js';
23
23
  import { _ as _JSON$stringify, a as _asyncToGenerator, r as regenerator, D as DFPAdSlot, B as Beam } from './AdSlot-8946358f.js';
24
24
  export { D as AdSlot, B as Beam } from './AdSlot-8946358f.js';
25
25
  import './promise-86cb8313.js';
26
- import './ADInfeed-ca26fca6.js';
26
+ import { A as ADInfeed } from './ADInfeed-ca26fca6.js';
27
27
  export { default as DeckContent } from './DeckContent.js';
28
28
  import { i as isFunction_1, a as isArray_1, _ as _arrayMap } from './get-36d03764.js';
29
29
  export { A as AD, G as GridContent } from './GridContent-e2b1de22.js';
@@ -37,7 +37,7 @@ import { g as getYoutubeId } from './smoothscroll-4b699764.js';
37
37
  import GroupDeck from './GroupDeck.js';
38
38
  export { default as GroupDeck } from './GroupDeck.js';
39
39
  export { default as YoutubeGroup } from './YoutubeGroup.js';
40
- import { Spinner as Spinner$1, Container as Container$1, Row as Row$1, Col as Col$1, Carousel, Table, Figure as Figure$1, Button as Button$1, ProgressBar, Card as Card$1, Form } from 'react-bootstrap';
40
+ import { Container, Media as Media$1, Spinner as Spinner$1, Row as Row$1, Col as Col$1, Carousel, Table, Figure as Figure$1, Button as Button$1, ProgressBar, Card as Card$1, Form } from 'react-bootstrap';
41
41
  export { default as QueueDeckExpanded } from './QueueDeckExpanded.js';
42
42
  import { I as IoMdArrowDropdown } from './index.esm-536609db.js';
43
43
  export { default as VideoSeriesListing } from './VideoSeriesListing.js';
@@ -48,8 +48,8 @@ export { default as IssueDeck } from './IssueDeck.js';
48
48
  import 'react-bootstrap/Badge';
49
49
  export { default as IssueContentDeck } from './IssueContentDeck.js';
50
50
  import Spinner from 'react-bootstrap/Spinner';
51
- import { M as MdPictureAsPdf } from './Normal-fd393897.js';
52
- export { A as AD728x90, C as Column1, a as Column2, b as Column3, f as HamMagazine, H as Header, L as LeftNav, e as NavDvm, c as NavMagazine, N as NavNative, d as NavNormal, P as PageFilter, S as Search, g as SideFooter, T as TemplateNormal } from './Normal-fd393897.js';
51
+ import { M as MdPictureAsPdf } from './Normal-13c85a50.js';
52
+ export { A as AD728x90, C as Column1, a as Column2, b as Column3, f as HamMagazine, H as Header, L as LeftNav, e as NavDvm, c as NavMagazine, N as NavNative, d as NavNormal, P as PageFilter, S as Search, g as SideFooter, T as TemplateNormal } from './Normal-13c85a50.js';
53
53
  import 'react-bootstrap/ListGroup';
54
54
  import Head from 'next/head';
55
55
  import Accordion from 'react-bootstrap/Accordion';
@@ -72,6 +72,632 @@ import useSWR from 'swr';
72
72
  import Local from 'passport-local';
73
73
  import mysql from 'mysql';
74
74
 
75
+ var urlFor$1 = function urlFor(source, builder) {
76
+ return builder.image(source).auto('format');
77
+ };
78
+
79
+ var renderCardImage = function renderCardImage(row, builder, imageHeight, imageWidth) {
80
+ var url = urlFor$1(row.thumbnail, builder);
81
+ if (imageHeight) url = url.height(imageHeight);
82
+ if (imageWidth) url = url.width(imageWidth);
83
+ return url.url();
84
+ };
85
+
86
+ var loadMore = function loadMore(values, setValues, per) {
87
+ setValues({
88
+ page: values.page + 1,
89
+ from: values.from + per,
90
+ to: values.to + per
91
+ });
92
+ };
93
+
94
+ var loadData = function loadData(values, query, client, params, setData, setScrolling, pointer, pointerArray) {
95
+ params = _extends$2({}, params, {
96
+ from: values.from,
97
+ to: values.to
98
+ });
99
+
100
+ client.fetch(query, params).then(function (dataArr) {
101
+ if (pointer && pointerArray) {
102
+ dataArr = dataArr[pointerArray][pointer];
103
+ }
104
+
105
+ if (!dataArr) {
106
+ dataArr = [];
107
+ }
108
+
109
+ dataArr = dataArr.map(function (item) {
110
+ return _extends$2({}, item, {
111
+ pageNumber: values.page
112
+ });
113
+ });
114
+
115
+ if (dataArr.length > 0) {
116
+ setData(function (prevData) {
117
+ return [].concat(_toConsumableArray(prevData), _toConsumableArray(dataArr));
118
+ });
119
+ setScrolling(true);
120
+ } else {
121
+ setScrolling(false);
122
+ }
123
+ });
124
+ };
125
+
126
+ var changePageNumber = function changePageNumber(pageNumber, seoPaginate, pageview, router, currentPage, setCurrentPage, itemsPerPage, itemIndex) {
127
+ if (seoPaginate) {
128
+ var path = router.asPath;
129
+ var qrIndex = path.indexOf('?');
130
+ var pathname = router.pathname;
131
+ var queryString = '';
132
+
133
+ if (qrIndex > 0) {
134
+ path = path.substring(1, qrIndex);
135
+
136
+ var partialQS = router.asPath.substring(qrIndex + 1);
137
+ var partialQSArr = partialQS.split('&');
138
+
139
+ // exclude page=xxx from query string
140
+ partialQSArr.map(function (item) {
141
+ var itemArr = item.split('=');
142
+ var key = itemArr[0];
143
+ var val = itemArr[1];
144
+
145
+ if (key !== 'page') {
146
+ queryString += (queryString.length === 0 ? '' : '&') + key + '=' + val;
147
+ }
148
+ });
149
+ }
150
+
151
+ if (queryString.length > 0) {
152
+ path += '?' + queryString;
153
+ }
154
+
155
+ // pageNumber = parseInt(pageNumber)
156
+
157
+ var index = Number(itemIndex);
158
+ var perPage = Number(itemsPerPage);
159
+
160
+ pageNumber = Math.ceil((index + 1) / perPage);
161
+
162
+ if (currentPage !== pageNumber) {
163
+ lib_3.refresh();
164
+
165
+ setCurrentPage(pageNumber);
166
+ if (path[0] !== '/') {
167
+ path = '/' + path;
168
+ }
169
+ var newPath = pageNumber === 1 ? '' + path : '' + path + (queryString.length > 0 ? '&' : '?') + 'page=' + pageNumber;
170
+
171
+ if (pageview) {
172
+ pageview(newPath);
173
+ }
174
+
175
+ router.push(pathname, newPath, {
176
+ shallow: true
177
+ });
178
+ }
179
+ }
180
+ };
181
+
182
+ var renderAuthor = function renderAuthor(authorDetail, index, length) {
183
+ if (authorDetail) {
184
+ var _id = authorDetail._id,
185
+ displayName = authorDetail.displayName,
186
+ url = authorDetail.url;
187
+
188
+ if (displayName && url && url.current) {
189
+ return React__default.createElement(
190
+ 'div',
191
+ { key: _id },
192
+ index === 0 && React__default.createElement(
193
+ 'span',
194
+ { className: 'pr-1' },
195
+ 'By'
196
+ ),
197
+ React__default.createElement(
198
+ 'a',
199
+ { href: '/authors/' + url.current, className: 'text-muted' },
200
+ displayName,
201
+ length !== index + 1 && React__default.createElement('br', null)
202
+ )
203
+ );
204
+ } else if (displayName) {
205
+ return React__default.createElement(
206
+ 'div',
207
+ { key: _id },
208
+ index === 0 && React__default.createElement(
209
+ 'span',
210
+ { className: 'pr-1' },
211
+ 'By'
212
+ ),
213
+ React__default.createElement(
214
+ 'span',
215
+ { className: 'text-muted' },
216
+ displayName,
217
+ length !== index + 1 && React__default.createElement('br', null)
218
+ )
219
+ );
220
+ }
221
+ } else return null;
222
+ };
223
+
224
+ var checkExternalUrl = function checkExternalUrl(url) {
225
+ return new RegExp(['http', 'https'].join('|')).test(url);
226
+ };
227
+
228
+ var cardLoader = function cardLoader(data, builder, mapping, values, seoPaginate, pageview, router, currentPage, setCurrentPage, showPublished, defaultImage, showAuthor, showCategory, imageHeight, imageWidth, rightItems, brandInsightAd, showBI, itemsPerPage) {
229
+ var numberOfItemsBeforeAd = 6;
230
+
231
+ var insertBrandInsightAd = function insertBrandInsightAd(arr, index, newElement) {
232
+ return [].concat(_toConsumableArray(arr.slice(0, index)), [newElement], _toConsumableArray(arr.slice(index)));
233
+ };
234
+ if (showBI && brandInsightAd) {
235
+ var pos = 0;
236
+ for (var i = 1; pos < data.length; i++) {
237
+ var inFeedAd = {
238
+ adUnit: brandInsightAd.adUnit,
239
+ className: brandInsightAd.className,
240
+ networkID: brandInsightAd.networkID,
241
+ sizes: brandInsightAd.sizes,
242
+ slotId: brandInsightAd.slotId + '_' + i,
243
+ targeting: {
244
+ pos: 'article' + i,
245
+ content_placement: brandInsightAd.targeting.content_placement,
246
+ document_url: brandInsightAd.targeting.document_url
247
+ },
248
+ _type: 'brandInsightAd'
249
+ };
250
+
251
+ data = insertBrandInsightAd(data, pos, inFeedAd);
252
+ pos += brandInsightAd.interval + 1;
253
+ }
254
+ }
255
+
256
+ return React__default.createElement(
257
+ 'div',
258
+ null,
259
+ data && data.length > 0 ? data.map(function (article, index) {
260
+ var pageNumber = article.pageNumber || values.page;
261
+
262
+ var contentCategoryName = article.contentCategory ? article.contentCategory.name : 'Articles';
263
+
264
+ if (article._type === 'feature') {
265
+ if (article.blank || checkExternalUrl(article.url.current)) {
266
+ return React__default.createElement(
267
+ React__default.Fragment,
268
+ { key: article._id ? article._id : index },
269
+ React__default.createElement(
270
+ VisibilitySensor,
271
+ {
272
+ key: article._id ? article._id : index,
273
+ partialVisibility: true,
274
+ onChange: function onChange(isVisible) {
275
+ isVisible && changePageNumber(1, seoPaginate, pageview, router, currentPage, setCurrentPage, itemsPerPage, parseInt(index));
276
+ } },
277
+ React__default.createElement(
278
+ React__default.Fragment,
279
+ null,
280
+ React__default.createElement(
281
+ Media$1,
282
+ {
283
+ key: article._id ? article._id : index,
284
+ className: 'feature-media',
285
+ style: { flexDirection: 'column', marginBottom: '1.25rem', paddingBottom: '1.25rem', borderBottom: '1px solid #ddd' } },
286
+ (article.thumbnail && article.thumbnail.asset || defaultImage) && React__default.createElement(
287
+ 'a',
288
+ { href: article.url.current, target: '_blank', className: 'feature-wrapper' },
289
+ React__default.createElement(
290
+ LazyLoad,
291
+ { height: imageHeight },
292
+ article.thumbnail && article.thumbnail.asset ? React__default.createElement('img', { className: 'img-fluid', src: renderCardImage(article, builder, imageHeight, imageWidth), alt: article.title }) : article.thumbnail ? React__default.createElement('img', { src: article.thumbnail, className: 'mr-3', alt: article.title }) : React__default.createElement('img', { src: defaultImage, src2: article.thumbnail, className: 'mr-3', width: '240', height: '135', alt: article.title })
293
+ )
294
+ ),
295
+ React__default.createElement(
296
+ Media$1.Body,
297
+ null,
298
+ React__default.createElement(
299
+ 'a',
300
+ { href: article.url.current, target: '_blank' },
301
+ article.title && React__default.createElement(
302
+ 'h4',
303
+ { className: 'card-title', style: { fontWeight: '500', color: 'var(--gray-dark)', marginBottom: '.5rem' } },
304
+ article.title
305
+ )
306
+ ),
307
+ showPublished && article.published && React__default.createElement(
308
+ 'p',
309
+ { className: 'card-text', style: { color: 'var(--dark)', marginBottom: '.25rem' } },
310
+ moment(article.published).format('MMMM DD, YYYY')
311
+ ),
312
+ showAuthor && article.authorMapping && article.authorMapping.length > 0 && article.authorMapping.map(function (authorDetail, index) {
313
+ return renderAuthor(authorDetail, index, article.authorMapping.length);
314
+ }),
315
+ article.source && React__default.createElement(
316
+ 'p',
317
+ { className: 'p-0 mb-1' },
318
+ article.source
319
+ ),
320
+ showCategory && article.contentCategory && React__default.createElement(
321
+ 'p',
322
+ {
323
+ className: 'article-category',
324
+ style: {
325
+ background: '#3FB618',
326
+ color: '#ffffff',
327
+ marginBottom: '.25rem',
328
+ display: 'inline-block',
329
+ padding: '0 .25rem',
330
+ fontSize: '.8rem'
331
+ } },
332
+ article.contentCategory.name.slice(0, article.contentCategory.name.length - 1)
333
+ ),
334
+ article.summary && React__default.createElement(
335
+ 'p',
336
+ { className: 'pt-2 card-text' },
337
+ clean_html_1(article.summary)
338
+ )
339
+ )
340
+ )
341
+ )
342
+ ),
343
+ main_39 && rightItems && (index + 1) % numberOfItemsBeforeAd === 0 && renderMobileAd(index, numberOfItemsBeforeAd, rightItems)
344
+ );
345
+ } else {
346
+ return React__default.createElement(
347
+ React__default.Fragment,
348
+ { key: article._id ? article._id : index },
349
+ React__default.createElement(
350
+ VisibilitySensor,
351
+ {
352
+ key: article._id ? article._id : index,
353
+ partialVisibility: true,
354
+ onChange: function onChange(isVisible) {
355
+ isVisible && changePageNumber(1, seoPaginate, pageview, router, currentPage, setCurrentPage, itemsPerPage, parseInt(index));
356
+ } },
357
+ React__default.createElement(
358
+ React__default.Fragment,
359
+ null,
360
+ React__default.createElement(
361
+ Media$1,
362
+ {
363
+ key: article._id ? article._id : index,
364
+ className: 'feature-media',
365
+ style: { flexDirection: 'column', marginBottom: '1.25rem', paddingBottom: '1.25rem', borderBottom: '1px solid #ddd' } },
366
+ (article.thumbnail && article.thumbnail.asset || defaultImage) && React__default.createElement(
367
+ 'a',
368
+ { href: article.url.current, className: 'feature-wrapper' },
369
+ React__default.createElement(
370
+ LazyLoad,
371
+ { height: imageHeight },
372
+ article.thumbnail && article.thumbnail.asset ? React__default.createElement('img', { className: 'img-fluid', src: renderCardImage(article, builder, imageHeight, imageWidth), alt: article.title }) : article.thumbnail ? React__default.createElement('img', { src: article.thumbnail, className: 'mr-3', alt: article.title }) : React__default.createElement('img', { src: defaultImage, src2: article.thumbnail, className: 'mr-3', width: '240', height: '135', alt: article.title })
373
+ )
374
+ ),
375
+ React__default.createElement(
376
+ Media$1.Body,
377
+ null,
378
+ React__default.createElement(
379
+ 'a',
380
+ { href: article.url.current },
381
+ article.title && React__default.createElement(
382
+ 'h4',
383
+ { className: 'card-title', style: { fontWeight: '500', color: 'var(--gray-dark)', marginBottom: '.5rem' } },
384
+ article.title
385
+ )
386
+ ),
387
+ showPublished && article.published && React__default.createElement(
388
+ 'p',
389
+ { className: 'card-text', style: { color: 'var(--dark)', marginBottom: '.25rem' } },
390
+ moment(article.published).format('MMMM DD, YYYY')
391
+ ),
392
+ showAuthor && article.authorMapping && article.authorMapping.length > 0 && article.authorMapping.map(function (authorDetail, index) {
393
+ return renderAuthor(authorDetail, index, article.authorMapping.length);
394
+ }),
395
+ article.source && React__default.createElement(
396
+ 'p',
397
+ { className: 'p-0 mb-1' },
398
+ article.source
399
+ ),
400
+ showCategory && article.contentCategory && React__default.createElement(
401
+ 'p',
402
+ {
403
+ style: {
404
+ background: '#3FB618',
405
+ color: '#ffffff',
406
+ marginBottom: '.25rem',
407
+ display: 'inline-block',
408
+ padding: '0 .25rem',
409
+ fontSize: '.8rem'
410
+ } },
411
+ article.contentCategory.name.slice(0, article.contentCategory.name.length - 1)
412
+ ),
413
+ article.summary && React__default.createElement(
414
+ 'p',
415
+ { className: 'pt-2 card-text' },
416
+ clean_html_1(article.summary)
417
+ )
418
+ )
419
+ )
420
+ )
421
+ ),
422
+ main_39 && rightItems && (index + 1) % numberOfItemsBeforeAd === 0 && renderMobileAd(index, numberOfItemsBeforeAd, rightItems)
423
+ );
424
+ }
425
+ } else if (article._type === 'brandInsightAd' && article.adUnit) {
426
+ return React__default.createElement(ADInfeed, { index: index, infeedAd: article });
427
+ }
428
+
429
+ return React__default.createElement(
430
+ React__default.Fragment,
431
+ { key: article._id ? article._id : index },
432
+ React__default.createElement(
433
+ VisibilitySensor,
434
+ {
435
+ key: article._id ? article._id : index,
436
+ onChange: function onChange(isVisible) {
437
+ isVisible && changePageNumber(pageNumber, seoPaginate, pageview, router, currentPage, setCurrentPage, itemsPerPage, parseInt(index));
438
+ } },
439
+ React__default.createElement(
440
+ React__default.Fragment,
441
+ null,
442
+ React__default.createElement(
443
+ Media$1,
444
+ {
445
+ key: article._id ? article._id : index,
446
+ style: { flexDirection: 'row', marginBottom: '1.25rem', paddingBottom: '1.25rem', borderBottom: '1px solid #ddd' } },
447
+ (article.thumbnail && article.thumbnail.asset || defaultImage) && React__default.createElement(
448
+ 'a',
449
+ { href: mapping[contentCategoryName] + '/' + article.url.current, className: 'img-wrapper' },
450
+ React__default.createElement(
451
+ LazyLoad,
452
+ { height: imageHeight },
453
+ article.thumbnail && article.thumbnail.asset ? React__default.createElement('img', { className: 'mr-3 img-fluid', src: renderCardImage(article, builder, imageHeight, imageWidth), alt: article.title }) : article.thumbnail ? React__default.createElement('img', { src: article.thumbnail, className: 'mr-3', alt: article.title }) : React__default.createElement('img', { src: defaultImage, src2: article.thumbnail, className: 'mr-3', width: '240', height: '135', alt: article.title })
454
+ )
455
+ ),
456
+ React__default.createElement(
457
+ Media$1.Body,
458
+ null,
459
+ React__default.createElement(
460
+ 'a',
461
+ { href: mapping[contentCategoryName] + '/' + article.url.current },
462
+ article.title && React__default.createElement(
463
+ 'h4',
464
+ { className: 'card-title', style: { fontWeight: '500', color: 'var(--gray-dark)', marginBottom: '.5rem' } },
465
+ article.title
466
+ )
467
+ ),
468
+ showPublished && article.published && React__default.createElement(
469
+ 'p',
470
+ { className: 'card-text', style: { color: 'var(--dark)', marginBottom: '.25rem' } },
471
+ moment(article.published).format('MMMM DD, YYYY')
472
+ ),
473
+ showAuthor && article.authorMapping && article.authorMapping.length > 0 && article.authorMapping.map(function (authorDetail, index) {
474
+ return renderAuthor(authorDetail, index, article.authorMapping.length);
475
+ }),
476
+ article.source && React__default.createElement(
477
+ 'p',
478
+ { className: 'p-0 mb-1' },
479
+ article.source
480
+ ),
481
+ showCategory && article.contentCategory && React__default.createElement(
482
+ 'p',
483
+ {
484
+ style: {
485
+ background: '#3FB618',
486
+ color: '#ffffff',
487
+ marginBottom: '.25rem',
488
+ display: 'inline-block',
489
+ padding: '0 .25rem',
490
+ fontSize: '.8rem'
491
+ } },
492
+ article.contentCategory.name.slice(0, article.contentCategory.name.length - 1)
493
+ ),
494
+ article.summary && React__default.createElement(
495
+ 'p',
496
+ { className: 'pt-2 card-text' },
497
+ clean_html_1(article.summary)
498
+ )
499
+ )
500
+ )
501
+ )
502
+ ),
503
+ main_39 && rightItems && (index + 1) % numberOfItemsBeforeAd === 0 && renderMobileAd(index, numberOfItemsBeforeAd, rightItems)
504
+ );
505
+ }) : React__default.createElement(
506
+ 'div',
507
+ null,
508
+ React__default.createElement(
509
+ 'h5',
510
+ null,
511
+ React__default.createElement(
512
+ 'em',
513
+ null,
514
+ 'New content coming soon, please check back later.'
515
+ )
516
+ )
517
+ ),
518
+ React__default.createElement(
519
+ 'style',
520
+ { jsx: 'true' },
521
+ '\n .feature-media > .media-body {\n -webkit-box-flex: none;\n -ms-flex: none;\n flex: none;\n }\n .img-wrapper img {\n max-height: 240px;\n height: auto;\n width: 100%;\n object-fit: contain;\n }\n .feature-wrapper {\n height: 100%;\n width: 100%;\n }\n .feature-wrapper img {\n width: 100%;\n margin-bottom: 1em;\n }\n @media only screen and (min-width: 768px) {\n .img-wrapper > img {\n padding-right: 1em;\n }\n }\n @media only screen and (max-width: 767px) {\n .img-wrapper {\n width: 100%;\n }\n .img-wrapper img {\n padding-bottom: 1em;\n }\n .media {\n flex-direction: column !important;\n }\n }\n '
522
+ )
523
+ );
524
+ };
525
+
526
+ var renderMobileAd = function renderMobileAd(index, numberOfItemsBeforeAd, rightItems) {
527
+ var i = ((index + 1) / numberOfItemsBeforeAd - 1) % rightItems.length;
528
+ return React__default.createElement(
529
+ 'div',
530
+ { style: { display: 'flex', flex: '1 0 auto' } },
531
+ rightItems[i].component
532
+ );
533
+ };
534
+
535
+ var renderManualPagination = function renderManualPagination(currentPage) {
536
+ return React__default.createElement(
537
+ 'div',
538
+ { className: 'd-flex justify-content-between' },
539
+ currentPage && currentPage > 1 && React__default.createElement(
540
+ 'a',
541
+ { href: '?page=' + (currentPage - 1) },
542
+ '<< Previous'
543
+ ),
544
+ React__default.createElement(
545
+ 'a',
546
+ { href: '?page=' + (currentPage + 1) },
547
+ 'Next >>'
548
+ )
549
+ );
550
+ };
551
+
552
+ var usePrevious = function usePrevious(value) {
553
+ var ref = useRef();
554
+ useEffect(function () {
555
+ ref.current = value;
556
+ });
557
+ return ref.current;
558
+ };
559
+
560
+ var InfiniteScrollDeck = function InfiniteScrollDeck(props) {
561
+ var router = useRouter();
562
+ var initialData = props.dataRecord,
563
+ client = props.client,
564
+ params = props.params,
565
+ query = props.query,
566
+ autoScroll = props.autoScroll,
567
+ pointer = props.pointer,
568
+ pointerArray = props.pointerArray,
569
+ mapping = props.mapping,
570
+ seoPaginate = props.seoPaginate,
571
+ pageview = props.pageview,
572
+ defaultImage = props.defaultImage,
573
+ showAuthor = props.showAuthor,
574
+ showCategory = props.showCategory,
575
+ imageHeight = props.imageHeight,
576
+ imageWidth = props.imageWidth,
577
+ rightItems = props.rightItems,
578
+ brandInsightAd = props.brandInsightAd,
579
+ _props$showBI = props.showBI,
580
+ showBI = _props$showBI === undefined ? false : _props$showBI;
581
+ var initialCurrentPage = props.currentPage,
582
+ showPublished = props.showPublished;
583
+
584
+ var builder = imageUrlBuilder(client);
585
+
586
+ var _useState = useState(initialData),
587
+ _useState2 = _slicedToArray(_useState, 2),
588
+ data = _useState2[0],
589
+ setData = _useState2[1];
590
+
591
+ var _useState3 = useState(true),
592
+ _useState4 = _slicedToArray(_useState3, 2),
593
+ scrolling = _useState4[0],
594
+ setScrolling = _useState4[1];
595
+
596
+ var _useState5 = useState(params ? params.to : 0),
597
+ _useState6 = _slicedToArray(_useState5, 1),
598
+ per = _useState6[0];
599
+
600
+ var _useState7 = useState(initialCurrentPage || 1),
601
+ _useState8 = _slicedToArray(_useState7, 2),
602
+ currentPage = _useState8[0],
603
+ setCurrentPage = _useState8[1];
604
+
605
+ var _useState9 = useState({
606
+ from: params ? params.from : 0,
607
+ to: params ? params.to : 0,
608
+ page: 1
609
+ }),
610
+ _useState10 = _slicedToArray(_useState9, 2),
611
+ values = _useState10[0],
612
+ setValues = _useState10[1];
613
+
614
+ var itemsPerPage = params.itemsPerPage;
615
+
616
+ var prevValues = usePrevious(values);
617
+
618
+ useEffect(function () {
619
+ if (prevValues) {
620
+ if (values.page !== prevValues.page && values.from !== prevValues.from && values.to !== prevValues.from) {
621
+ loadData(values, query, client, params, setData, setScrolling, pointer, pointerArray);
622
+ }
623
+ }
624
+ }, [values, prevValues, query, client, params, setData, setScrolling, pointer, pointerArray]);
625
+
626
+ useEffect(function () {
627
+ document.addEventListener('scroll', trackScrolling);
628
+ return function () {
629
+ document.removeEventListener('scroll', trackScrolling);
630
+ };
631
+ }, [currentPage]);
632
+
633
+ var trackScrolling = function trackScrolling(current) {
634
+ if (window.pageYOffset === 0) {
635
+ if (currentPage > 1) {
636
+ changePageNumber(1, seoPaginate, pageview, router, currentPage, setCurrentPage, itemsPerPage, 1);
637
+ }
638
+ }
639
+ };
640
+
641
+ return React__default.createElement(
642
+ 'div',
643
+ null,
644
+ autoScroll ? React__default.createElement(
645
+ React__default.Fragment,
646
+ null,
647
+ React__default.createElement(
648
+ InfiniteScroll,
649
+ { dataLength: data && data.length, next: function next() {
650
+ return loadMore(values, setValues, per);
651
+ }, hasMore: scrolling, scrollThreshold: 0.9 },
652
+ React__default.createElement(
653
+ Container,
654
+ null,
655
+ cardLoader(data, builder, mapping, values, seoPaginate, pageview, router, currentPage, setCurrentPage, showPublished, defaultImage, showAuthor, showCategory, imageHeight, imageWidth, rightItems, brandInsightAd, showBI, itemsPerPage)
656
+ )
657
+ ),
658
+ React__default.createElement(
659
+ 'noscript',
660
+ null,
661
+ renderManualPagination(currentPage)
662
+ )
663
+ ) : React__default.createElement(
664
+ React__default.Fragment,
665
+ null,
666
+ React__default.createElement(
667
+ Container,
668
+ null,
669
+ cardLoader(data, builder, mapping, values, seoPaginate, pageview, router, currentPage, setCurrentPage, showPublished, defaultImage, showAuthor, showCategory, rightItems, brandInsightAd, showBI, itemsPerPage)
670
+ ),
671
+ React__default.createElement(
672
+ 'div',
673
+ { style: { padding: '0px 10px' } },
674
+ scrolling ? React__default.createElement(
675
+ 'button',
676
+ {
677
+ style: { margin: 'auto', width: '100%' },
678
+ onClick: function onClick(e) {
679
+ loadMore(values, setValues, per);
680
+ } },
681
+ 'Load More'
682
+ ) : React__default.createElement(
683
+ 'p',
684
+ { style: { textAlign: 'center' } },
685
+ React__default.createElement(
686
+ 'b',
687
+ null,
688
+ 'End of data'
689
+ )
690
+ )
691
+ ),
692
+ React__default.createElement(
693
+ 'noscript',
694
+ null,
695
+ renderManualPagination(currentPage)
696
+ )
697
+ )
698
+ );
699
+ };
700
+
75
701
  var momentTimezone = createCommonjsModule(function (module) {
76
702
  //! moment-timezone.js
77
703
  //! version : 0.5.31
@@ -1623,12 +2249,12 @@ var latest = {
1623
2249
  };
1624
2250
 
1625
2251
  var latest$1 = /*#__PURE__*/Object.freeze({
1626
- __proto__: null,
1627
- version: version,
1628
- zones: zones,
1629
- links: links,
1630
- countries: countries,
1631
- 'default': latest
2252
+ __proto__: null,
2253
+ version: version,
2254
+ zones: zones,
2255
+ links: links,
2256
+ countries: countries,
2257
+ 'default': latest
1632
2258
  });
1633
2259
 
1634
2260
  var require$$1 = getCjsExportFromNamespace(latest$1);
@@ -1953,7 +2579,7 @@ var EventsDeck = function EventsDeck(_ref) {
1953
2579
  var numberOfItemsBeforeAd = 5;
1954
2580
 
1955
2581
  return React__default.createElement(
1956
- Container,
2582
+ Container$1,
1957
2583
  { style: { padding: 1 } },
1958
2584
  data && data.map(function (row, index) {
1959
2585
  var speakerInfo = [];
@@ -2504,7 +3130,7 @@ var CMEDeck = function CMEDeck(_ref) {
2504
3130
  )
2505
3131
  ) },
2506
3132
  React__default.createElement(
2507
- Container$1,
3133
+ Container,
2508
3134
  null,
2509
3135
  cardLoader()
2510
3136
  )
@@ -2518,7 +3144,7 @@ var CMEDeck = function CMEDeck(_ref) {
2518
3144
  React__default.Fragment,
2519
3145
  null,
2520
3146
  React__default.createElement(
2521
- Container$1,
3147
+ Container,
2522
3148
  null,
2523
3149
  cardLoader()
2524
3150
  ),
@@ -3159,7 +3785,7 @@ var ADSponsoredResources = function ADSponsoredResources(_ref) {
3159
3785
  } else return null;
3160
3786
  };
3161
3787
 
3162
- var urlFor$1 = function urlFor(source, builder) {
3788
+ var urlFor$2 = function urlFor(source, builder) {
3163
3789
  return builder.image(source).auto('format');
3164
3790
  };
3165
3791
 
@@ -3210,7 +3836,7 @@ var Slideshow = function Slideshow(_ref) {
3210
3836
  return React__default.createElement(
3211
3837
  Carousel.Item,
3212
3838
  { key: slide._key },
3213
- React__default.createElement('img', { src: slide.asset && urlFor$1(slide.asset, builder).url(), alt: slide.alt && slide.alt, style: { width: '100%' } }),
3839
+ React__default.createElement('img', { src: slide.asset && urlFor$2(slide.asset, builder).url(), alt: slide.alt && slide.alt, style: { width: '100%' } }),
3214
3840
  slide.caption && React__default.createElement(
3215
3841
  'p',
3216
3842
  { className: 'p-2' },
@@ -13519,7 +14145,7 @@ var Leads = function Leads(_ref) {
13519
14145
  );
13520
14146
  };
13521
14147
 
13522
- var urlFor$2 = function urlFor(source, client) {
14148
+ var urlFor$3 = function urlFor(source, client) {
13523
14149
  var builder = imageUrlBuilder(client);
13524
14150
  return builder.image(source).auto('format');
13525
14151
  };
@@ -13576,7 +14202,7 @@ var Slideshow$1 = function Slideshow(_ref) {
13576
14202
  React__default.createElement(
13577
14203
  LazyLoad,
13578
14204
  null,
13579
- React__default.createElement('img', { src: urlFor$2(slide.slideshowImage, client).url(), alt: slide.slideshowImage.alt || 'slideshow image', style: { width: '100%' } })
14205
+ React__default.createElement('img', { src: urlFor$3(slide.slideshowImage, client).url(), alt: slide.slideshowImage.alt || 'slideshow image', style: { width: '100%' } })
13580
14206
  )
13581
14207
  ),
13582
14208
  React__default.createElement(
@@ -14010,13 +14636,13 @@ var SetCookie = function SetCookie(key, value) {
14010
14636
  js_cookie.set(key, value, { expires: 1, sameSite: 'none', secure: true });
14011
14637
  };
14012
14638
 
14013
- var urlFor$3 = function urlFor(source, client) {
14639
+ var urlFor$4 = function urlFor(source, client) {
14014
14640
  var builder = imageUrlBuilder(client);
14015
14641
  return builder.image(source).auto('format');
14016
14642
  };
14017
14643
 
14018
- var renderCardImage = function renderCardImage(thumbnail, client, imageHeight, imageWidth) {
14019
- var url = urlFor$3(thumbnail, client);
14644
+ var renderCardImage$1 = function renderCardImage(thumbnail, client, imageHeight, imageWidth) {
14645
+ var url = urlFor$4(thumbnail, client);
14020
14646
  if (imageHeight) url = url.height(imageHeight);
14021
14647
  if (imageWidth) url = url.width(imageWidth);
14022
14648
  return url.url();
@@ -14043,7 +14669,7 @@ var Hero = function Hero(_ref) {
14043
14669
  { className: 'h4' },
14044
14670
  title
14045
14671
  ),
14046
- thumbnail && client && React__default.createElement(Card$1.Img, { src: renderCardImage(thumbnail, client, imageHeight, imageWidth) }),
14672
+ thumbnail && client && React__default.createElement(Card$1.Img, { src: renderCardImage$1(thumbnail, client, imageHeight, imageWidth) }),
14047
14673
  summary && React__default.createElement(
14048
14674
  Card$1.Footer,
14049
14675
  { className: 'h6' },
@@ -16214,7 +16840,7 @@ var InscreenSensor = function (_React$Component) {
16214
16840
  return InscreenSensor;
16215
16841
  }(React__default.Component);
16216
16842
 
16217
- var renderAuthor = function renderAuthor(authorName, authorURL, index, length) {
16843
+ var renderAuthor$1 = function renderAuthor(authorName, authorURL, index, length) {
16218
16844
  if (authorName && authorURL) {
16219
16845
  return React__default.createElement(
16220
16846
  'a',
@@ -16516,7 +17142,7 @@ var Article = function Article(props) {
16516
17142
  return React__default.createElement(
16517
17143
  'div',
16518
17144
  { key: index },
16519
- renderAuthor(authorDetail.displayName, authorDetail.url, index, authorDetails.length)
17145
+ renderAuthor$1(authorDetail.displayName, authorDetail.url, index, authorDetails.length)
16520
17146
  );
16521
17147
  }),
16522
17148
  React__default.createElement(
@@ -17091,8 +17717,8 @@ function useUser() {
17091
17717
  }
17092
17718
 
17093
17719
  var hooks = /*#__PURE__*/Object.freeze({
17094
- __proto__: null,
17095
- useUser: useUser
17720
+ __proto__: null,
17721
+ useUser: useUser
17096
17722
  });
17097
17723
 
17098
17724
  var LoginForm = function LoginForm(props) {
@@ -18314,11 +18940,11 @@ function getTokenCookie(req) {
18314
18940
  }
18315
18941
 
18316
18942
  var authCookies = /*#__PURE__*/Object.freeze({
18317
- __proto__: null,
18318
- setTokenCookie: setTokenCookie,
18319
- removeTokenCookie: removeTokenCookie,
18320
- parseCookies: parseCookies,
18321
- getTokenCookie: getTokenCookie
18943
+ __proto__: null,
18944
+ setTokenCookie: setTokenCookie,
18945
+ removeTokenCookie: removeTokenCookie,
18946
+ parseCookies: parseCookies,
18947
+ getTokenCookie: getTokenCookie
18322
18948
  });
18323
18949
 
18324
18950
  function encryptSession(session) {
@@ -18362,9 +18988,9 @@ var getSession = function () {
18362
18988
  }();
18363
18989
 
18364
18990
  var iron = /*#__PURE__*/Object.freeze({
18365
- __proto__: null,
18366
- encryptSession: encryptSession,
18367
- getSession: getSession
18991
+ __proto__: null,
18992
+ encryptSession: encryptSession,
18993
+ getSession: getSession
18368
18994
  });
18369
18995
 
18370
18996
  var toStr = Object.prototype.toString;
@@ -20619,10 +21245,10 @@ var findUser$1 = function () {
20619
21245
  }();
20620
21246
 
20621
21247
  var user = /*#__PURE__*/Object.freeze({
20622
- __proto__: null,
20623
- createUser: createUser$1,
20624
- updateUser: updateUser$1,
20625
- findUser: findUser$1
21248
+ __proto__: null,
21249
+ createUser: createUser$1,
21250
+ updateUser: updateUser$1,
21251
+ findUser: findUser$1
20626
21252
  });
20627
21253
 
20628
21254
  var localStrategy = new Local.Strategy({
@@ -20638,8 +21264,8 @@ var localStrategy = new Local.Strategy({
20638
21264
  });
20639
21265
 
20640
21266
  var passportLocal = /*#__PURE__*/Object.freeze({
20641
- __proto__: null,
20642
- localStrategy: localStrategy
21267
+ __proto__: null,
21268
+ localStrategy: localStrategy
20643
21269
  });
20644
21270
 
20645
21271
  var _this$4 = undefined;
@@ -20831,4 +21457,4 @@ var auth = {
20831
21457
  ProcessData: ProcessData_1
20832
21458
  };
20833
21459
 
20834
- export { AD300x250, AD300x250x600, ADFloatingFooter, ADFooter, ADGutter, ADSponsoredResources, ADWelcome, AccordionPanel, AdSlotsProvider, AlphabeticList, ArticleDetailDropdown, ArticleQueue, auth as Auth, Breadcrumbs$1 as Breadcrumbs, CMEDeck, ConferenceArticleCard, EventsDeck, Feature, fbsHero as ForbesHero, GridHero, Hero, HighlightenVideo, HorizontalHero, KMTracker, OncliveHero, OncliveLargeHero, PdfDownload, RelatedContent, RelatedTopicsDropdown, SetCookie, SocialShare$1 as SocialShare, VerticalHero, YahooHero, getSerializers };
21460
+ export { AD300x250, AD300x250x600, ADFloatingFooter, ADFooter, ADGutter, ADSponsoredResources, ADWelcome, AccordionPanel, AdSlotsProvider, AlphabeticList, ArticleDetailDropdown, ArticleQueue, auth as Auth, Breadcrumbs$1 as Breadcrumbs, CMEDeck, ConferenceArticleCard, EventsDeck, Feature, fbsHero as ForbesHero, GridHero, Hero, HighlightenVideo, HorizontalHero, InfiniteScrollDeck, KMTracker, OncliveHero, OncliveLargeHero, PdfDownload, RelatedContent, RelatedTopicsDropdown, SetCookie, SocialShare$1 as SocialShare, VerticalHero, YahooHero, getSerializers };