@mjhls/mjh-framework 1.0.324 → 1.0.326

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (30) hide show
  1. package/README.md +1 -1
  2. package/dist/cjs/DeckContent.js +2 -2
  3. package/dist/cjs/DeckQueue.js +2 -2
  4. package/dist/cjs/{GridContent-139bbe70.js → GridContent-9f212ec5.js} +2 -2
  5. package/dist/cjs/GridContent.js +3 -3
  6. package/dist/cjs/MasterDeck.js +2 -2
  7. package/dist/cjs/{Normal-e7423a52.js → Normal-c85aee96.js} +3 -1
  8. package/dist/cjs/QueueDeckExpanded.js +1 -1
  9. package/dist/cjs/{TaxonomyCard-d8eed035.js → TaxonomyCard-e36602e8.js} +1 -1
  10. package/dist/cjs/TaxonomyCard.js +2 -2
  11. package/dist/cjs/TemplateNormal.js +1 -1
  12. package/dist/cjs/VideoSeriesListing.js +2 -2
  13. package/dist/cjs/{extends-e94dbea5.js → extends-4c2285ff.js} +2 -1
  14. package/dist/cjs/index.js +242 -261
  15. package/dist/cjs/{inherits-37d5840f.js → inherits-7548e3e8.js} +1 -1
  16. package/dist/esm/DeckContent.js +2 -2
  17. package/dist/esm/DeckQueue.js +2 -2
  18. package/dist/esm/{GridContent-ceb53300.js → GridContent-13be42a1.js} +2 -2
  19. package/dist/esm/GridContent.js +3 -3
  20. package/dist/esm/MasterDeck.js +2 -2
  21. package/dist/esm/{Normal-ff7a10ab.js → Normal-cbddc3c0.js} +3 -1
  22. package/dist/esm/QueueDeckExpanded.js +1 -1
  23. package/dist/esm/{TaxonomyCard-35127639.js → TaxonomyCard-89325080.js} +1 -1
  24. package/dist/esm/TaxonomyCard.js +2 -2
  25. package/dist/esm/TemplateNormal.js +1 -1
  26. package/dist/esm/VideoSeriesListing.js +2 -2
  27. package/dist/esm/{extends-dbbe308d.js → extends-26d3b609.js} +2 -2
  28. package/dist/esm/index.js +244 -263
  29. package/dist/esm/{inherits-cb536901.js → inherits-4b85034c.js} +1 -1
  30. package/package.json +1 -1
package/dist/cjs/index.js CHANGED
@@ -10,8 +10,8 @@ require('./web.dom.iterable-8b02d65e.js');
10
10
  var debounce = require('./debounce-528ad412.js');
11
11
  var main = require('./main-987c23c6.js');
12
12
  var toConsumableArray = require('./toConsumableArray-34b5e9a7.js');
13
- var _extends$2 = require('./extends-e94dbea5.js');
14
- var inherits$2 = require('./inherits-37d5840f.js');
13
+ var _extends$2 = require('./extends-4c2285ff.js');
14
+ var inherits$2 = require('./inherits-7548e3e8.js');
15
15
  var React = require('react');
16
16
  var React__default = _interopDefault(React);
17
17
  var PropTypes = _interopDefault(require('prop-types'));
@@ -33,11 +33,11 @@ require('./promise-3b44b2a3.js');
33
33
  require('./ADInfeed-b042a194.js');
34
34
  var DeckContent = require('./DeckContent.js');
35
35
  var get$1 = require('./get-3b23d857.js');
36
- var GridContent = require('./GridContent-139bbe70.js');
36
+ var GridContent = require('./GridContent-9f212ec5.js');
37
37
  var DeckQueue = require('./DeckQueue.js');
38
38
  require('react-bootstrap/Media');
39
39
  var ThumbnailCard = require('./ThumbnailCard.js');
40
- var TaxonomyCard = require('./TaxonomyCard-d8eed035.js');
40
+ var TaxonomyCard = require('./TaxonomyCard-e36602e8.js');
41
41
  require('./react-social-icons-cd0d9d3b.js');
42
42
  var smoothscroll = require('./smoothscroll-95231a70.js');
43
43
  var GroupDeck = require('./GroupDeck.js');
@@ -53,7 +53,7 @@ var IssueDeck = require('./IssueDeck.js');
53
53
  require('react-bootstrap/Badge');
54
54
  var IssueContentDeck = require('./IssueContentDeck.js');
55
55
  var Spinner = _interopDefault(require('react-bootstrap/Spinner'));
56
- var TemplateNormal = require('./Normal-e7423a52.js');
56
+ var TemplateNormal = require('./Normal-c85aee96.js');
57
57
  require('react-bootstrap/ListGroup');
