@mjhls/mjh-framework 1.0.324 → 1.0.325

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
@@ -4,8 +4,8 @@ import './web.dom.iterable-7e9bebf9.js';
4
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';
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
- import { _ as _extends$2 } from './extends-dbbe308d.js';
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-cb536901.js';
7
+ import { _ as _extends$2, a as _Object$assign } from './extends-26d3b609.js';
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, useRef, useEffect } from 'react';
10
10
  import PropTypes from 'prop-types';
11
11
  import Container from 'react-bootstrap/Container';
@@ -26,12 +26,12 @@ import './promise-86cb8313.js';
26
26
  import './ADInfeed-aadcfc25.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
- export { A as AD, G as GridContent } from './GridContent-ceb53300.js';
29
+ export { A as AD, G as GridContent } from './GridContent-13be42a1.js';
30
30
  export { default as DeckQueue } from './DeckQueue.js';
31
31
  import 'react-bootstrap/Media';
32
32
  export { default as ThumbnailCard } from './ThumbnailCard.js';
33
- import { B as BlockContent } from './TaxonomyCard-35127639.js';
34
- export { T as TaxonomyCard } from './TaxonomyCard-35127639.js';
33
+ import { B as BlockContent } from './TaxonomyCard-89325080.js';
34
+ export { T as TaxonomyCard } from './TaxonomyCard-89325080.js';
35
35
  import './react-social-icons-a7d5c5c7.js';
36
36
  import { g as getYoutubeId } from './smoothscroll-4b699764.js';
37
37
  import GroupDeck from './GroupDeck.js';
@@ -16186,16 +16186,18 @@ var InscreenSensor = function (_React$Component) {
16186
16186
  }(React__default.Component);
16187
16187
 
