@mjhls/mjh-framework 1.0.404 → 1.0.406

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
@@ -9,9 +9,9 @@ import { _ as _extends$2, a as _Object$assign } from './extends-92072fff.js';
9
9
  import { _ as _objectSap, a as _inherits$1, b as _classCallCheck$1, c as _possibleConstructorReturn$1, d as _Object$getPrototypeOf, e as _createClass$1, f as defineProperty$2 } from './inherits-dfba24f5.js';
10
10
  import { _ as _meta, a as _isArray } from './typeof-e4b50250.js';
11
11
  import React__default, { useState, useEffect, useRef } from 'react';
12
- 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-df468b0e.js';
12
+ 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-df468b0e.js';
13
13
  import PropTypes from 'prop-types';
14
- import Container$1 from 'react-bootstrap/Container';
14
+ import Container from 'react-bootstrap/Container';
15
15
  import Row from 'react-bootstrap/Row';
16
16
  import Col from 'react-bootstrap/Col';
17
17
  import Card from 'react-bootstrap/Card';
@@ -23,15 +23,15 @@ import { V as VisibilitySensor } from './visibility-sensor-0baa4eea.js';
23
23
  import { i as imageUrlBuilder } from './index-51a80699.js';
24
24
  import { L as LazyLoad } from './index-5f9f807a.js';
25
25
  import { m as main_39, a as main_16, b as main_38 } from './main-7d1b3c98.js';
26
- import { c as clean_html_1, h as html_decode_1 } from './entities-7cc3bf45.js';
26
+ import { h as html_decode_1, c as clean_html_1 } from './entities-7cc3bf45.js';
27
27
  import { _ as _slicedToArray, a as _getIterator } from './slicedToArray-04e02710.js';
28
28
  import { _ as _JSON$stringify, a as _asyncToGenerator, r as regenerator, D as DFPAdSlot, B as Beam } from './AdSlot-78e48a2c.js';
29
29
  export { D as AdSlot, B as Beam } from './AdSlot-78e48a2c.js';
30
30
  import { _ as _anInstance, a as _forOf, b as _redefineAll, c as _setSpecies } from './promise-2592a80a.js';
31
- import { A as ADInfeed } from './ADInfeed-e5cefea5.js';
31
+ import './ADInfeed-e5cefea5.js';
32
32
  export { default as DeckContent } from './DeckContent.js';
33
33
  import { i as isFunction_1, a as isArray_1, _ as _arrayMap } from './get-53653403.js';
34
- export { A as AD, G as GridContent } from './GridContent-cafb2fe4.js';
34
+ export { A as AD, G as GridContent } from './GridContent-2cabe342.js';
35
35
  import { A as AuthorComponent } from './AuthorComponent-c9e46673.js';
36
36
  export { default as DeckQueue } from './DeckQueue.js';
37
37
  import 'react-bootstrap/Media';
@@ -43,7 +43,7 @@ import { g as getYoutubeId } from './smoothscroll-4b699764.js';
43
43
  import GroupDeck from './GroupDeck.js';
44
44
  export { default as GroupDeck } from './GroupDeck.js';
45
45
  export { default as YoutubeGroup } from './YoutubeGroup.js';
46
- 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';
46
+ 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';
47
47
  export { default as QueueDeckExpanded } from './QueueDeckExpanded.js';
48
48
  import { I as IoMdArrowDropdown } from './index.esm-536609db.js';
49
49
  export { default as VideoSeriesListing } from './VideoSeriesListing.js';
@@ -79,639 +79,6 @@ import useSWR from 'swr';
79
79
  import Local from 'passport-local';
80
80
  import mysql from 'mysql';
81
81
 