58
58
  var Head = _interopDefault(require('next/head'));
59
59
  var Accordion = _interopDefault(require('react-bootstrap/Accordion'));
@@ -2844,7 +2844,9 @@ var AD300x250 = function AD300x250(_ref) {
2844
2844
  document_group: targeting.document_group,
2845
2845
  document_url: targeting.document_url,
2846
2846
  pos: pos,
2847
- campaign_id: targeting.campaign_id
2847
+ campaign_id: targeting.campaign_id,
2848
+ issue_url: targeting.issue_url,
2849
+ publication_url: targeting.publication_url
2848
2850
  };
2849
2851
 
2850
2852
  var browserSizes = [[300, 250], [300, 100]];
@@ -2874,7 +2876,9 @@ var AD300x250x600 = function AD300x250x600(_ref) {
2874
2876
  document_group: targeting.document_group,
2875
2877
  document_url: targeting.document_url,
2876
2878
  pos: pos,
2877
- campaign_id: targeting.campaign_id
2879
+ campaign_id: targeting.campaign_id,
2880
+ issue_url: targeting.issue_url,
2881
+ publication_url: targeting.publication_url
2878
2882
  };
2879
2883
 
2880
2884
  var browserSizes = [[300, 250], [300, 600], [300, 100]];
@@ -2954,7 +2958,9 @@ var ADFloatingFooter = function ADFloatingFooter(_ref) {
2954
2958
  document_group: targeting.document_group,
2955
2959
  document_url: targeting.document_url,
2956
2960
  pos: position,
2957
- campaign_id: targeting.campaign_id
2961
+ campaign_id: targeting.campaign_id,
2962
+ issue_url: targeting.issue_url,
2963
+ publication_url: targeting.publication_url
2958
2964
  };
2959
2965
 
2960
2966
  var _useState = React.useState(true),
@@ -3037,7 +3043,9 @@ var ADGutter = function ADGutter(_ref) {
3037
3043
  document_group: targeting.document_group,
3038
3044
  document_url: targeting.document_url,
3039
3045
  pos: position,
3040
- campaign_id: targeting.campaign_id
3046
+ campaign_id: targeting.campaign_id,
3047
+ issue_url: targeting.issue_url,
3048
+ publication_url: targeting.publication_url
3041
3049
  };
3042
3050
 
3043
3051
  var _useState = React.useState(false),
@@ -3095,7 +3103,9 @@ var ADWelcome = function ADWelcome(_ref) {
3095
3103
  document_group: targeting.document_group,
3096
3104
  document_url: targeting.document_url,
3097
3105
  pos: position,
3098
- campaign_id: targeting.campaign_id
3106
+ campaign_id: targeting.campaign_id,
3107
+ issue_url: targeting.issue_url,
3108
+ publication_url: targeting.publication_url
3099
3109
  };
3100
3110
 