16188
16188
  var renderAuthor = function renderAuthor(authorName, authorURL, index, length) {
16189
- if (authorName && authorURL) return React__default.createElement(
16190
- Link,
16191
- { href: '/authors/' + authorURL.current, key: index },
16192
- React__default.createElement(
16193
- 'a',
16194
- null,
16195
- authorName,
16196
- length !== index + 1 && React__default.createElement('br', null)
16197
- )
16198
- );else if (authorName) {
16189
+ if (authorName && authorURL) {
16190
+ return React__default.createElement(
16191
+ Link,
16192
+ { href: '/authors/' + authorURL.current, key: index },
16193
+ React__default.createElement(
16194
+ 'a',
16195
+ null,
16196
+ authorName,
16197
+ length !== index + 1 && React__default.createElement('br', null)
16198
+ )
16199
+ );
16200
+ } else if (authorName) {
16199
16201
  return React__default.createElement(
16200
16202
  'span',
16201
16203
  { key: index },
@@ -16219,17 +16221,41 @@ var get_content_placement_url = function get_content_placement_url(cp) {
16219
16221
  return cp_url;
16220
16222
  };
16221
16223
 
16224
+ var getArticleSummary = function getArticleSummary(article) {
16225
+ if (article.summary && article.summary.length > 0) {
16226
+ return article.summary;
16227
+ } else {
16228
+ var _article$body = article.body,
16229
+ body = _article$body === undefined ? [] : _article$body;
16230
+
16231
+ var desc = '';
16232
+ body.some(function (children) {
16233
+ children.children && children.children.some(function (item) {
16234
+ if (item.text && String(item.text).trim().length > 0 && desc === '') {
16235
+ desc = String(item.text);
16236
+ return true;
16237
+ }
16238
+ });
16239
+ if (desc !== '') {
16240
+ return true;
16241
+ }
16242
+ });
16243
+ return desc;
16244
+ }
16245
+ };
16246
+
16222
16247
  var Article = function Article(props) {
16223
16248
  var client = props.client,
16224
16249
  pageview = props.pageview,
16225
16250
  videoAccountIDs = props.videoAccountIDs,
16251
+ drupalLeadSettings = props.drupalLeadSettings,
16226
16252
  _props$article = props.article,
16227
16253
  title = _props$article.title,
16228
16254
  passwordLock = _props$article.passwordLock,
16229
16255
  authorDetails = _props$article.authorDetails,
16256
+ pageNumber = _props$article.pageNumber,
16230
16257
  published = _props$article.published,
16231
16258
  articleBody = _props$article.body,
16232
- summary = _props$article.summary,
16233
16259
  thumbnail = _props$article.thumbnail,
16234
16260
  content_placement = _props$article.content_placement,
16235
16261
  _props$article$url = _props$article.url;
@@ -16246,6 +16272,8 @@ var Article = function Article(props) {
16246
16272
  cpModificationRequired = props.cpModificationRequired;
16247
16273
 
16248
16274
 
16275
+ var summary = getArticleSummary(props.article);
16276
+
16249
16277
  var urlFor = function urlFor(source) {
16250
16278
  return imageUrlBuilder(client).image(source);
16251
16279
  };
@@ -16271,70 +16299,119 @@ var Article = function Article(props) {
16271
16299
  return null;
16272
16300
  };
16273
16301
 
16274
- var shareVia = shareOptions.shareVia,
16275
- shareSubject = shareOptions.shareSubject,
16276
- twitterSiteName = shareOptions.twitterSiteName,
16277
- shareImageDefault = shareOptions.shareImageDefault,
16278
- shareSiteTitle = shareOptions.shareSiteTitle;
16279
-
16280
- var shareUrl = shareOptions.shareBaseUrl + props.url;
16281
- var shareTitle = title;
16282
- var shareSummary = summary;
16283
- var shareImage = thumbnail && thumbnail.asset ? urlFor(thumbnail.asset).url() : shareImageDefault;
16284
- var siteName = props.website.title;
16302
+ var renderRelevantTopicsDropdown = function renderRelevantTopicsDropdown() {
16303
+ if (content_placement && content_placement.length > 0) {
16304
+ return React__default.createElement(
16305
+ Dropdown,
16306
+ { style: { marginBottom: '1rem' } },
16307
+ React__default.createElement(
16308
+ Dropdown.Toggle,
16309
+ { variant: 'primary', id: 'partner-dropdown' },
16310
+ 'Relevant Topics'
16311
+ ),
16312
+ React__default.createElement(
16313
+ Dropdown.Menu,
16314
+ null,
16315
+ content_placement.length > 0 ? content_placement.map(function (cp, index) {
16316
+ var cp_url = cpModificationRequired ? get_content_placement_url(cp) : cp.path;
16317
+ var href = '/' + cp_url;
16318
+ return React__default.createElement(
16319
+ Dropdown.Item,
16320
+ { key: index, href: href },
16321
+ cp.name
16322
+ );
16323
+ }) : null
16324
+ )
16325
+ );
16326
+ }
16327
+ return null;
16328
+ };
16285
16329
 
16286
- //Native Ads
16287
- var findIndex = function findIndex(arr) {
16288
- var indexes = [];
16289
- var _iteratorNormalCompletion = true;
16290
- var _didIteratorError = false;
16291
- var _iteratorError = undefined;
16330
+ var renderBlockContent = function renderBlockContent(payload) {
16331
+ var _payload = payload,
16332
+ body = _payload.body;
16292
16333
 
16293
- try {
16294
- for (var _iterator = _getIterator(arr), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
16295
- var ele = _step.value;
16334
+ var findIndex = function findIndex(arr) {
16335
+ var indexes = [];
16336
+ var _iteratorNormalCompletion = true;
16337
+ var _didIteratorError = false;
16338
+ var _iteratorError = undefined;
16296
16339
 
16297
- if (ele['_type'] === 'block' && ele.children.some(function (child) {
16298
- return child.text.trim().length > 0;
16299
- }) && ele['listItem'] != 'bullet' && ele['style'] === 'normal') {
16300
- indexes.push(arr.indexOf(ele));
16301
- }
16302
- }
16303
- } catch (err) {
16304
- _didIteratorError = true;
16305
- _iteratorError = err;
16306
- } finally {
16307
16340
  try {
16308
- if (!_iteratorNormalCompletion && _iterator.return) {
16309
- _iterator.return();
16341
+ for (var _iterator = _getIterator(arr), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
16342
+ var ele = _step.value;
16343
+
16344
+ if (ele['_type'] === 'block' && ele.children.some(function (child) {
16345
+ return child.text.trim().length > 0;
16346
+ }) && ele['listItem'] !== 'bullet' && ele['style'] === 'normal') {
16347
+ indexes.push(arr.indexOf(ele));
16348
+ }
16310
16349
  }
16350
+ } catch (err) {
16351
+ _didIteratorError = true;
16352
+ _iteratorError = err;
16311
16353
  } finally {
16312
- if (_didIteratorError) {
16313
- throw _iteratorError;
16354
+ try {
16355
+ if (!_iteratorNormalCompletion && _iterator.return) {
16356
+ _iterator.return();
16357
+ }
16358
+ } finally {
16359
+ if (_didIteratorError) {
16360
+ throw _iteratorError;
16361
+ }
16314
16362
  }
16315
16363
  }
16316
- }
16317
16364
 
16318
- return indexes;
16365
+ return indexes;
16366
+ };
16367
+ var indexes = findIndex(body);
16368
+ if (indexes.length >= 2 && body.length > 3 && payload.contextualAD) {
16369
+ payload = _extends$2({}, payload, {
16370
+ contextualAD: _extends$2({}, payload.contextualAD, {
16371
+ slotId: (payload.contextualAD.slotId || 'native-ad') + '-' + payload._id
16372
+ })
16373
+ });
16374
+ var selectedIndex = indexes[1] + 1;
16375
+ return React__default.createElement(
16376
+ React__default.Fragment,
16377
+ null,
16378
+ React__default.createElement(BlockContent, _extends$2({
16379
+ serializers: getSerializers(client, pageview, videoAccountIDs, function () {}, true, drupalLeadSettings),
16380
+ blocks: [].concat(_toConsumableArray(body.slice(0, selectedIndex))),
16381
+ imageOptions: { w: 320, h: 240, fit: 'max' }
16382
+ }, client.config())),
16383
+ React__default.createElement(
16384
+ 'div',
16385
+ { className: 'contextual-native-ad' },
16386
+ React__default.createElement(DFPAdSlot, _extends$2({}, payload.contextualAD, { refreshFlag: false }))
16387
+ ),
16388
+ React__default.createElement(BlockContent, _extends$2({
16389
+ serializers: getSerializers(client, pageview, videoAccountIDs, function () {}, true, drupalLeadSettings),
16390
+ blocks: [].concat(_toConsumableArray(body.slice(selectedIndex))),
16391
+ imageOptions: { w: 320, h: 240, fit: 'max' }
16392
+ }, client.config()))
16393
+ );
16394
+ } else {
16395
+ return React__default.createElement(BlockContent, _extends$2({
16396
+ serializers: getSerializers(client, pageview, videoAccountIDs, function () {}, true, drupalLeadSettings),
16397
+ blocks: articleBody,
16398
+ imageOptions: { w: 320, h: 240, fit: 'max' }
16399
+ }, client.config()));
16400
+ }
16319
16401
  };
16320
16402
 
16321
- var insert = function insert(arr, index, newElement) {
16322
- return [].concat(_toConsumableArray(arr.slice(0, index)), [newElement], _toConsumableArray(arr.slice(index)));
16323
- };
16324
- var newBody = [];
16325
- if (props.article.contextualAD) {
16326
- var indexes = findIndex(articleBody);
16403
+ var shareVia = shareOptions.shareVia,
16404
+ shareSubject = shareOptions.shareSubject,
16405
+ twitterSiteName = shareOptions.twitterSiteName,
16406
+ shareImageDefault = shareOptions.shareImageDefault,
16407
+ shareBaseUrl = shareOptions.shareBaseUrl,
16408
+ shareSiteTitle = shareOptions.shareSiteTitle;
16327
16409
 
16328
- if (indexes.length >= 2 && articleBody.length > 3) {
16329
- var setIndex = indexes[1];
16330
- newBody = insert(articleBody, setIndex + 1, props.article.contextualAD);
16331
- } else {
16332
- newBody = articleBody;
16333
- }
16334
- } else {
16335
- newBody = articleBody;
16336
- }
16337
- //End Native Ads
16410
+ var shareUrl = shareBaseUrl + props.url;
16411
+ var shareTitle = title;
16412
+ var shareSummary = summary;
16413
+ var shareImage = thumbnail && thumbnail.asset ? urlFor(thumbnail.asset).url() : shareImageDefault;
16414
+ var siteName = props.website.title;
16338
16415
 
16339
16416
  return React__default.createElement(
16340
16417
  React__default.Fragment,
@@ -16359,6 +16436,7 @@ var Article = function Article(props) {
16359
16436
  null,
16360
16437
  shareTitle + ' | ' + props.cache.siteSettingCache.name
16361
16438
  ),
16439
+ passwordLock && React__default.createElement('meta', { name: 'robots', content: 'noindex, nofollow' }),
16362
16440
  React__default.createElement('meta', { property: 'og:url', content: shareUrl }),
16363
16441
  React__default.createElement('meta', { property: 'og:title', content: shareTitle }),
16364
16442
  React__default.createElement('meta', { property: 'og:image', content: shareImage }),
@@ -16370,11 +16448,6 @@ var Article = function Article(props) {
16370
16448
  React__default.createElement('meta', { name: 'twitter:site', content: '@' + shareSiteTitle }),
16371
16449
  React__default.createElement('meta', { name: 'twitter:description', content: shareSummary })
16372
16450
  ),
16373
- React__default.createElement(
16374
- Head,
16375
- null,
16376
- passwordLock && React__default.createElement('meta', { name: 'robots', content: 'noindex, nofollow' })
16377
- ),
16378
16451
  React__default.createElement(
16379
16452
  'h1',
16380
16453
  { className: 'page-title' },
@@ -16407,7 +16480,7 @@ var Article = function Article(props) {
16407
16480
  issue.articleSource && React__default.createElement(
16408
16481
  'p',
16409
16482
  null,
16410
- 'Source: ' + issue.articleSource
16483
+ issue.articleSource
16411
16484
  )
16412
16485
  ),
16413
16486
  React__default.createElement(
@@ -16429,6 +16502,11 @@ var Article = function Article(props) {
16429
16502
  )
16430
16503
  )
16431
16504
  )
16505
+ ),
16506
+ pageNumber && React__default.createElement(
16507
+ 'div',
16508
+ { className: 'article-pageNumber' },
16509
+ 'Page Number: ' + pageNumber
16432
16510
  )
16433
16511
  ),
16434
16512
  React__default.createElement(
@@ -16446,28 +16524,7 @@ var Article = function Article(props) {
16446
16524
  twitterSiteName: twitterSiteName
16447
16525
  })
16448
16526
  ),
16449
- content_placement && content_placement.length > 0 && React__default.createElement(
16450
- Dropdown,
16451
- { style: { marginBottom: '1rem' } },
16452
- React__default.createElement(
16453
- Dropdown.Toggle,
16454
- { variant: 'primary', id: 'partner-dropdown' },
16455
- 'Relevant Topics'
16456
- ),
16457
- React__default.createElement(
16458
- Dropdown.Menu,
16459
- null,
16460
- content_placement.length > 0 ? content_placement.map(function (cp, index) {
16461
- var cp_url = cpModificationRequired ? get_content_placement_url(cp) : cp.path;
16462
- var href = '/' + cp_url;
16463
- return React__default.createElement(
16464
- Dropdown.Item,
16465
- { key: index, href: href },
16466
- cp.name
16467
- );
16468
- }) : null
16469
- )
16470
- ),
16527
+ renderRelevantTopicsDropdown(),
16471
16528
  React__default.createElement(
16472
16529
  'p',
16473
16530
  null,
@@ -16480,7 +16537,7 @@ var Article = function Article(props) {
16480
16537
  React__default.createElement('br', null)
16481
16538
  ),
16482
16539
  main_39 && props.article.Ads.map(function (ad, index) {
16483
- if (index == 0) {
16540
+ if (index === 0) {
16484
16541
  return React__default.createElement(
16485
16542
  'div',
16486
16543
  { key: index, id: 'addid-' + index, style: { display: 'flex', flex: '1 0 auto', marginTop: '-1rem', marginBottom: '1rem' } },
@@ -16491,11 +16548,7 @@ var Article = function Article(props) {
16491
16548
  React__default.createElement(
16492
16549
  'div',
16493
16550
  { className: 'block-content' },
16494
- React__default.createElement(BlockContent, _extends$2({
16495
- serializers: getSerializers(client, pageview, videoAccountIDs, function () {}, true),
16496
- blocks: newBody,
16497
- imageOptions: { w: 320, h: 240, fit: 'max' }
16498
- }, client.config())),
16551
+ renderBlockContent(props.article),
16499
16552
  issue && issue.url && React__default.createElement(
16500
16553
  'a',
16501
16554
  { href: issue.url, target: '_blank', title: 'Download issue' },
@@ -16520,64 +16573,18 @@ var Article = function Article(props) {
16520
16573
  React__default.createElement('hr', { className: 'article-seperater' })
16521
16574
  );
16522
16575
  };
16576
+
16523
16577
  var ArticleQueue = function ArticleQueue(props) {
16524
- var website = props.website,
16578
+ var _props$prevUrl = props.prevUrl,
16579
+ prevUrl = _props$prevUrl === undefined ? '/' : _props$prevUrl,
16525
16580
  Ads = props.Ads,
16526
- mainNavCache = props.mainNavCache,
16527
- subNavCache = props.subNavCache,
16528
- isLiveSite = props.isLiveSite,
16529
- _props$sponsoredTaxon = props.sponsoredTaxonomies,
16530
- sponsoredTaxonomies = _props$sponsoredTaxon === undefined ? [] : _props$sponsoredTaxon,
16531
16581
  _props$maxListLength = props.maxListLength,
16532
16582
  maxListLength = _props$maxListLength === undefined ? 10 : _props$maxListLength,
16583
+ _props$sponsoredTaxon = props.sponsoredTaxonomies,
16584
+ sponsoredTaxonomies = _props$sponsoredTaxon === undefined ? [] : _props$sponsoredTaxon,
16533
16585
  _props$cpModification = props.cpModificationRequired,
16534
16586
  cpModificationRequired = _props$cpModification === undefined ? false : _props$cpModification;
16535
16587
 
16536
- var _useState = useState(''),
16537
- _useState2 = _slicedToArray(_useState, 2),
16538
- prevUrl = _useState2[0],
16539
- setPrevUrl = _useState2[1];
16540
-
16541
- var _useState3 = useState([props.article]),
16542
- _useState4 = _slicedToArray(_useState3, 2),
16543
- queueData = _useState4[0],
16544
- setQueueData = _useState4[1];
16545
-
16546
- var _useState5 = useState({}),
16547
- _useState6 = _slicedToArray(_useState5, 2),
16548
- activeArticle = _useState6[0],
16549
- setActiveArticle = _useState6[1];
16550
-
16551
- var preVscroll = 0;
16552
- var isScrollDown = true;
16553
-
16554
- var _activeArticle$title = activeArticle.title,
16555
- _activeArticle$summar = activeArticle.summary,
16556
- summary = _activeArticle$summar === undefined ? '' : _activeArticle$summar;
16557
-
16558
-
16559
- var getFirstLine = function getFirstLine(article) {
16560
- var _article$body = article.body,
16561
- body = _article$body === undefined ? [] : _article$body;
16562
-
16563
- var desc = '';
16564
- body.some(function (children) {
16565
- children.children && children.children.some(function (item) {
16566
- if (item.text && String(item.text).trim().length > 0 && desc == '') {
16567
- desc = String(item.text);
16568
- return true;
16569
- }
16570
- });
16571
- if (desc !== '') {
16572
- return true;
16573
- }
16574
- });
16575
- return desc;
16576
- };
16577
-
16578
- if (summary.length === 0) {
16579
- summary = getFirstLine(activeArticle);
16580
- }
16581
16588
 
16582
16589
  var getTargeting = function getTargeting(article) {
16583
16590
  var _article$internalTag = article.internalTag,
@@ -16640,28 +16647,40 @@ var ArticleQueue = function ArticleQueue(props) {
16640
16647
  return targeting;
16641
16648
  };
16642
16649
 
16643
- var _useState7 = useState(getTargeting(activeArticle)),
16644
- _useState8 = _slicedToArray(_useState7, 2),
16645
- targeting = _useState8[0],
16646
- setTargeting = _useState8[1];
16647
-
16648
- var keywords = targeting && targeting.keywords ? targeting.keywords : [];
16649
-
16650
- var config = {
16651
- navComponent: website.navigation,
16652
- navItems: mainNavCache,
16653
- columns: '3',
16654
- leftItems: subNavCache,
16655
- rightItems: [],
16656
- horizontalAD: {},
16657
- isLiveSite: isLiveSite
16650
+ var firstArticle = function firstArticle() {
16651
+ var article = _Object$assign({}, props.article);
16652
+ var targeting = getTargeting(props.article);
16653
+ article.Ads = Ads.getRightItems(targeting);
16654
+ return article;
16658
16655
  };
16659
- props.article.Ads = Ads.getRightItems(targeting);
16660
16656
 
16661
- var _useState9 = useState(config),
16662
- _useState10 = _slicedToArray(_useState9, 2),
16663
- pageConfig = _useState10[0],
16664
- setPageConfig = _useState10[1];
16657
+ var _useState = useState([firstArticle()]),
16658
+ _useState2 = _slicedToArray(_useState, 2),
16659
+ queueData = _useState2[0],
16660
+ setQueueData = _useState2[1];
16661
+
16662
+ var refreshAD = function refreshAD(path) {
16663
+ if (!main_39) {
16664
+ var activeArticle = queueData.find(function (item) {
16665
+ return item.url.current === path;
16666
+ });
16667
+ var targeting = getTargeting(activeArticle);
16668
+ lib_3.getGoogletag().then(function (googletag) {
16669
+ if (window.googletag && googletag.pubadsReady) {
16670
+ var slots = googletag.pubads().getSlots();
16671
+ slots.forEach(function (slot) {
16672
+ var pos = slot.getTargeting('pos');
16673
+ slot.clearTargeting();
16674
+ _Object$keys(targeting).forEach(function (key) {
16675
+ slot.setTargeting(key, targeting[key]);
16676
+ });
16677
+ slot.setTargeting('pos', pos);
16678
+ });
16679
+ lib_3.refresh();
16680
+ }
16681
+ });
16682
+ }
16683
+ };
16665
16684
 
16666
16685
  var checkSponseredArticle = function checkSponseredArticle(article) {
16667
16686
  var _article$taxonomyMapp = article.taxonomyMapping,
@@ -16676,51 +16695,8 @@ var ArticleQueue = function ArticleQueue(props) {
16676
16695
  }
16677
16696
  };
16678
16697
 
16679
- var updateConfig = function updateConfig(article) {
16680
- if (prevUrl && prevUrl.length) {
16681
- var _targeting = getTargeting(article);
16682
- var _config = {
16683
- navComponent: website.navigation,
16684
- navItems: mainNavCache,
16685
- columns: '3',
16686
- leftItems: subNavCache,
16687
- rightItems: checkSponseredArticle(article) ? [] : Ads.getRightItems(_targeting),
16688
- horizontalAD: checkSponseredArticle(article) ? {} : Ads.getHorizontal(_targeting),
16689
- isLiveSite: isLiveSite
16690
- };
16691
- setPageConfig(_config);
16692
- if (!main_39) {
16693
- lib_3.getGoogletag().then(function (googletag) {
16694
- if (window.googletag && googletag.pubadsReady) {
16695
- var slots = googletag.pubads().getSlots();
16696
- slots.forEach(function (slot) {
16697
- var pos = slot.getTargeting('pos');
16698
- slot.clearTargeting();
16699
- _Object$keys(_targeting).forEach(function (key) {
16700
- slot.setTargeting(key, _targeting[key]);
16701
- });
16702
- slot.setTargeting('pos', pos);
16703
- });
16704
- lib_3.refresh();
16705
- }
16706
- });
16707
- }
16708
- }
16709
- };
16710
-
16711
- useEffect(function () {
16712
- setPrevUrl(document && document.referrer ? document.referrer : '/');
16713
- props.article.Ads = Ads.getRightItems(targeting);
16714
- setActiveArticle(props.article);
16715
- }, [setPrevUrl]);
16716
-
16717
- useEffect(function () {
16718
- setActiveArticle(props.article);
16719
- }, [prevUrl]);
16720
-
16721
- useEffect(function () {
16722
- updateConfig(activeArticle);
16723
- }, [activeArticle]);
16698
+ var preVscroll = 0;
16699
+ var isScrollDown = true;
16724
16700
 
16725
16701
  var scrollDirectionDetect = function scrollDirectionDetect(e) {
16726
16702
  var window = e.currentTarget;
@@ -16738,74 +16714,59 @@ var ArticleQueue = function ArticleQueue(props) {
16738
16714
 
16739
16715
  useEffect(function () {
16740
16716
  window.addEventListener('scroll', scrollDirectionDetect);
16717
+ return function () {
16718
+ return window.removeEventListener('scroll', scrollDirectionDetect);
16719
+ };
16741
16720
  });
16742
16721
 
16743
16722
  var loadmore = function loadmore() {
16744
16723
  var query = props.relatedArticleQuery;
16745
16724
  var params = props.params;
16746
- var data = queueData.map(function (item) {
16747
- return item;
16748
- });
16749
- if (data && data.length < maxListLength) {
16750
- params.index = data.length - 1;
16725
+ if (queueData && queueData.length < maxListLength) {
16726
+ params.index = queueData.length - 1;
16751
16727
  props.client.fetch(query, params).then(function (article) {
16752
16728
  if (article && article._id) {
16753
- var _targeting2 = getTargeting(article);
16754
- article.Ads = props.Ads.getRightItems(_targeting2);
16755
- data.push(article);
16756
- setQueueData(data);
16729
+ var targeting = getTargeting(article);
16730
+ article.Ads = Ads.getRightItems(targeting);
16731
+ setQueueData([].concat(_toConsumableArray(queueData), [article]));
16757
16732
  }
16758
16733
  });
16759
16734
  }
16760
16735
  };
16761
16736
 
16762
- var refreshAdd = function refreshAdd(path) {
16763
- var article = queueData.find(function (item) {
16764
- return item.url.current === path;
16765
- });
16766
- var targeting = getTargeting(article);
16767
- console.log('Forced Ad refresh', targeting);
16768
- article.Ads = Ads.getRightItems(targeting);
16769
- setActiveArticle(article);
16770
- };
16771
-
16772
16737
  var changeUrl = function changeUrl(path, visibility) {
16773
16738
  var newPath = '/view/' + path;
16774
16739
  if (!isScrollDown) {
16775
16740
  if (visibility === 'top') {
16776
- // Router.push('/view/[url]', newPath, { shallow: true })
16741
+ // router.push('/view/[url]', newPath, { shallow: true })
16777
16742
  window.history.pushState({ page: path }, path, newPath);
16778
16743
  if (props.pageview) {
16779
16744
  props.pageview(newPath);
16780
16745
  }
16781
- refreshAdd(path);
16746
+ refreshAD(path);
16782
16747
  }
16783
16748
  } else {
16784
16749
  if (visibility === 'bottom') {
16785
- // Router.push('/view/[url]', newPath, { shallow: true })
16750
+ // router.push('/view/[url]', newPath, { shallow: true })
16786
16751
  window.history.pushState({ page: path }, path, newPath);
16787
16752
  if (props.pageview) {
16788
16753
  props.pageview(newPath);
16789
16754
  }
16790
- refreshAdd(path);
16755
+ refreshAD(path);
16791
16756
  }
16792
16757
  }
16793
16758
  };
16794
16759
 
16795
- if (prevUrl && prevUrl.length) {
16796
- return React__default.createElement(
16797
- InfiniteScroll,
16798
- { dataLength: queueData.length, next: loadmore, scrollThreshold: 0.8, hasMore: true },
16799
- queueData.map(function (article, index) {
16800
- if (!checkSponseredArticle(article) && Ads.getNativeContextualAD) {
16801
- article.contextualAD = Ads.getNativeContextualAD(getTargeting(article));
16802
- }
16803
- return React__default.createElement(Article, _extends$2({ key: index }, props, { changeUrl: changeUrl, article: article, cpModificationRequired: cpModificationRequired }));
16804
- })
16805
- );
16806
- } else {
16807
- return null;
16808
- }
16760
+ return React__default.createElement(
16761
+ InfiniteScroll,
16762
+ { dataLength: queueData.length, next: loadmore, scrollThreshold: 0.8, hasMore: true },
16763
+ queueData.map(function (article, index) {
16764
+ if (!checkSponseredArticle(article) && Ads.getNativeContextualAD) {
16765
+ article.contextualAD = Ads.getNativeContextualAD(getTargeting(article));
16766
+ }
16767
+ return React__default.createElement(Article, _extends$2({ key: index }, props, { changeUrl: changeUrl, article: article, cpModificationRequired: cpModificationRequired }));
16768
+ })
16769
+ );
16809
16770
  };
16810
16771
 
16811
16772
  var KMTracker = function KMTracker(props) {
@@ -2,7 +2,7 @@ import { c as createCommonjsModule, u as unwrapExports } from './_commonjsHelper
2
2
  import { b as _core, c as _export, d as _fails, a as _toObject, e as _objectDp, f as _descriptors, g as _uid, h as _isObject, i as _has, _ as _objectKeys, j as _cof, k as _objectKeysInternal, l as _enumBugKeys, m as _toIobject, n as _toPrimitive, o as _ie8DomDefine, p as _propertyDesc, q as _global, r as _shared, s as _hide, t as _anObject, u as _ctx } from './_to-object-b9b796ec.js';
3
3
  import { _ as _objectGpo, a as _wks, b as _redefine, c as _setToStringTag, d as _objectCreate } from './web.dom.iterable-7e9bebf9.js';
4
4
  import { f as _library } from './debounce-702eb224.js';
5
- import { a as _objectGops, b as _objectPie } from './extends-dbbe308d.js';
5
+ import { b as _objectGops, c as _objectPie } from './extends-26d3b609.js';
6
6
 
7
7
  // most Object methods by ES6 should accept primitives
8
8
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mjhls/mjh-framework",
3
- "version": "1.0.324",
3
+ "version": "1.0.325",
4
4
  "description": "Foundation Framework",
5
5
  "author": "mjh-framework",
6
6
  "license": "MIT",