82
- var urlFor$1 = function urlFor(source, builder) {
83
- return builder.image(source).auto('format');
84
- };
85
-
86
- var renderCardImage = function renderCardImage(row, builder, imageHeight, imageWidth) {
87
- var url = urlFor$1(row.thumbnail, builder);
88
- if (imageHeight) url = url.height(imageHeight);
89
- if (imageWidth) url = url.width(imageWidth);
90
- return url.url();
91
- };
92
-
93
- var loadMore = function loadMore(values, setValues, per) {
94
- setValues({
95
- page: values.page + 1,
96
- from: values.from + per,
97
- to: values.to + per
98
- });
99
- };
100
-
101
- var loadData = function loadData(values, query, client, params, setData, setScrolling, pointer, pointerArray) {
102
- params = _extends$2({}, params, {
103
- from: values.from,
104
- to: values.to
105
- });
106
-
107
- client.fetch(query, params).then(function (dataArr) {
108
- if (pointer && pointerArray) {
109
- dataArr = dataArr[pointerArray][pointer];
110
- }
111
-
112
- if (!dataArr) {
113
- dataArr = [];
114
- }
115
-
116
- dataArr = dataArr.map(function (item) {
117
- return _extends$2({}, item, {
118
- pageNumber: values.page
119
- });
120
- });
121
-
122
- if (dataArr.length > 0) {
123
- setData(function (prevData) {
124
- return [].concat(_toConsumableArray(prevData), _toConsumableArray(dataArr));
125
- });
126
- setScrolling(true);
127
- } else {
128
- setScrolling(false);
129
- }
130
- });
131
- };
132
-
133
- var changePageNumber = function changePageNumber(pageNumber, seoPaginate, pageview, router, currentPage, setCurrentPage, itemsPerPage, itemIndex) {
134
- if (seoPaginate) {
135
- var path = router.asPath;
136
- var qrIndex = path.indexOf('?');
137
- var pathname = router.pathname;
138
- var queryString = '';
139
-
140
- if (qrIndex > 0) {
141
- path = path.substring(1, qrIndex);
142
-
143
- var partialQS = router.asPath.substring(qrIndex + 1);
144
- var partialQSArr = partialQS.split('&');
145
-
146
- // exclude page=xxx from query string
147
- partialQSArr.map(function (item) {
148
- var itemArr = item.split('=');
149
- var key = itemArr[0];
150
- var val = itemArr[1];
151
-
152
- if (key !== 'page') {
153
- queryString += (queryString.length === 0 ? '' : '&') + key + '=' + val;
154
- }
155
- });
156
- }
157
-
158
- if (queryString.length > 0) {
159
- path += '?' + queryString;
160
- }
161
-
162
- // pageNumber = parseInt(pageNumber)
163
-
164
- var index = Number(itemIndex);
165
- var perPage = Number(itemsPerPage);
166
-
167
- pageNumber = Math.ceil((index + 1) / perPage);
168
-
169
- if (currentPage !== pageNumber) {
170
- lib_3.refresh();
171
-
172
- setCurrentPage(pageNumber);
173
- if (path[0] !== '/') {
174
- path = '/' + path;
175
- }
176
- var newPath = pageNumber === 1 ? '' + path : '' + path + (queryString.length > 0 ? '&' : '?') + 'page=' + pageNumber;
177
-
178
- if (pageview) {
179
- pageview(newPath);
180
- }
181
-
182
- router.push(pathname, newPath, {
183
- shallow: true
184
- });
185
- }
186
- }
187
- };
188
-
189
- var renderAuthor = function renderAuthor(authorDetail, index, length) {
190
- if (authorDetail) {
191
- var _id = authorDetail._id,
192
- displayName = authorDetail.displayName,
193
- url = authorDetail.url;
194
-
195
- if (displayName && url && url.current) {
196
- return React__default.createElement(
197
- 'div',
198
- { key: _id },
199
- index === 0 && React__default.createElement(
200
- 'span',
201
- { className: 'pr-1' },
202
- 'By'
203
- ),
204
- React__default.createElement(
205
- 'a',
206
- { href: '/authors/' + url.current, className: 'text-muted' },
207
- displayName,
208
- length !== index + 1 && React__default.createElement('br', null)
209
- )
210
- );
211
- } else if (displayName) {
212
- return React__default.createElement(
213
- 'div',
214
- { key: _id },
215
- index === 0 && React__default.createElement(
216
- 'span',
217
- { className: 'pr-1' },
218
- 'By'
219
- ),
220
- React__default.createElement(
221
- 'span',
222
- { className: 'text-muted' },
223
- displayName,
224
- length !== index + 1 && React__default.createElement('br', null)
225
- )
226
- );
227
- }
228
- } else return null;
229
- };
230
-
231
- var checkExternalUrl = function checkExternalUrl(url) {
232
- return new RegExp(['http', 'https'].join('|')).test(url);
233
- };
234
-
235
- var cardLoader = function cardLoader(data, builder, mapping, values, seoPaginate, pageview, router, currentPage, setCurrentPage, showPublished, defaultImage, showAuthor, showCategory, imageHeight, imageWidth, rightItems, brandInsightAd, showBI, itemsPerPage, heroContent) {
236
- var numberOfItemsBeforeAd = 6;
237
-
238
- var insertBrandInsightAd = function insertBrandInsightAd(arr, index, newElement) {
239
- return [].concat(_toConsumableArray(arr.slice(0, index)), [newElement], _toConsumableArray(arr.slice(index)));
240
- };
241
- if (showBI && brandInsightAd) {
242
- var pos = 0;
243
- for (var i = 1; pos < data.length; i++) {
244
- var inFeedAd = {
245
- adUnit: brandInsightAd.adUnit,
246
- className: brandInsightAd.className,
247
- networkID: brandInsightAd.networkID,
248
- sizes: brandInsightAd.sizes,
249
- slotId: brandInsightAd.slotId + '_' + i,
250
- targeting: {
251
- pos: 'article' + i,
252
- content_placement: brandInsightAd.targeting.content_placement,
253
- document_url: brandInsightAd.targeting.document_url
254
- },
255
- _type: 'brandInsightAd'
256
- };
257
-
258
- data = insertBrandInsightAd(data, pos, inFeedAd);
259
- pos += brandInsightAd.interval + 1;
260
- }
261
- }
262
-
263
- var featureCount = 0;
264
-
265
- return React__default.createElement(
266
- 'div',
267
- null,
268
- data && data.length > 0 ? data.map(function (article, index) {
269
- var pageNumber = article.pageNumber || values.page;
270
-
271
- var contentCategoryName = article.contentCategory ? article.contentCategory.name : 'Articles';
272
-
273
- if (article._type === 'feature') {
274
- featureCount++;
275
- if (article.blank || checkExternalUrl(article.url.current)) {
276
- return React__default.createElement(
277
- React__default.Fragment,
278
- { key: article._id ? article._id : index },
279
- React__default.createElement(
280
- VisibilitySensor,
281
- {
282
- key: article._id ? article._id : index,
283
- partialVisibility: true,
284
- onChange: function onChange(isVisible) {
285
- isVisible && changePageNumber(1, seoPaginate, pageview, router, currentPage, setCurrentPage, itemsPerPage, parseInt(index));
286
- } },
287
- React__default.createElement(
288
- React__default.Fragment,
289
- null,
290
- React__default.createElement(
291
- Media$1,
292
- {
293
- key: article._id ? article._id : index,
294
- className: 'feature-media',
295
- style: { flexDirection: 'column', marginBottom: '1.25rem', paddingBottom: '1.25rem', borderBottom: '1px solid #ddd' } },
296
- (article.thumbnail && article.thumbnail.asset || defaultImage) && React__default.createElement(
297
- 'a',
298
- { href: article.url.current, target: '_blank', className: 'feature-wrapper' },
299
- React__default.createElement(
300
- LazyLoad,
301
- { height: imageHeight },
302
- 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 })
303
- )
304
- ),
305
- React__default.createElement(
306
- Media$1.Body,
307
- null,
308
- React__default.createElement(
309
- 'a',
310
- { href: article.url.current, target: '_blank' },
311
- article.title && React__default.createElement(
312
- 'h4',
313
- { className: 'card-title', style: { fontWeight: '500', color: 'var(--gray-dark)', marginBottom: '.5rem' } },
314
- article.title
315
- )
316
- ),
317
- showPublished && article.published && React__default.createElement(
318
- 'p',
319
- { className: 'card-text', style: { color: 'var(--dark)', marginBottom: '.25rem' } },
320
- moment(article.published).format('MMMM DD, YYYY')
321
- ),
322
- showAuthor && article.authorMapping && article.authorMapping.length > 0 && article.authorMapping.map(function (authorDetail, index) {
323
- return renderAuthor(authorDetail, index, article.authorMapping.length);
324
- }),
325
- article.source && React__default.createElement(
326
- 'p',
327
- { className: 'p-0 mb-1' },
328
- article.source
329
- ),
330
- showCategory && article.contentCategory && React__default.createElement(
331
- 'p',
332
- {
333
- className: 'article-category',
334
- style: {
335
- background: '#3FB618',
336
- color: '#ffffff',
337
- marginBottom: '.25rem',
338
- display: 'inline-block',
339
- padding: '0 .25rem',
340
- fontSize: '.8rem'
341
- } },
342
- article.contentCategory.name.slice(0, article.contentCategory.name.length - 1)
343
- ),
344
- article.summary && React__default.createElement(
345
- 'p',
346
- { className: 'pt-2 card-text' },
347
- clean_html_1(article.summary)
348
- )
349
- )
350
- )
351
- )
352
- ),
353
- main_39 && rightItems && (index + 1) % numberOfItemsBeforeAd === 0 && renderMobileAd(index, numberOfItemsBeforeAd, rightItems)
354
- );
355
- } else {
356
- return React__default.createElement(
357
- React__default.Fragment,
358
- { key: article._id ? article._id : index },
359
- React__default.createElement(
360
- VisibilitySensor,
361
- {
362
- key: article._id ? article._id : index,
363
- partialVisibility: true,
364
- onChange: function onChange(isVisible) {
365
- isVisible && changePageNumber(1, seoPaginate, pageview, router, currentPage, setCurrentPage, itemsPerPage, parseInt(index));
366
- } },
367
- React__default.createElement(
368
- React__default.Fragment,
369
- null,
370
- React__default.createElement(
371
- Media$1,
372
- {
373
- key: article._id ? article._id : index,
374
- className: 'feature-media',
375
- style: { flexDirection: 'column', marginBottom: '1.25rem', paddingBottom: '1.25rem', borderBottom: '1px solid #ddd' } },
376
- (article.thumbnail && article.thumbnail.asset || defaultImage) && React__default.createElement(
377
- 'a',
378
- { href: article.url.current, className: 'feature-wrapper' },
379
- React__default.createElement(
380
- LazyLoad,
381
- { height: imageHeight },
382
- 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 })
383
- )
384
- ),
385
- React__default.createElement(
386
- Media$1.Body,
387
- null,
388
- React__default.createElement(
389
- 'a',
390
- { href: article.url.current },
391
- article.title && React__default.createElement(
392
- 'h4',
393
- { className: 'card-title', style: { fontWeight: '500', color: 'var(--gray-dark)', marginBottom: '.5rem' } },
394
- article.title
395
- )
396
- ),
397
- showPublished && article.published && React__default.createElement(
398
- 'p',
399
- { className: 'card-text', style: { color: 'var(--dark)', marginBottom: '.25rem' } },
400
- moment(article.published).format('MMMM DD, YYYY')
401
- ),
402
- showAuthor && article.authorMapping && article.authorMapping.length > 0 && article.authorMapping.map(function (authorDetail, index) {
403
- return renderAuthor(authorDetail, index, article.authorMapping.length);
404
- }),
405
- article.source && React__default.createElement(
406
- 'p',
407
- { className: 'p-0 mb-1' },
408
- article.source
409
- ),
410
- showCategory && article.contentCategory && React__default.createElement(
411
- 'p',
412
- {
413
- style: {
414
- background: '#3FB618',
415
- color: '#ffffff',
416
- marginBottom: '.25rem',
417
- display: 'inline-block',
418
- padding: '0 .25rem',
419
- fontSize: '.8rem'
420
- } },
421
- article.contentCategory.name.slice(0, article.contentCategory.name.length - 1)
422
- ),
423
- article.summary && React__default.createElement(
424
- 'p',
425
- { className: 'pt-2 card-text' },
426
- clean_html_1(article.summary)
427
- )
428
- )
429
- )
430
- )
431
- ),
432
- main_39 && rightItems && (index + 1) % numberOfItemsBeforeAd === 0 && renderMobileAd(index, numberOfItemsBeforeAd, rightItems)
433
- );
434
- }
435
- } else if (article._type === 'brandInsightAd' && article.adUnit) {
436
- return React__default.createElement(ADInfeed, { index: index, infeedAd: article });
437
- }
438
-
439
- if (index + 1 > heroContent + featureCount) {
440
- return React__default.createElement(
441
- React__default.Fragment,
442
- { key: article._id ? article._id : index },
443
- React__default.createElement(
444
- VisibilitySensor,
445
- {
446
- key: article._id ? article._id : index,
447
- onChange: function onChange(isVisible) {
448
- isVisible && changePageNumber(pageNumber, seoPaginate, pageview, router, currentPage, setCurrentPage, itemsPerPage, parseInt(index));
449
- } },
450
- React__default.createElement(
451
- React__default.Fragment,
452
- null,
453
- React__default.createElement(
454
- Media$1,
455
- {
456
- key: article._id ? article._id : index,
457
- style: { flexDirection: 'row', marginBottom: '1.25rem', paddingBottom: '1.25rem', borderBottom: '1px solid #ddd' } },
458
- (article.thumbnail && article.thumbnail.asset || defaultImage) && React__default.createElement(
459
- 'a',
460
- { href: mapping[contentCategoryName] + '/' + article.url.current, className: 'img-wrapper' },
461
- React__default.createElement(
462
- LazyLoad,
463
- { height: imageHeight },
464
- 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 })
465
- )
466
- ),
467
- React__default.createElement(
468
- Media$1.Body,
469
- null,
470
- React__default.createElement(
471
- 'a',
472
- { href: mapping[contentCategoryName] + '/' + article.url.current },
473
- article.title && React__default.createElement(
474
- 'h4',
475
- { className: 'card-title', style: { fontWeight: '500', color: 'var(--gray-dark)', marginBottom: '.5rem' } },
476
- article.title
477
- )
478
- ),
479
- showPublished && article.published && React__default.createElement(
480
- 'p',
481
- { className: 'card-text', style: { color: 'var(--dark)', marginBottom: '.25rem' } },
482
- moment(article.published).format('MMMM DD, YYYY')
483
- ),
484
- showAuthor && article.authorMapping && article.authorMapping.length > 0 && article.authorMapping.map(function (authorDetail, index) {
485
- return renderAuthor(authorDetail, index, article.authorMapping.length);
486
- }),
487
- article.source && React__default.createElement(
488
- 'p',
489
- { className: 'p-0 mb-1' },
490
- article.source
491
- ),
492
- showCategory && article.contentCategory && React__default.createElement(
493
- 'p',
494
- {
495
- style: {
496
- background: '#3FB618',
497
- color: '#ffffff',
498
- marginBottom: '.25rem',
499
- display: 'inline-block',
500
- padding: '0 .25rem',
501
- fontSize: '.8rem'
502
- } },
503
- article.contentCategory.name.slice(0, article.contentCategory.name.length - 1)
504
- ),
505
- article.summary && React__default.createElement(
506
- 'p',
507
- { className: 'pt-2 card-text' },
508
- clean_html_1(article.summary)
509
- )
510
- )
511
- )
512
- )
513
- ),
514
- main_39 && rightItems && (index + 1) % numberOfItemsBeforeAd === 0 && renderMobileAd(index, numberOfItemsBeforeAd, rightItems)
515
- );
516
- } else return null;
517
- }) : React__default.createElement(
518
- 'div',
519
- null,
520
- React__default.createElement(
521
- 'h5',
522
- null,
523
- React__default.createElement(
524
- 'em',
525
- null,
526
- 'New content coming soon, please check back later.'
527
- )
528
- )
529
- ),
530
- React__default.createElement(
531
- 'style',
532
- { jsx: 'true' },
533
- '\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 '
534
- )
535
- );
536
- };
537
-
538
- var renderMobileAd = function renderMobileAd(index, numberOfItemsBeforeAd, rightItems) {
539
- var i = ((index + 1) / numberOfItemsBeforeAd - 1) % rightItems.length;
540
- return React__default.createElement(
541
- 'div',
542
- { style: { display: 'flex', flex: '1 0 auto' } },
543
- rightItems[i].component
544
- );
545
- };
546
-
547
- var renderManualPagination = function renderManualPagination(currentPage) {
548
- return React__default.createElement(
549
- 'div',
550
- { className: 'd-flex justify-content-between' },
551
- currentPage && currentPage > 1 && React__default.createElement(
552
- 'a',
553
- { href: '?page=' + (currentPage - 1) },
554
- '<< Previous'
555
- ),
556
- React__default.createElement(
557
- 'a',
558
- { href: '?page=' + (currentPage + 1) },
559
- 'Next >>'
560
- )
561
- );
562
- };
563
-
564
- var usePrevious = function usePrevious(value) {
565
- var ref = useRef();
566
- useEffect(function () {
567
- ref.current = value;
568
- });
569
- return ref.current;
570
- };
571
-
572
- var InfiniteScrollDeck = function InfiniteScrollDeck(props) {
573
- var router = useRouter();
574
- var initialData = props.dataRecord,
575
- client = props.client,
576
- params = props.params,
577
- query = props.query,
578
- autoScroll = props.autoScroll,
579
- pointer = props.pointer,
580
- pointerArray = props.pointerArray,
581
- mapping = props.mapping,
582
- seoPaginate = props.seoPaginate,
583
- pageview = props.pageview,
584
- defaultImage = props.defaultImage,
585
- showAuthor = props.showAuthor,
586
- showCategory = props.showCategory,
587
- imageHeight = props.imageHeight,
588
- imageWidth = props.imageWidth,
589
- rightItems = props.rightItems,
590
- brandInsightAd = props.brandInsightAd,
591
- _props$showBI = props.showBI,
592
- showBI = _props$showBI === undefined ? false : _props$showBI,
593
- _props$heroContent = props.heroContent,
594
- heroContent = _props$heroContent === undefined ? 0 : _props$heroContent;
595
- var initialCurrentPage = props.currentPage,
596
- showPublished = props.showPublished;
597
-
598
- var builder = imageUrlBuilder(client);
599
-
600
- var _useState = useState(initialData),
601
- _useState2 = _slicedToArray(_useState, 2),
602
- data = _useState2[0],
603
- setData = _useState2[1];
604
-
605
- var _useState3 = useState(true),
606
- _useState4 = _slicedToArray(_useState3, 2),
607
- scrolling = _useState4[0],
608
- setScrolling = _useState4[1];
609
-
610
- var _useState5 = useState(params ? params.to : 0),
611
- _useState6 = _slicedToArray(_useState5, 1),
612
- per = _useState6[0];
613
-
614
- var _useState7 = useState(initialCurrentPage || 1),
615
- _useState8 = _slicedToArray(_useState7, 2),
616
- currentPage = _useState8[0],
617
- setCurrentPage = _useState8[1];
618
-
619
- var _useState9 = useState({
620
- from: params ? params.from : 0,
621
- to: params ? params.to : 0,
622
- page: 1
623
- }),
624
- _useState10 = _slicedToArray(_useState9, 2),
625
- values = _useState10[0],
626
- setValues = _useState10[1];
627
-
628
- var itemsPerPage = params.itemsPerPage;
629
-
630
- var prevValues = usePrevious(values);
631
-
632
- useEffect(function () {
633
- if (prevValues) {
634
- if (values.page !== prevValues.page && values.from !== prevValues.from && values.to !== prevValues.from) {
635
- loadData(values, query, client, params, setData, setScrolling, pointer, pointerArray);
636
- }
637
- }
638
- }, [values, prevValues, query, client, params, setData, setScrolling, pointer, pointerArray]);
639
-
640
- useEffect(function () {
641
- document.addEventListener('scroll', trackScrolling);
642
- return function () {
643
- document.removeEventListener('scroll', trackScrolling);
644
- };
645
- }, [currentPage]);
646
-
647
- var trackScrolling = function trackScrolling(current) {
648
- if (window.pageYOffset === 0) {
649
- if (currentPage > 1) {
650
- changePageNumber(1, seoPaginate, pageview, router, currentPage, setCurrentPage, itemsPerPage, 1);
651
- }
652
- }
653
- };
654
-
655
- return React__default.createElement(
656
- 'div',
657
- null,
658
- autoScroll ? React__default.createElement(
659
- React__default.Fragment,
660
- null,
661
- React__default.createElement(
662
- InfiniteScroll,
663
- { dataLength: data && data.length, next: function next() {
664
- return loadMore(values, setValues, per);
665
- }, hasMore: scrolling, scrollThreshold: 0.9 },
666
- React__default.createElement(
667
- Container,
668
- null,
669
- cardLoader(data, builder, mapping, values, seoPaginate, pageview, router, currentPage, setCurrentPage, showPublished, defaultImage, showAuthor, showCategory, imageHeight, imageWidth, rightItems, brandInsightAd, showBI, itemsPerPage, heroContent)
670
- )
671
- ),
672
- React__default.createElement(
673
- 'noscript',
674
- null,
675
- renderManualPagination(currentPage)
676
- )
677
- ) : React__default.createElement(
678
- React__default.Fragment,
679
- null,
680
- React__default.createElement(
681
- Container,
682
- null,
683
- cardLoader(data, builder, mapping, values, seoPaginate, pageview, router, currentPage, setCurrentPage, showPublished, defaultImage, showAuthor, showCategory, rightItems, brandInsightAd, showBI, itemsPerPage, heroContent)
684
- ),
685
- React__default.createElement(
686
- 'div',
687
- { style: { padding: '0px 10px' } },
688
- scrolling ? React__default.createElement(
689
- 'button',
690
- {
691
- style: { margin: 'auto', width: '100%' },
692
- onClick: function onClick(e) {
693
- loadMore(values, setValues, per);
694
- } },
695
- 'Load More'
696
- ) : React__default.createElement(
697
- 'p',
698
- { style: { textAlign: 'center' } },
699
- React__default.createElement(
700
- 'b',
701
- null,
702
- 'End of data'
703
- )
704
- )
705
- ),
706
- React__default.createElement(
707
- 'noscript',
708
- null,
709
- renderManualPagination(currentPage)
710
- )
711
- )
712
- );
713
- };
714
-
715
82
  var momentTimezone = createCommonjsModule(function (module) {
716
83
  //! moment-timezone.js
717
84
  //! version : 0.5.31
@@ -2263,12 +1630,12 @@ var latest = {
2263
1630
  };
2264
1631
 
2265
1632
  var latest$1 = /*#__PURE__*/Object.freeze({
2266
- __proto__: null,
2267
- version: version,
2268
- zones: zones,
2269
- links: links,
2270
- countries: countries,
2271
- 'default': latest
1633
+ __proto__: null,
1634
+ version: version,
1635
+ zones: zones,
1636
+ links: links,
1637
+ countries: countries,
1638
+ 'default': latest
2272
1639
  });
2273
1640
 
2274
1641
  var require$$1 = getCjsExportFromNamespace(latest$1);
@@ -2626,7 +1993,7 @@ var EventsDeck = function EventsDeck(_ref) {
2626
1993
  var numberOfItemsBeforeAd = 5;
2627
1994
 
2628
1995
  return React__default.createElement(
2629
- Container$1,
1996
+ Container,
2630
1997
  { style: { padding: 1 } },
2631
1998
  data && data.map(function (row, index) {
2632
1999
  var speakerInfo = [];
@@ -3187,7 +2554,7 @@ var CMEDeck = function CMEDeck(_ref) {
3187
2554
  )
3188
2555
  ) },
3189
2556
  React__default.createElement(
3190
- Container,
2557
+ Container$1,
3191
2558
  null,
3192
2559
  cardLoader()
3193
2560
  )
@@ -3201,7 +2568,7 @@ var CMEDeck = function CMEDeck(_ref) {
3201
2568
  React__default.Fragment,
3202
2569
  null,
3203
2570
  React__default.createElement(
3204
- Container,
2571
+ Container$1,
3205
2572
  null,
3206
2573
  cardLoader()
3207
2574
  ),
@@ -3767,7 +3134,7 @@ var ADWelcome = function ADWelcome(_ref) {
3767
3134
  );
3768
3135
  };
3769
3136
 
3770
- var urlFor$2 = function urlFor(source, builder) {
3137
+ var urlFor$1 = function urlFor(source, builder) {
3771
3138
  return builder.image(source).auto('format');
3772
3139
  };
3773
3140
 
@@ -3818,7 +3185,7 @@ var Slideshow = function Slideshow(_ref) {
3818
3185
  return React__default.createElement(
3819
3186
  Carousel.Item,
3820
3187
  { key: slide._key },
3821
- React__default.createElement('img', { src: slide.asset && urlFor$2(slide.asset, builder).url(), alt: slide.alt && slide.alt, style: { width: '100%' } }),
3188
+ React__default.createElement('img', { src: slide.asset && urlFor$1(slide.asset, builder).url(), alt: slide.alt && slide.alt, style: { width: '100%' } }),
3822
3189
  slide.caption && React__default.createElement(
3823
3190
  'p',
3824
3191
  { className: 'p-2' },
@@ -14077,7 +13444,7 @@ var Leads = function Leads(_ref) {
14077
13444
  );
14078
13445
  };
14079
13446
 
14080
- var urlFor$3 = function urlFor(source, client) {
13447
+ var urlFor$2 = function urlFor(source, client) {
14081
13448
  var builder = imageUrlBuilder(client);
14082
13449
  return builder.image(source).auto('format');
14083
13450
  };
@@ -14134,7 +13501,7 @@ var Slideshow$1 = function Slideshow(_ref) {
14134
13501
  React__default.createElement(
14135
13502
  LazyLoad,
14136
13503
  null,
14137
- React__default.createElement('img', { src: urlFor$3(slide.slideshowImage, client).url(), alt: slide.slideshowImage.alt || 'slideshow image', style: { width: '100%' } })
13504
+ React__default.createElement('img', { src: urlFor$2(slide.slideshowImage, client).url(), alt: slide.slideshowImage.alt || 'slideshow image', style: { width: '100%' } })
14138
13505
  )
14139
13506
  ),
14140
13507
  React__default.createElement(
@@ -14178,7 +13545,7 @@ var NativeAd = function NativeAd(props) {
14178
13545
  );
14179
13546
  };
14180
13547
 
14181
- var urlFor$4 = function urlFor(source, client) {
13548
+ var urlFor$3 = function urlFor(source, client) {
14182
13549
  var builder = imageUrlBuilder(client);
14183
13550
  return builder.image(source).auto('format');
14184
13551
  };
@@ -14205,7 +13572,7 @@ var MultiFigure = function MultiFigure(props) {
14205
13572
  React__default.createElement(
14206
13573
  'div',
14207
13574
  null,
14208
- React__default.createElement('img', { className: 'multi-figure-image', src: urlFor$4(image.asset, client).url(), alt: image.alt }),
13575
+ React__default.createElement('img', { className: 'multi-figure-image', src: urlFor$3(image.asset, client).url(), alt: image.alt }),
14209
13576
  image.caption && React__default.createElement(
14210
13577
  'p',
14211
13578
  { className: 'multi-figure-caption' },
@@ -14641,13 +14008,13 @@ var SetCookie = function SetCookie(key, value) {
14641
14008
  js_cookie.set(key, value, { expires: 1, sameSite: 'none', secure: true });
14642
14009
  };
14643
14010
 
14644
- var urlFor$5 = function urlFor(source, client) {
14011
+ var urlFor$4 = function urlFor(source, client) {
14645
14012
  var builder = imageUrlBuilder(client);
14646
14013
  return builder.image(source).auto('format');
14647
14014
  };
14648
14015
 
14649
- var renderCardImage$1 = function renderCardImage(thumbnail, client, imageHeight, imageWidth) {
14650
- var url = urlFor$5(thumbnail, client);
14016
+ var renderCardImage = function renderCardImage(thumbnail, client, imageHeight, imageWidth) {
14017
+ var url = urlFor$4(thumbnail, client);
14651
14018
  if (imageHeight) url = url.height(imageHeight);
14652
14019
  if (imageWidth) url = url.width(imageWidth);
14653
14020
  return url.url();
@@ -14674,7 +14041,7 @@ var Hero = function Hero(_ref) {
14674
14041
  { className: 'h4' },
14675
14042
  title
14676
14043
  ),
14677
- thumbnail && client && React__default.createElement(Card$1.Img, { src: renderCardImage$1(thumbnail, client, imageHeight, imageWidth) }),
14044
+ thumbnail && client && React__default.createElement(Card$1.Img, { src: renderCardImage(thumbnail, client, imageHeight, imageWidth) }),
14678
14045
  summary && React__default.createElement(
14679
14046
  Card$1.Footer,
14680
14047
  { className: 'h6' },
@@ -17420,7 +16787,7 @@ var InscreenSensor = function (_React$Component) {
17420
16787
  return InscreenSensor;
17421
16788
  }(React__default.Component);
17422
16789
 
17423
- var renderAuthor$1 = function renderAuthor(authorName, authorURL, index, length) {
16790
+ var renderAuthor = function renderAuthor(authorName, authorURL, index, length) {
17424
16791
  var defaultUrl = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 'authors';
17425
16792
 
17426
16793
  if (authorName && authorURL) {
@@ -17842,7 +17209,7 @@ var Article = function Article(props) {
17842
17209
  return React__default.createElement(
17843
17210
  'span',
17844
17211
  { key: index },
17845
- renderAuthor$1(authorDetail.displayName, authorDetail.url, index, authorDetails.length, authorPrefix)
17212
+ renderAuthor(authorDetail.displayName, authorDetail.url, index, authorDetails.length, authorPrefix)
17846
17213
  );
17847
17214
  }),
17848
17215
  React__default.createElement(
@@ -18457,8 +17824,8 @@ function useUser() {
18457
17824
  }
18458
17825
 
18459
17826
  var hooks = /*#__PURE__*/Object.freeze({
18460
- __proto__: null,
18461
- useUser: useUser
17827
+ __proto__: null,
17828
+ useUser: useUser
18462
17829
  });
18463
17830
 
18464
17831
  var LoginForm = function LoginForm(props) {
@@ -19680,11 +19047,11 @@ function getTokenCookie(req) {
19680
19047
  }
19681
19048
 
19682
19049
  var authCookies = /*#__PURE__*/Object.freeze({
19683
- __proto__: null,
19684
- setTokenCookie: setTokenCookie,
19685
- removeTokenCookie: removeTokenCookie,
19686
- parseCookies: parseCookies,
19687
- getTokenCookie: getTokenCookie
19050
+ __proto__: null,
19051
+ setTokenCookie: setTokenCookie,
19052
+ removeTokenCookie: removeTokenCookie,
19053
+ parseCookies: parseCookies,
19054
+ getTokenCookie: getTokenCookie
19688
19055
  });
19689
19056
 
19690
19057
  function encryptSession(session) {
@@ -19728,9 +19095,9 @@ var getSession = function () {
19728
19095
  }();
19729
19096
 
19730
19097
  var iron = /*#__PURE__*/Object.freeze({
19731
- __proto__: null,
19732
- encryptSession: encryptSession,
19733
- getSession: getSession
19098
+ __proto__: null,
19099
+ encryptSession: encryptSession,
19100
+ getSession: getSession
19734
19101
  });
19735
19102
 
19736
19103
  var toStr = Object.prototype.toString;
@@ -21985,10 +21352,10 @@ var findUser$1 = function () {
21985
21352
  }();
21986
21353
 
21987
21354
  var user = /*#__PURE__*/Object.freeze({
21988
- __proto__: null,
21989
- createUser: createUser$1,
21990
- updateUser: updateUser$1,
21991
- findUser: findUser$1
21355
+ __proto__: null,
21356
+ createUser: createUser$1,
21357
+ updateUser: updateUser$1,
21358
+ findUser: findUser$1
21992
21359
  });
21993
21360
 
21994
21361
  var localStrategy = new Local.Strategy({
@@ -22004,8 +21371,8 @@ var localStrategy = new Local.Strategy({
22004
21371
  });
22005
21372
 
22006
21373
  var passportLocal = /*#__PURE__*/Object.freeze({
22007
- __proto__: null,
22008
- localStrategy: localStrategy
21374
+ __proto__: null,
21375
+ localStrategy: localStrategy
22009
21376
  });
22010
21377
 
22011
21378
  var _this$4 = undefined;
@@ -22197,7 +21564,7 @@ var auth = {
22197
21564
  ProcessData: ProcessData_1
22198
21565
  };
22199
21566
 
22200
- var renderAuthor$2 = function renderAuthor(authorName, authorURL, index, length) {
21567
+ var renderAuthor$1 = function renderAuthor(authorName, authorURL, index, length) {
22201
21568
  var defaultUrl = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 'authors';
22202
21569
 
22203
21570
  if (authorName && authorURL) {
@@ -22259,7 +21626,7 @@ var getArticleSummary$1 = function getArticleSummary(article) {
22259
21626
  }
22260
21627
  };
22261
21628
 
22262
- function urlFor$6(client, source) {
21629
+ function urlFor$5(client, source) {
22263
21630
  return imageUrlBuilder(client).image(source);
22264
21631
  }
22265
21632
 
@@ -22320,7 +21687,7 @@ var DocumentGroup = function DocumentGroup(_ref) {
22320
21687
  var thumbnailUrl = false;
22321
21688
 
22322
21689
  if (article.documentGroup.thumbnail) {
22323
- thumbnailUrl = urlFor$6(client, article.documentGroup.thumbnail).url();
21690
+ thumbnailUrl = urlFor$5(client, article.documentGroup.thumbnail).url();
22324
21691
  }
22325
21692
 
22326
21693
  return React__default.createElement(
@@ -22540,7 +21907,9 @@ var Article$1 = function Article(props) {
22540
21907
  parent.style.display = 'none';
22541
21908
  setContextualADFlag(false);
22542
21909
  } else {
22543
- setContextualADFlag(true);
21910
+ if (body[0]._type === 'figure' || body[1]._type === 'figure' || body[2]._type === 'figure' || body[3]._type === 'figure') {
21911
+ setContextualADFlag(true);
21912
+ }
22544
21913
  }
22545
21914
  };
22546
21915
 
@@ -22598,7 +21967,9 @@ var Article$1 = function Article(props) {
22598
21967
  parent.style.display = 'none';
22599
21968
  setContextualADFlag(false);
22600
21969
  } else {
22601
- setContextualADFlag(true);
21970
+ if (body && body[1] && body[1]._type === 'figure') {
21971
+ setContextualADFlag(true);
21972
+ }
22602
21973
  }
22603
21974
  };
22604
21975
 
@@ -22610,12 +21981,13 @@ var Article$1 = function Article(props) {
22610
21981
  blocks: [].concat(_toConsumableArray(body.slice(0, _selectedIndex))),
22611
21982
  imageOptions: { w: 320, h: 240, fit: 'max' }
22612
21983
  }, client.config())),
22613
- React__default.createElement('span', { className: 'clearfix' }),
21984
+ contextualADFlag && React__default.createElement('span', { className: 'clearfix' }),
22614
21985
  React__default.createElement(
22615
21986
  'div',
22616
21987
  { id: 'contextual-native-ad-' + payload._id, className: 'contextual-native-ad' },
22617
21988
  React__default.createElement(DFPAdSlot, _extends$2({}, payload.contextualAD, { refreshFlag: false, checkIsAdFound: _checkIsAdFound }))
22618
21989
  ),
21990
+ contextualADFlag && React__default.createElement('span', { className: 'clearfix' }),
22619
21991
  React__default.createElement(BlockContent, _extends$2({
22620
21992
  serializers: getSerializers(client, pageview, videoAccountIDs, function () {}, true, drupalLeadSettings, currentPage, false),
22621
21993
  blocks: [].concat(_toConsumableArray(body.slice(_selectedIndex))),
@@ -22684,7 +22056,7 @@ var Article$1 = function Article(props) {
22684
22056
  var shareUrl = shareBaseUrl + props.article.url.current;
22685
22057
  var shareTitle = article.title;
22686
22058
  var shareSummary = article.summary;
22687
- var shareImage = thumbnail && thumbnail.asset ? urlFor$6(props.client, thumbnail.asset).url() : shareImageDefault;
22059
+ var shareImage = thumbnail && thumbnail.asset ? urlFor$5(props.client, thumbnail.asset).url() : shareImageDefault;
22688
22060
  var siteName = props.website && props.website.title ? props.website.title : '';
22689
22061
 
22690
22062
  var meta = {
@@ -22774,7 +22146,7 @@ var Article$1 = function Article(props) {
22774
22146
  return React__default.createElement(
22775
22147
  'span',
22776
22148
  { key: index },
22777
- renderAuthor$2(authorDetail.displayName, authorDetail.url, index, authorDetails.length, authorPrefix)
22149
+ renderAuthor$1(authorDetail.displayName, authorDetail.url, index, authorDetails.length, authorPrefix)
22778
22150
  );
22779
22151
  }),
22780
22152
  React__default.createElement(
@@ -23069,16 +22441,20 @@ var ArticleQueue$1 = function ArticleQueue(props) {
23069
22441
  setQueueData = _useState2[1];
23070
22442
 
23071
22443
  var refreshAD = function refreshAD(path) {
22444
+
23072
22445
  if (!main_39) {
23073
22446
  var activeArticle = queueData.find(function (item) {
23074
22447
  return item.url.current === path;
23075
22448
  });
23076
- var targeting = getTargeting(props);
22449
+
22450
+ var targeting = getTargeting({ article: activeArticle, position: props.position, prevUrl: props.prevUrl });
22451
+
23077
22452
  lib_3.getGoogletag().then(function (googletag) {
23078
22453
  if (window.googletag && googletag.pubadsReady) {
23079
22454
  var slots = googletag.pubads().getSlots();
23080
22455
  slots.forEach(function (slot) {
23081
22456
  var pos = slot.getTargeting('pos');
22457
+
23082
22458
  slot.clearTargeting();
23083
22459
  _Object$keys(targeting).forEach(function (key) {
23084
22460
  slot.setTargeting(key, targeting[key]);
@@ -23356,4 +22732,4 @@ var getQuery = function getQuery(type) {
23356
22732
  }
23357
22733
  };
23358
22734
 
23359
- export { AD300x250, AD300x250x600, ADFloatingFooter, ADFooter, ADGutter, 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, PopUpModal, PublicationLanding, RelatedContent, RelatedTopicsDropdown, SetCookie, SocialShare$1 as SocialShare, VerticalHero, View, YahooHero, getKeywords, getQuery, getSerializers, getSeriesDetail, getTargeting, urlFor$6 as urlFor };
22735
+ export { AD300x250, AD300x250x600, ADFloatingFooter, ADFooter, ADGutter, 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, PopUpModal, PublicationLanding, RelatedContent, RelatedTopicsDropdown, SetCookie, SocialShare$1 as SocialShare, VerticalHero, View, YahooHero, getKeywords, getQuery, getSerializers, getSeriesDetail, getTargeting, urlFor$5 as urlFor };