3101
3111
  var calculateTimeLeft = function calculateTimeLeft(timeLeft) {
@@ -3204,7 +3214,9 @@ var ADSponsoredResources = function ADSponsoredResources(_ref) {
3204
3214
  document_group: targeting.document_group,
3205
3215
  document_url: targeting.document_url,
3206
3216
  pos: position,
3207
- campaign_id: targeting.campaign_id
3217
+ campaign_id: targeting.campaign_id,
3218
+ issue_url: targeting.issue_url,
3219
+ publication_url: targeting.publication_url
3208
3220
  };
3209
3221
 
3210
3222
  return React__default.createElement(
@@ -16189,16 +16201,18 @@ var InscreenSensor = function (_React$Component) {
16189
16201
  }(React__default.Component);
16190
16202
 
16191
16203
  var renderAuthor = function renderAuthor(authorName, authorURL, index, length) {
16192
- if (authorName && authorURL) return React__default.createElement(
16193
- Link,
16194
- { href: '/authors/' + authorURL.current, key: index },
16195
- React__default.createElement(
16196
- 'a',
16197
- null,
16198
- authorName,
16199
- length !== index + 1 && React__default.createElement('br', null)
16200
- )
16201
- );else if (authorName) {
16204
+ if (authorName && authorURL) {
16205
+ return React__default.createElement(
16206
+ Link,
16207
+ { href: '/authors/' + authorURL.current, key: index },
16208
+ React__default.createElement(
16209
+ 'a',
16210
+ null,
16211
+ authorName,
16212
+ length !== index + 1 && React__default.createElement('br', null)
16213
+ )
16214
+ );
16215
+ } else if (authorName) {
16202
16216
  return React__default.createElement(
16203
16217
  'span',
16204
16218
  { key: index },
@@ -16222,17 +16236,41 @@ var get_content_placement_url = function get_content_placement_url(cp) {
16222
16236
  return cp_url;
16223
16237
  };
16224
16238
 
16239
+ var getArticleSummary = function getArticleSummary(article) {
16240
+ if (article.summary && article.summary.length > 0) {
16241
+ return article.summary;
16242
+ } else {
16243
+ var _article$body = article.body,
16244
+ body = _article$body === undefined ? [] : _article$body;
16245
+
16246
+ var desc = '';
16247
+ body.some(function (children) {
16248
+ children.children && children.children.some(function (item) {
16249
+ if (item.text && String(item.text).trim().length > 0 && desc === '') {
16250
+ desc = String(item.text);
16251
+ return true;
16252
+ }
16253
+ });
16254
+ if (desc !== '') {
16255
+ return true;
16256
+ }
16257
+ });
16258
+ return desc;
16259
+ }
16260
+ };
16261
+
16225
16262
  var Article = function Article(props) {
16226
16263
  var client = props.client,
16227
16264
  pageview = props.pageview,
16228
16265
  videoAccountIDs = props.videoAccountIDs,
16266
+ drupalLeadSettings = props.drupalLeadSettings,
16229
16267
  _props$article = props.article,
16230
16268
  title = _props$article.title,
16231
16269
  passwordLock = _props$article.passwordLock,
16232
16270
  authorDetails = _props$article.authorDetails,
16271
+ pageNumber = _props$article.pageNumber,
16233
16272
  published = _props$article.published,
16234
16273
  articleBody = _props$article.body,
16235
- summary = _props$article.summary,
16236
16274
  thumbnail = _props$article.thumbnail,
16237
16275
  content_placement = _props$article.content_placement,
16238
16276
  _props$article$url = _props$article.url;
@@ -16249,6 +16287,8 @@ var Article = function Article(props) {
16249
16287
  cpModificationRequired = props.cpModificationRequired;
16250
16288
 
16251
16289
 
16290
+ var summary = getArticleSummary(props.article);
16291
+
16252
16292
  var urlFor = function urlFor(source) {
16253
16293
  return index.imageUrlBuilder(client).image(source);
16254
16294
  };
@@ -16274,70 +16314,119 @@ var Article = function Article(props) {
16274
16314
  return null;
16275
16315
  };
16276
16316
 
16277
- var shareVia = shareOptions.shareVia,
16278
- shareSubject = shareOptions.shareSubject,
16279
- twitterSiteName = shareOptions.twitterSiteName,
16280
- shareImageDefault = shareOptions.shareImageDefault,
16281
- shareSiteTitle = shareOptions.shareSiteTitle;
16282
-
16283
- var shareUrl = shareOptions.shareBaseUrl + props.url;
16284
- var shareTitle = title;
16285
- var shareSummary = summary;
16286
- var shareImage = thumbnail && thumbnail.asset ? urlFor(thumbnail.asset).url() : shareImageDefault;
16287
- var siteName = props.website.title;
16317
+ var renderRelevantTopicsDropdown = function renderRelevantTopicsDropdown() {
16318
+ if (content_placement && content_placement.length > 0) {
16319
+ return React__default.createElement(
16320
+ Dropdown,
16321
+ { style: { marginBottom: '1rem' } },
16322
+ React__default.createElement(
16323
+ Dropdown.Toggle,
16324
+ { variant: 'primary', id: 'partner-dropdown' },
16325
+ 'Relevant Topics'
16326
+ ),
16327
+ React__default.createElement(
16328
+ Dropdown.Menu,
16329
+ null,
16330
+ content_placement.length > 0 ? content_placement.map(function (cp, index) {
16331
+ var cp_url = cpModificationRequired ? get_content_placement_url(cp) : cp.path;
16332
+ var href = '/' + cp_url;
16333
+ return React__default.createElement(
16334
+ Dropdown.Item,
16335
+ { key: index, href: href },
16336
+ cp.name
16337
+ );
16338
+ }) : null
16339
+ )
16340
+ );
16341
+ }
16342
+ return null;
16343
+ };
16288
16344
 
16289
- //Native Ads
16290
- var findIndex = function findIndex(arr) {
16291
- var indexes = [];
16292
- var _iteratorNormalCompletion = true;
16293
- var _didIteratorError = false;
16294
- var _iteratorError = undefined;
16345
+ var renderBlockContent = function renderBlockContent(payload) {
16346
+ var _payload = payload,
16347
+ body = _payload.body;
16295
16348
 
16296
- try {
16297
- for (var _iterator = slicedToArray._getIterator(arr), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
16298
- var ele = _step.value;
16349
+ var findIndex = function findIndex(arr) {
16350
+ var indexes = [];
16351
+ var _iteratorNormalCompletion = true;
16352
+ var _didIteratorError = false;
16353
+ var _iteratorError = undefined;
16299
16354
 
16300
- if (ele['_type'] === 'block' && ele.children.some(function (child) {
16301
- return child.text.trim().length > 0;
16302
- }) && ele['listItem'] != 'bullet' && ele['style'] === 'normal') {
16303
- indexes.push(arr.indexOf(ele));
16304
- }
16305
- }
16306
- } catch (err) {
16307
- _didIteratorError = true;
16308
- _iteratorError = err;
16309
- } finally {
16310
16355
  try {
16311
- if (!_iteratorNormalCompletion && _iterator.return) {
16312
- _iterator.return();
16356
+ for (var _iterator = slicedToArray._getIterator(arr), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
16357
+ var ele = _step.value;
16358
+
16359
+ if (ele['_type'] === 'block' && ele.children.some(function (child) {
16360
+ return child.text.trim().length > 0;
16361
+ }) && ele['listItem'] !== 'bullet' && ele['style'] === 'normal') {
16362
+ indexes.push(arr.indexOf(ele));
16363
+ }
16313
16364
  }
16365
+ } catch (err) {
16366
+ _didIteratorError = true;
16367
+ _iteratorError = err;
16314
16368
  } finally {
16315
- if (_didIteratorError) {
16316
- throw _iteratorError;
16369
+ try {
16370
+ if (!_iteratorNormalCompletion && _iterator.return) {
16371
+ _iterator.return();
16372
+ }
16373
+ } finally {
16374
+ if (_didIteratorError) {
16375
+ throw _iteratorError;
16376
+ }
16317
16377
  }
16318
16378
  }
16319
- }
16320
16379
 
16321
- return indexes;
16380
+ return indexes;
16381
+ };
16382
+ var indexes = findIndex(body);
16383
+ if (indexes.length >= 2 && body.length > 3 && payload.contextualAD) {
16384
+ payload = _extends$2._extends({}, payload, {
16385
+ contextualAD: _extends$2._extends({}, payload.contextualAD, {
16386
+ slotId: (payload.contextualAD.slotId || 'native-ad') + '-' + payload._id
16387
+ })
16388
+ });
16389
+ var selectedIndex = indexes[1] + 1;
16390
+ return React__default.createElement(
16391
+ React__default.Fragment,
16392
+ null,
16393
+ React__default.createElement(TaxonomyCard.BlockContent, _extends$2._extends({
16394
+ serializers: getSerializers(client, pageview, videoAccountIDs, function () {}, true, drupalLeadSettings),
16395
+ blocks: [].concat(toConsumableArray._toConsumableArray(body.slice(0, selectedIndex))),
16396
+ imageOptions: { w: 320, h: 240, fit: 'max' }
16397
+ }, client.config())),
16398
+ React__default.createElement(
16399
+ 'div',
16400
+ { className: 'contextual-native-ad' },
16401
+ React__default.createElement(AdSlot.DFPAdSlot, _extends$2._extends({}, payload.contextualAD, { refreshFlag: false }))
16402
+ ),
16403
+ React__default.createElement(TaxonomyCard.BlockContent, _extends$2._extends({
16404
+ serializers: getSerializers(client, pageview, videoAccountIDs, function () {}, true, drupalLeadSettings),
16405
+ blocks: [].concat(toConsumableArray._toConsumableArray(body.slice(selectedIndex))),
16406
+ imageOptions: { w: 320, h: 240, fit: 'max' }
16407
+ }, client.config()))
16408
+ );
16409
+ } else {
16410
+ return React__default.createElement(TaxonomyCard.BlockContent, _extends$2._extends({
16411
+ serializers: getSerializers(client, pageview, videoAccountIDs, function () {}, true, drupalLeadSettings),
16412
+ blocks: articleBody,
16413
+ imageOptions: { w: 320, h: 240, fit: 'max' }
16414
+ }, client.config()));
16415
+ }
16322
16416
  };
16323
16417
 
16324
- var insert = function insert(arr, index, newElement) {
16325
- return [].concat(toConsumableArray._toConsumableArray(arr.slice(0, index)), [newElement], toConsumableArray._toConsumableArray(arr.slice(index)));
16326
- };
16327
- var newBody = [];
16328
- if (props.article.contextualAD) {
16329
- var indexes = findIndex(articleBody);
16418
+ var shareVia = shareOptions.shareVia,
16419
+ shareSubject = shareOptions.shareSubject,
16420
+ twitterSiteName = shareOptions.twitterSiteName,
16421
+ shareImageDefault = shareOptions.shareImageDefault,
16422
+ shareBaseUrl = shareOptions.shareBaseUrl,
16423
+ shareSiteTitle = shareOptions.shareSiteTitle;
16330
16424
 
16331
- if (indexes.length >= 2 && articleBody.length > 3) {
16332
- var setIndex = indexes[1];
16333
- newBody = insert(articleBody, setIndex + 1, props.article.contextualAD);
16334
- } else {
16335
- newBody = articleBody;
16336
- }
16337
- } else {
16338
- newBody = articleBody;
16339
- }
16340
- //End Native Ads
16425
+ var shareUrl = shareBaseUrl + props.url;
16426
+ var shareTitle = title;
16427
+ var shareSummary = summary;
16428
+ var shareImage = thumbnail && thumbnail.asset ? urlFor(thumbnail.asset).url() : shareImageDefault;
16429
+ var siteName = props.website.title;
16341
16430
 
16342
16431
  return React__default.createElement(
16343
16432
  React__default.Fragment,
@@ -16362,6 +16451,7 @@ var Article = function Article(props) {
16362
16451
  null,
16363
16452
  shareTitle + ' | ' + props.cache.siteSettingCache.name
16364
16453
  ),
16454
+ passwordLock && React__default.createElement('meta', { name: 'robots', content: 'noindex, nofollow' }),
16365
16455
  React__default.createElement('meta', { property: 'og:url', content: shareUrl }),
16366
16456
  React__default.createElement('meta', { property: 'og:title', content: shareTitle }),
16367
16457
  React__default.createElement('meta', { property: 'og:image', content: shareImage }),
@@ -16373,11 +16463,6 @@ var Article = function Article(props) {
16373
16463
  React__default.createElement('meta', { name: 'twitter:site', content: '@' + shareSiteTitle }),
16374
16464
  React__default.createElement('meta', { name: 'twitter:description', content: shareSummary })
16375
16465
  ),
16376
- React__default.createElement(
16377
- Head,
16378
- null,
16379
- passwordLock && React__default.createElement('meta', { name: 'robots', content: 'noindex, nofollow' })
16380
- ),
16381
16466
  React__default.createElement(
16382
16467
  'h1',
16383
16468
  { className: 'page-title' },
@@ -16410,7 +16495,7 @@ var Article = function Article(props) {
16410
16495
  issue.articleSource && React__default.createElement(
16411
16496
  'p',
16412
16497
  null,
16413
- 'Source: ' + issue.articleSource
16498
+ issue.articleSource
16414
16499
  )
16415
16500
  ),
16416
16501
  React__default.createElement(
@@ -16432,6 +16517,11 @@ var Article = function Article(props) {
16432
16517
  )
16433
16518
  )
16434
16519
  )
16520
+ ),
16521
+ pageNumber && React__default.createElement(
16522
+ 'div',
16523
+ { className: 'article-pageNumber' },
16524
+ 'Page Number: ' + pageNumber
16435
16525
  )
16436
16526
  ),
16437
16527
  React__default.createElement(
@@ -16449,28 +16539,7 @@ var Article = function Article(props) {
16449
16539
  twitterSiteName: twitterSiteName
16450
16540
  })
16451
16541
  ),
16452
- content_placement && content_placement.length > 0 && React__default.createElement(
16453
- Dropdown,
16454
- { style: { marginBottom: '1rem' } },
16455
- React__default.createElement(
16456
- Dropdown.Toggle,
16457
- { variant: 'primary', id: 'partner-dropdown' },
16458
- 'Relevant Topics'
16459
- ),
16460
- React__default.createElement(
16461
- Dropdown.Menu,
16462
- null,
16463
- content_placement.length > 0 ? content_placement.map(function (cp, index) {
16464
- var cp_url = cpModificationRequired ? get_content_placement_url(cp) : cp.path;
16465
- var href = '/' + cp_url;
16466
- return React__default.createElement(
16467
- Dropdown.Item,
16468
- { key: index, href: href },
16469
- cp.name
16470
- );
16471
- }) : null
16472
- )
16473
- ),
16542
+ renderRelevantTopicsDropdown(),
16474
16543
  React__default.createElement(
16475
16544
  'p',
16476
16545
  null,
@@ -16483,7 +16552,7 @@ var Article = function Article(props) {
16483
16552
  React__default.createElement('br', null)
16484
16553
  ),
16485
16554
  main.main_39 && props.article.Ads.map(function (ad, index) {
16486
- if (index == 0) {
16555
+ if (index === 0) {
16487
16556
  return React__default.createElement(
16488
16557
  'div',
16489
16558
  { key: index, id: 'addid-' + index, style: { display: 'flex', flex: '1 0 auto', marginTop: '-1rem', marginBottom: '1rem' } },
@@ -16494,11 +16563,7 @@ var Article = function Article(props) {
16494
16563
  React__default.createElement(
16495
16564
  'div',
16496
16565
  { className: 'block-content' },
16497
- React__default.createElement(TaxonomyCard.BlockContent, _extends$2._extends({
16498
- serializers: getSerializers(client, pageview, videoAccountIDs, function () {}, true),
16499
- blocks: newBody,
16500
- imageOptions: { w: 320, h: 240, fit: 'max' }
16501
- }, client.config())),
16566
+ renderBlockContent(props.article),
16502
16567
  issue && issue.url && React__default.createElement(
16503
16568
  'a',
16504
16569
  { href: issue.url, target: '_blank', title: 'Download issue' },
@@ -16523,64 +16588,18 @@ var Article = function Article(props) {
16523
16588
  React__default.createElement('hr', { className: 'article-seperater' })
16524
16589
  );
16525
16590
  };
16591
+
16526
16592
  var ArticleQueue = function ArticleQueue(props) {
16527
- var website = props.website,
16593
+ var _props$prevUrl = props.prevUrl,
16594
+ prevUrl = _props$prevUrl === undefined ? '/' : _props$prevUrl,
16528
16595
  Ads = props.Ads,
16529
- mainNavCache = props.mainNavCache,
16530
- subNavCache = props.subNavCache,
16531
- isLiveSite = props.isLiveSite,
16532
- _props$sponsoredTaxon = props.sponsoredTaxonomies,
16533
- sponsoredTaxonomies = _props$sponsoredTaxon === undefined ? [] : _props$sponsoredTaxon,
16534
16596
  _props$maxListLength = props.maxListLength,
16535
16597
  maxListLength = _props$maxListLength === undefined ? 10 : _props$maxListLength,
16598
+ _props$sponsoredTaxon = props.sponsoredTaxonomies,
16599
+ sponsoredTaxonomies = _props$sponsoredTaxon === undefined ? [] : _props$sponsoredTaxon,
16536
16600
  _props$cpModification = props.cpModificationRequired,
16537
16601
  cpModificationRequired = _props$cpModification === undefined ? false : _props$cpModification;
16538
16602
 
16539
- var _useState = React.useState(''),
16540
- _useState2 = slicedToArray._slicedToArray(_useState, 2),
16541
- prevUrl = _useState2[0],
16542
- setPrevUrl = _useState2[1];
16543
-
16544
- var _useState3 = React.useState([props.article]),
16545
- _useState4 = slicedToArray._slicedToArray(_useState3, 2),
16546
- queueData = _useState4[0],
16547
- setQueueData = _useState4[1];
16548
-
16549
- var _useState5 = React.useState({}),
16550
- _useState6 = slicedToArray._slicedToArray(_useState5, 2),
16551
- activeArticle = _useState6[0],
16552
- setActiveArticle = _useState6[1];
16553
-
16554
- var preVscroll = 0;
16555
- var isScrollDown = true;
16556
-
16557
- var _activeArticle$title = activeArticle.title,
16558
- _activeArticle$summar = activeArticle.summary,
16559
- summary = _activeArticle$summar === undefined ? '' : _activeArticle$summar;
16560
-
16561
-
16562
- var getFirstLine = function getFirstLine(article) {
16563
- var _article$body = article.body,
16564
- body = _article$body === undefined ? [] : _article$body;
16565
-
16566
- var desc = '';
16567
- body.some(function (children) {
16568
- children.children && children.children.some(function (item) {
16569
- if (item.text && String(item.text).trim().length > 0 && desc == '') {
16570
- desc = String(item.text);
16571
- return true;
16572
- }
16573
- });
16574
- if (desc !== '') {
16575
- return true;
16576
- }
16577
- });
16578
- return desc;
16579
- };
16580
-
16581
- if (summary.length === 0) {
16582
- summary = getFirstLine(activeArticle);
16583
- }
16584
16603
 
16585
16604
  var getTargeting = function getTargeting(article) {
16586
16605
  var _article$internalTag = article.internalTag,
@@ -16640,31 +16659,51 @@ var ArticleQueue = function ArticleQueue(props) {
16640
16659
  document_url: [url],
16641
16660
  content_placement: content_placement_urls
16642
16661
  };
16662
+
16663
+ if (article.issue && article.issue.path) {
16664
+ targeting.issue_url = [article.issue.path];
16665
+ if (article.issue.publication && article.issue.publication.path) {
16666
+ targeting.publication_url = [article.issue.publication.path];
16667
+ }
16668
+ }
16669
+
16643
16670
  return targeting;
16644
16671
  };
16645
16672
 
16646
- var _useState7 = React.useState(getTargeting(activeArticle)),
16647
- _useState8 = slicedToArray._slicedToArray(_useState7, 2),
16648
- targeting = _useState8[0],
16649
- setTargeting = _useState8[1];
16650
-
16651
- var keywords = targeting && targeting.keywords ? targeting.keywords : [];
16652
-
16653
- var config = {
16654
- navComponent: website.navigation,
16655
- navItems: mainNavCache,
16656
- columns: '3',
16657
- leftItems: subNavCache,
16658
- rightItems: [],
16659
- horizontalAD: {},
16660
- isLiveSite: isLiveSite
16673
+ var firstArticle = function firstArticle() {
16674
+ var article = _extends$2._Object$assign({}, props.article);
16675
+ var targeting = getTargeting(props.article);
16676
+ article.Ads = Ads.getRightItems(targeting);
16677
+ return article;
16661
16678
  };
16662
- props.article.Ads = Ads.getRightItems(targeting);
16663
16679
 
16664
- var _useState9 = React.useState(config),
16665
- _useState10 = slicedToArray._slicedToArray(_useState9, 2),
16666
- pageConfig = _useState10[0],
16667
- setPageConfig = _useState10[1];
16680
+ var _useState = React.useState([firstArticle()]),
16681
+ _useState2 = slicedToArray._slicedToArray(_useState, 2),
16682
+ queueData = _useState2[0],
16683
+ setQueueData = _useState2[1];
16684
+
16685
+ var refreshAD = function refreshAD(path) {
16686
+ if (!main.main_39) {
16687
+ var activeArticle = queueData.find(function (item) {
16688
+ return item.url.current === path;
16689
+ });
16690
+ var targeting = getTargeting(activeArticle);
16691
+ debounce.lib_3.getGoogletag().then(function (googletag) {
16692
+ if (window.googletag && googletag.pubadsReady) {
16693
+ var slots = googletag.pubads().getSlots();
16694
+ slots.forEach(function (slot) {
16695
+ var pos = slot.getTargeting('pos');
16696
+ slot.clearTargeting();
16697
+ _Object$keys(targeting).forEach(function (key) {
16698
+ slot.setTargeting(key, targeting[key]);
16699
+ });
16700
+ slot.setTargeting('pos', pos);
16701
+ });
16702
+ debounce.lib_3.refresh();
16703
+ }
16704
+ });
16705
+ }
16706
+ };
16668
16707
 
16669
16708
  var checkSponseredArticle = function checkSponseredArticle(article) {
16670
16709
  var _article$taxonomyMapp = article.taxonomyMapping,
@@ -16679,51 +16718,8 @@ var ArticleQueue = function ArticleQueue(props) {
16679
16718
  }
16680
16719
  };
16681
16720
 
16682
- var updateConfig = function updateConfig(article) {
16683
- if (prevUrl && prevUrl.length) {
16684
- var _targeting = getTargeting(article);
16685
- var _config = {
16686
- navComponent: website.navigation,
16687
- navItems: mainNavCache,
16688
- columns: '3',
16689
- leftItems: subNavCache,
16690
- rightItems: checkSponseredArticle(article) ? [] : Ads.getRightItems(_targeting),
16691
- horizontalAD: checkSponseredArticle(article) ? {} : Ads.getHorizontal(_targeting),
16692
- isLiveSite: isLiveSite
16693
- };
16694
- setPageConfig(_config);
16695
- if (!main.main_39) {
16696
- debounce.lib_3.getGoogletag().then(function (googletag) {
16697
- if (window.googletag && googletag.pubadsReady) {
16698
- var slots = googletag.pubads().getSlots();
16699
- slots.forEach(function (slot) {
16700
- var pos = slot.getTargeting('pos');
16701
- slot.clearTargeting();
16702
- _Object$keys(_targeting).forEach(function (key) {
16703
- slot.setTargeting(key, _targeting[key]);
16704
- });
16705
- slot.setTargeting('pos', pos);
16706
- });
16707
- debounce.lib_3.refresh();
16708
- }
16709
- });
16710
- }
16711
- }
16712
- };
16713
-
16714
- React.useEffect(function () {
16715
- setPrevUrl(document && document.referrer ? document.referrer : '/');
16716
- props.article.Ads = Ads.getRightItems(targeting);
16717
- setActiveArticle(props.article);
16718
- }, [setPrevUrl]);
16719
-
16720
- React.useEffect(function () {
16721
- setActiveArticle(props.article);
16722
- }, [prevUrl]);
16723
-
16724
- React.useEffect(function () {
16725
- updateConfig(activeArticle);
16726
- }, [activeArticle]);
16721
+ var preVscroll = 0;
16722
+ var isScrollDown = true;
16727
16723
 
16728
16724
  var scrollDirectionDetect = function scrollDirectionDetect(e) {
16729
16725
  var window = e.currentTarget;
@@ -16741,74 +16737,59 @@ var ArticleQueue = function ArticleQueue(props) {
16741
16737
 
16742
16738
  React.useEffect(function () {
16743
16739
  window.addEventListener('scroll', scrollDirectionDetect);
16740
+ return function () {
16741
+ return window.removeEventListener('scroll', scrollDirectionDetect);
16742
+ };
16744
16743
  });
16745
16744
 
16746
16745
  var loadmore = function loadmore() {
16747
16746
  var query = props.relatedArticleQuery;
16748
16747
  var params = props.params;
16749
- var data = queueData.map(function (item) {
16750
- return item;
16751
- });
16752
- if (data && data.length < maxListLength) {
16753
- params.index = data.length - 1;
16748
+ if (queueData && queueData.length < maxListLength) {
16749
+ params.index = queueData.length - 1;
16754
16750
  props.client.fetch(query, params).then(function (article) {
16755
16751
  if (article && article._id) {
16756
- var _targeting2 = getTargeting(article);
16757
- article.Ads = props.Ads.getRightItems(_targeting2);
16758
- data.push(article);
16759
- setQueueData(data);
16752
+ var targeting = getTargeting(article);
16753
+ article.Ads = Ads.getRightItems(targeting);
16754
+ setQueueData([].concat(toConsumableArray._toConsumableArray(queueData), [article]));
16760
16755
  }
16761
16756
  });
16762
16757
  }
16763
16758
  };
16764
16759
 
16765
- var refreshAdd = function refreshAdd(path) {
16766
- var article = queueData.find(function (item) {
16767
- return item.url.current === path;
16768
- });
16769
- var targeting = getTargeting(article);
16770
- console.log('Forced Ad refresh', targeting);
16771
- article.Ads = Ads.getRightItems(targeting);
16772
- setActiveArticle(article);
16773
- };
16774
-
16775
16760
  var changeUrl = function changeUrl(path, visibility) {
16776
16761
  var newPath = '/view/' + path;
16777
16762
  if (!isScrollDown) {
16778
16763
  if (visibility === 'top') {
16779
- // Router.push('/view/[url]', newPath, { shallow: true })
16764
+ // router.push('/view/[url]', newPath, { shallow: true })
16780
16765
  window.history.pushState({ page: path }, path, newPath);
16781
16766
  if (props.pageview) {
16782
16767
  props.pageview(newPath);
16783
16768
  }
16784
- refreshAdd(path);
16769
+ refreshAD(path);
16785
16770
  }
16786
16771
  } else {
16787
16772
  if (visibility === 'bottom') {
16788
- // Router.push('/view/[url]', newPath, { shallow: true })
16773
+ // router.push('/view/[url]', newPath, { shallow: true })
16789
16774
  window.history.pushState({ page: path }, path, newPath);
16790
16775
  if (props.pageview) {
16791
16776
  props.pageview(newPath);
16792
16777
  }
16793
- refreshAdd(path);
16778
+ refreshAD(path);
16794
16779
  }
16795
16780
  }
16796
16781
  };
16797
16782
 
16798
- if (prevUrl && prevUrl.length) {
16799
- return React__default.createElement(
16800
- visibilitySensor.InfiniteScroll,
16801
- { dataLength: queueData.length, next: loadmore, scrollThreshold: 0.8, hasMore: true },
16802
- queueData.map(function (article, index) {
16803
- if (!checkSponseredArticle(article) && Ads.getNativeContextualAD) {
16804
- article.contextualAD = Ads.getNativeContextualAD(getTargeting(article));
16805
- }
16806
- return React__default.createElement(Article, _extends$2._extends({ key: index }, props, { changeUrl: changeUrl, article: article, cpModificationRequired: cpModificationRequired }));
16807
- })
16808
- );
16809
- } else {
16810
- return null;
16811
- }
16783
+ return React__default.createElement(
16784
+ visibilitySensor.InfiniteScroll,
16785
+ { dataLength: queueData.length, next: loadmore, scrollThreshold: 0.8, hasMore: true },
16786
+ queueData.map(function (article, index) {
16787
+ if (!checkSponseredArticle(article) && Ads.getNativeContextualAD) {
16788
+ article.contextualAD = Ads.getNativeContextualAD(getTargeting(article));
16789
+ }
16790
+ return React__default.createElement(Article, _extends$2._extends({ key: index }, props, { changeUrl: changeUrl, article: article, cpModificationRequired: cpModificationRequired }));
16791
+ })
16792
+ );
16812
16793
  };
16813
16794
 
16814
16795
  var KMTracker = function KMTracker(props) {