@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/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';
@@ -48,8 +48,8 @@ export { default as IssueDeck } from './IssueDeck.js';
48
48
  import 'react-bootstrap/Badge';
49
49
  export { default as IssueContentDeck } from './IssueContentDeck.js';
50
50
  import Spinner from 'react-bootstrap/Spinner';
51
- import { M as MdPictureAsPdf } from './Normal-ff7a10ab.js';
52
- export { A as AD728x90, C as Column1, a as Column2, b as Column3, f as HamMagazine, H as Header, L as LeftNav, e as NavDvm, c as NavMagazine, N as NavNative, d as NavNormal, P as PageFilter, S as Search, g as SideFooter, T as TemplateNormal } from './Normal-ff7a10ab.js';
51
+ import { M as MdPictureAsPdf } from './Normal-cbddc3c0.js';
52
+ export { A as AD728x90, C as Column1, a as Column2, b as Column3, f as HamMagazine, H as Header, L as LeftNav, e as NavDvm, c as NavMagazine, N as NavNative, d as NavNormal, P as PageFilter, S as Search, g as SideFooter, T as TemplateNormal } from './Normal-cbddc3c0.js';
53
53
  import 'react-bootstrap/ListGroup';
54
54
  import Head from 'next/head';
55
55
  import Accordion from 'react-bootstrap/Accordion';
@@ -2841,7 +2841,9 @@ var AD300x250 = function AD300x250(_ref) {
2841
2841
  document_group: targeting.document_group,
2842
2842
  document_url: targeting.document_url,
2843
2843
  pos: pos,
2844
- campaign_id: targeting.campaign_id
2844
+ campaign_id: targeting.campaign_id,
2845
+ issue_url: targeting.issue_url,
2846
+ publication_url: targeting.publication_url
2845
2847
  };
2846
2848
 
2847
2849
  var browserSizes = [[300, 250], [300, 100]];
@@ -2871,7 +2873,9 @@ var AD300x250x600 = function AD300x250x600(_ref) {
2871
2873
  document_group: targeting.document_group,
2872
2874
  document_url: targeting.document_url,
2873
2875
  pos: pos,
2874
- campaign_id: targeting.campaign_id
2876
+ campaign_id: targeting.campaign_id,
2877
+ issue_url: targeting.issue_url,
2878
+ publication_url: targeting.publication_url
2875
2879
  };
2876
2880
 
2877
2881
  var browserSizes = [[300, 250], [300, 600], [300, 100]];
@@ -2951,7 +2955,9 @@ var ADFloatingFooter = function ADFloatingFooter(_ref) {
2951
2955
  document_group: targeting.document_group,
2952
2956
  document_url: targeting.document_url,
2953
2957
  pos: position,
2954
- campaign_id: targeting.campaign_id
2958
+ campaign_id: targeting.campaign_id,
2959
+ issue_url: targeting.issue_url,
2960
+ publication_url: targeting.publication_url
2955
2961
  };
2956
2962
 
2957
2963
  var _useState = useState(true),
@@ -3034,7 +3040,9 @@ var ADGutter = function ADGutter(_ref) {
3034
3040
  document_group: targeting.document_group,
3035
3041
  document_url: targeting.document_url,
3036
3042
  pos: position,
3037
- campaign_id: targeting.campaign_id
3043
+ campaign_id: targeting.campaign_id,
3044
+ issue_url: targeting.issue_url,
3045
+ publication_url: targeting.publication_url
3038
3046
  };
3039
3047
 
3040
3048
  var _useState = useState(false),
@@ -3092,7 +3100,9 @@ var ADWelcome = function ADWelcome(_ref) {
3092
3100
  document_group: targeting.document_group,
3093
3101
  document_url: targeting.document_url,
3094
3102
  pos: position,
3095
- campaign_id: targeting.campaign_id
3103
+ campaign_id: targeting.campaign_id,
3104
+ issue_url: targeting.issue_url,
3105
+ publication_url: targeting.publication_url
3096
3106
  };
3097
3107
 
3098
3108
  var calculateTimeLeft = function calculateTimeLeft(timeLeft) {
@@ -3201,7 +3211,9 @@ var ADSponsoredResources = function ADSponsoredResources(_ref) {
3201
3211
  document_group: targeting.document_group,
3202
3212
  document_url: targeting.document_url,
3203
3213
  pos: position,
3204
- campaign_id: targeting.campaign_id
3214
+ campaign_id: targeting.campaign_id,
3215
+ issue_url: targeting.issue_url,
3216
+ publication_url: targeting.publication_url
3205
3217
  };
3206
3218
 
3207
3219
  return React__default.createElement(
@@ -16186,16 +16198,18 @@ var InscreenSensor = function (_React$Component) {
16186
16198
  }(React__default.Component);
16187
16199
 
16188
16200
  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) {
16201
+ if (authorName && authorURL) {
16202
+ return React__default.createElement(
16203
+ Link,
16204
+ { href: '/authors/' + authorURL.current, key: index },
16205
+ React__default.createElement(
16206
+ 'a',
16207
+ null,
16208
+ authorName,
16209
+ length !== index + 1 && React__default.createElement('br', null)
16210
+ )
16211
+ );
16212
+ } else if (authorName) {
16199
16213
  return React__default.createElement(
16200
16214
  'span',
16201
16215
  { key: index },
@@ -16219,17 +16233,41 @@ var get_content_placement_url = function get_content_placement_url(cp) {
16219
16233
  return cp_url;
16220
16234
  };
16221
16235
 
16236
+ var getArticleSummary = function getArticleSummary(article) {
16237
+ if (article.summary && article.summary.length > 0) {
16238
+ return article.summary;
16239
+ } else {
16240
+ var _article$body = article.body,
16241
+ body = _article$body === undefined ? [] : _article$body;
16242
+
16243
+ var desc = '';
16244
+ body.some(function (children) {
16245
+ children.children && children.children.some(function (item) {
16246
+ if (item.text && String(item.text).trim().length > 0 && desc === '') {
16247
+ desc = String(item.text);
16248
+ return true;
16249
+ }
16250
+ });
16251
+ if (desc !== '') {
16252
+ return true;
16253
+ }
16254
+ });
16255
+ return desc;
16256
+ }
16257
+ };
16258
+
16222
16259
  var Article = function Article(props) {
16223
16260
  var client = props.client,
16224
16261
  pageview = props.pageview,
16225
16262
  videoAccountIDs = props.videoAccountIDs,
16263
+ drupalLeadSettings = props.drupalLeadSettings,
16226
16264
  _props$article = props.article,
16227
16265
  title = _props$article.title,
16228
16266
  passwordLock = _props$article.passwordLock,
16229
16267
  authorDetails = _props$article.authorDetails,
16268
+ pageNumber = _props$article.pageNumber,
16230
16269
  published = _props$article.published,
16231
16270
  articleBody = _props$article.body,
16232
- summary = _props$article.summary,
16233
16271
  thumbnail = _props$article.thumbnail,
16234
16272
  content_placement = _props$article.content_placement,
16235
16273
  _props$article$url = _props$article.url;
@@ -16246,6 +16284,8 @@ var Article = function Article(props) {
16246
16284
  cpModificationRequired = props.cpModificationRequired;
16247
16285
 
16248
16286
 
16287
+ var summary = getArticleSummary(props.article);
16288
+
16249
16289
  var urlFor = function urlFor(source) {
16250
16290
  return imageUrlBuilder(client).image(source);
16251
16291
  };
@@ -16271,70 +16311,119 @@ var Article = function Article(props) {
16271
16311
  return null;
16272
16312
  };
16273
16313
 
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;
16314
+ var renderRelevantTopicsDropdown = function renderRelevantTopicsDropdown() {
16315
+ if (content_placement && content_placement.length > 0) {
16316
+ return React__default.createElement(
16317
+ Dropdown,
16318
+ { style: { marginBottom: '1rem' } },
16319
+ React__default.createElement(
16320
+ Dropdown.Toggle,
16321
+ { variant: 'primary', id: 'partner-dropdown' },
16322
+ 'Relevant Topics'
16323
+ ),
16324
+ React__default.createElement(
16325
+ Dropdown.Menu,
16326
+ null,
16327
+ content_placement.length > 0 ? content_placement.map(function (cp, index) {
16328
+ var cp_url = cpModificationRequired ? get_content_placement_url(cp) : cp.path;
16329
+ var href = '/' + cp_url;
16330
+ return React__default.createElement(
16331
+ Dropdown.Item,
16332
+ { key: index, href: href },
16333
+ cp.name
16334
+ );
16335
+ }) : null
16336
+ )
16337
+ );
16338
+ }
16339
+ return null;
16340
+ };
16285
16341
 
16286
- //Native Ads
16287
- var findIndex = function findIndex(arr) {
16288
- var indexes = [];
16289
- var _iteratorNormalCompletion = true;
16290
- var _didIteratorError = false;
16291
- var _iteratorError = undefined;
16342
+ var renderBlockContent = function renderBlockContent(payload) {
16343
+ var _payload = payload,
16344
+ body = _payload.body;
16292
16345
 
16293
- try {
16294
- for (var _iterator = _getIterator(arr), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
16295
- var ele = _step.value;
16346
+ var findIndex = function findIndex(arr) {
16347
+ var indexes = [];
16348
+ var _iteratorNormalCompletion = true;
16349
+ var _didIteratorError = false;
16350
+ var _iteratorError = undefined;
16296
16351
 
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
16352
  try {
16308
- if (!_iteratorNormalCompletion && _iterator.return) {
16309
- _iterator.return();
16353
+ for (var _iterator = _getIterator(arr), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
16354
+ var ele = _step.value;
16355
+
16356
+ if (ele['_type'] === 'block' && ele.children.some(function (child) {
16357
+ return child.text.trim().length > 0;
16358
+ }) && ele['listItem'] !== 'bullet' && ele['style'] === 'normal') {
16359
+ indexes.push(arr.indexOf(ele));
16360
+ }
16310
16361
  }
16362
+ } catch (err) {
16363
+ _didIteratorError = true;
16364
+ _iteratorError = err;
16311
16365
  } finally {
16312
- if (_didIteratorError) {
16313
- throw _iteratorError;
16366
+ try {
16367
+ if (!_iteratorNormalCompletion && _iterator.return) {
16368
+ _iterator.return();
16369
+ }
16370
+ } finally {
16371
+ if (_didIteratorError) {
16372
+ throw _iteratorError;
16373
+ }
16314
16374
  }
16315
16375
  }
16316
- }
16317
16376
 
16318
- return indexes;
16377
+ return indexes;
16378
+ };
16379
+ var indexes = findIndex(body);
16380
+ if (indexes.length >= 2 && body.length > 3 && payload.contextualAD) {
16381
+ payload = _extends$2({}, payload, {
16382
+ contextualAD: _extends$2({}, payload.contextualAD, {
16383
+ slotId: (payload.contextualAD.slotId || 'native-ad') + '-' + payload._id
16384
+ })
16385
+ });
16386
+ var selectedIndex = indexes[1] + 1;
16387
+ return React__default.createElement(
16388
+ React__default.Fragment,
16389
+ null,
16390
+ React__default.createElement(BlockContent, _extends$2({
16391
+ serializers: getSerializers(client, pageview, videoAccountIDs, function () {}, true, drupalLeadSettings),
16392
+ blocks: [].concat(_toConsumableArray(body.slice(0, selectedIndex))),
16393
+ imageOptions: { w: 320, h: 240, fit: 'max' }
16394
+ }, client.config())),
16395
+ React__default.createElement(
16396
+ 'div',
16397
+ { className: 'contextual-native-ad' },
16398
+ React__default.createElement(DFPAdSlot, _extends$2({}, payload.contextualAD, { refreshFlag: false }))
16399
+ ),
16400
+ React__default.createElement(BlockContent, _extends$2({
16401
+ serializers: getSerializers(client, pageview, videoAccountIDs, function () {}, true, drupalLeadSettings),
16402
+ blocks: [].concat(_toConsumableArray(body.slice(selectedIndex))),
16403
+ imageOptions: { w: 320, h: 240, fit: 'max' }
16404
+ }, client.config()))
16405
+ );
16406
+ } else {
16407
+ return React__default.createElement(BlockContent, _extends$2({
16408
+ serializers: getSerializers(client, pageview, videoAccountIDs, function () {}, true, drupalLeadSettings),
16409
+ blocks: articleBody,
16410
+ imageOptions: { w: 320, h: 240, fit: 'max' }
16411
+ }, client.config()));
16412
+ }
16319
16413
  };
16320
16414
 
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);
16415
+ var shareVia = shareOptions.shareVia,
16416
+ shareSubject = shareOptions.shareSubject,
16417
+ twitterSiteName = shareOptions.twitterSiteName,
16418
+ shareImageDefault = shareOptions.shareImageDefault,
16419
+ shareBaseUrl = shareOptions.shareBaseUrl,
16420
+ shareSiteTitle = shareOptions.shareSiteTitle;
16327
16421
 
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
16422
+ var shareUrl = shareBaseUrl + props.url;
16423
+ var shareTitle = title;
16424
+ var shareSummary = summary;
16425
+ var shareImage = thumbnail && thumbnail.asset ? urlFor(thumbnail.asset).url() : shareImageDefault;
16426
+ var siteName = props.website.title;
16338
16427
 
16339
16428
  return React__default.createElement(
16340
16429
  React__default.Fragment,
@@ -16359,6 +16448,7 @@ var Article = function Article(props) {
16359
16448
  null,
16360
16449
  shareTitle + ' | ' + props.cache.siteSettingCache.name
16361
16450
  ),
16451
+ passwordLock && React__default.createElement('meta', { name: 'robots', content: 'noindex, nofollow' }),
16362
16452
  React__default.createElement('meta', { property: 'og:url', content: shareUrl }),
16363
16453
  React__default.createElement('meta', { property: 'og:title', content: shareTitle }),
16364
16454
  React__default.createElement('meta', { property: 'og:image', content: shareImage }),
@@ -16370,11 +16460,6 @@ var Article = function Article(props) {
16370
16460
  React__default.createElement('meta', { name: 'twitter:site', content: '@' + shareSiteTitle }),
16371
16461
  React__default.createElement('meta', { name: 'twitter:description', content: shareSummary })
16372
16462
  ),
16373
- React__default.createElement(
16374
- Head,
16375
- null,
16376
- passwordLock && React__default.createElement('meta', { name: 'robots', content: 'noindex, nofollow' })
16377
- ),
16378
16463
  React__default.createElement(
16379
16464
  'h1',
16380
16465
  { className: 'page-title' },
@@ -16407,7 +16492,7 @@ var Article = function Article(props) {
16407
16492
  issue.articleSource && React__default.createElement(
16408
16493
  'p',
16409
16494
  null,
16410
- 'Source: ' + issue.articleSource
16495
+ issue.articleSource
16411
16496
  )
16412
16497
  ),
16413
16498
  React__default.createElement(
@@ -16429,6 +16514,11 @@ var Article = function Article(props) {
16429
16514
  )
16430
16515
  )
16431
16516
  )
16517
+ ),
16518
+ pageNumber && React__default.createElement(
16519
+ 'div',
16520
+ { className: 'article-pageNumber' },
16521
+ 'Page Number: ' + pageNumber
16432
16522
  )
16433
16523
  ),
16434
16524
  React__default.createElement(
@@ -16446,28 +16536,7 @@ var Article = function Article(props) {
16446
16536
  twitterSiteName: twitterSiteName
16447
16537
  })
16448
16538
  ),
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
- ),
16539
+ renderRelevantTopicsDropdown(),
16471
16540
  React__default.createElement(
16472
16541
  'p',
16473
16542
  null,
@@ -16480,7 +16549,7 @@ var Article = function Article(props) {
16480
16549
  React__default.createElement('br', null)
16481
16550
  ),
16482
16551
  main_39 && props.article.Ads.map(function (ad, index) {
16483
- if (index == 0) {
16552
+ if (index === 0) {
16484
16553
  return React__default.createElement(
16485
16554
  'div',
16486
16555
  { key: index, id: 'addid-' + index, style: { display: 'flex', flex: '1 0 auto', marginTop: '-1rem', marginBottom: '1rem' } },
@@ -16491,11 +16560,7 @@ var Article = function Article(props) {
16491
16560
  React__default.createElement(
16492
16561
  'div',
16493
16562
  { 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())),
16563
+ renderBlockContent(props.article),
16499
16564
  issue && issue.url && React__default.createElement(
16500
16565
  'a',
16501
16566
  { href: issue.url, target: '_blank', title: 'Download issue' },
@@ -16520,64 +16585,18 @@ var Article = function Article(props) {
16520
16585
  React__default.createElement('hr', { className: 'article-seperater' })
16521
16586
  );
16522
16587
  };
16588
+
16523
16589
  var ArticleQueue = function ArticleQueue(props) {
16524
- var website = props.website,
16590
+ var _props$prevUrl = props.prevUrl,
16591
+ prevUrl = _props$prevUrl === undefined ? '/' : _props$prevUrl,
16525
16592
  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
16593
  _props$maxListLength = props.maxListLength,
16532
16594
  maxListLength = _props$maxListLength === undefined ? 10 : _props$maxListLength,
16595
+ _props$sponsoredTaxon = props.sponsoredTaxonomies,
16596
+ sponsoredTaxonomies = _props$sponsoredTaxon === undefined ? [] : _props$sponsoredTaxon,
16533
16597
  _props$cpModification = props.cpModificationRequired,
16534
16598
  cpModificationRequired = _props$cpModification === undefined ? false : _props$cpModification;
16535
16599
 
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
16600
 
16582
16601
  var getTargeting = function getTargeting(article) {
16583
16602
  var _article$internalTag = article.internalTag,
@@ -16637,31 +16656,51 @@ var ArticleQueue = function ArticleQueue(props) {
16637
16656
  document_url: [url],
16638
16657
  content_placement: content_placement_urls
16639
16658
  };
16659
+
16660
+ if (article.issue && article.issue.path) {
16661
+ targeting.issue_url = [article.issue.path];
16662
+ if (article.issue.publication && article.issue.publication.path) {
16663
+ targeting.publication_url = [article.issue.publication.path];
16664
+ }
16665
+ }
16666
+
16640
16667
  return targeting;
16641
16668
  };
16642
16669
 
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
16670
+ var firstArticle = function firstArticle() {
16671
+ var article = _Object$assign({}, props.article);
16672
+ var targeting = getTargeting(props.article);
16673
+ article.Ads = Ads.getRightItems(targeting);
16674
+ return article;
16658
16675
  };
16659
- props.article.Ads = Ads.getRightItems(targeting);
16660
16676
 
16661
- var _useState9 = useState(config),
16662
- _useState10 = _slicedToArray(_useState9, 2),
16663
- pageConfig = _useState10[0],
16664
- setPageConfig = _useState10[1];
16677
+ var _useState = useState([firstArticle()]),
16678
+ _useState2 = _slicedToArray(_useState, 2),
16679
+ queueData = _useState2[0],
16680
+ setQueueData = _useState2[1];
16681
+
16682
+ var refreshAD = function refreshAD(path) {
16683
+ if (!main_39) {
16684
+ var activeArticle = queueData.find(function (item) {
16685
+ return item.url.current === path;
16686
+ });
16687
+ var targeting = getTargeting(activeArticle);
16688
+ lib_3.getGoogletag().then(function (googletag) {
16689
+ if (window.googletag && googletag.pubadsReady) {
16690
+ var slots = googletag.pubads().getSlots();
16691
+ slots.forEach(function (slot) {
16692
+ var pos = slot.getTargeting('pos');
16693
+ slot.clearTargeting();
16694
+ _Object$keys(targeting).forEach(function (key) {
16695
+ slot.setTargeting(key, targeting[key]);
16696
+ });
16697
+ slot.setTargeting('pos', pos);
16698
+ });
16699
+ lib_3.refresh();
16700
+ }
16701
+ });
16702
+ }
16703
+ };
16665
16704
 
16666
16705
  var checkSponseredArticle = function checkSponseredArticle(article) {
16667
16706
  var _article$taxonomyMapp = article.taxonomyMapping,
@@ -16676,51 +16715,8 @@ var ArticleQueue = function ArticleQueue(props) {
16676
16715
  }
16677
16716
  };
16678
16717
 
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]);
16718
+ var preVscroll = 0;
16719
+ var isScrollDown = true;
16724
16720
 
16725
16721
  var scrollDirectionDetect = function scrollDirectionDetect(e) {
16726
16722
  var window = e.currentTarget;
@@ -16738,74 +16734,59 @@ var ArticleQueue = function ArticleQueue(props) {
16738
16734
 
16739
16735
  useEffect(function () {
16740
16736
  window.addEventListener('scroll', scrollDirectionDetect);
16737
+ return function () {
16738
+ return window.removeEventListener('scroll', scrollDirectionDetect);
16739
+ };
16741
16740
  });
16742
16741
 
16743
16742
  var loadmore = function loadmore() {
16744
16743
  var query = props.relatedArticleQuery;
16745
16744
  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;
16745
+ if (queueData && queueData.length < maxListLength) {
16746
+ params.index = queueData.length - 1;
16751
16747
  props.client.fetch(query, params).then(function (article) {
16752
16748
  if (article && article._id) {
16753
- var _targeting2 = getTargeting(article);
16754
- article.Ads = props.Ads.getRightItems(_targeting2);
16755
- data.push(article);
16756
- setQueueData(data);
16749
+ var targeting = getTargeting(article);
16750
+ article.Ads = Ads.getRightItems(targeting);
16751
+ setQueueData([].concat(_toConsumableArray(queueData), [article]));
16757
16752
  }
16758
16753
  });
16759
16754
  }
16760
16755
  };
16761
16756
 
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
16757
  var changeUrl = function changeUrl(path, visibility) {
16773
16758
  var newPath = '/view/' + path;
16774
16759
  if (!isScrollDown) {
16775
16760
  if (visibility === 'top') {
16776
- // Router.push('/view/[url]', newPath, { shallow: true })
16761
+ // router.push('/view/[url]', newPath, { shallow: true })
16777
16762
  window.history.pushState({ page: path }, path, newPath);
16778
16763
  if (props.pageview) {
16779
16764
  props.pageview(newPath);
16780
16765
  }
16781
- refreshAdd(path);
16766
+ refreshAD(path);
16782
16767
  }
16783
16768
  } else {
16784
16769
  if (visibility === 'bottom') {
16785
- // Router.push('/view/[url]', newPath, { shallow: true })
16770
+ // router.push('/view/[url]', newPath, { shallow: true })
16786
16771
  window.history.pushState({ page: path }, path, newPath);
16787
16772
  if (props.pageview) {
16788
16773
  props.pageview(newPath);
16789
16774
  }
16790
- refreshAdd(path);
16775
+ refreshAD(path);
16791
16776
  }
16792
16777
  }
16793
16778
  };
16794
16779
 
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
- }
16780
+ return React__default.createElement(
16781
+ InfiniteScroll,
16782
+ { dataLength: queueData.length, next: loadmore, scrollThreshold: 0.8, hasMore: true },
16783
+ queueData.map(function (article, index) {
16784
+ if (!checkSponseredArticle(article) && Ads.getNativeContextualAD) {
16785
+ article.contextualAD = Ads.getNativeContextualAD(getTargeting(article));
16786
+ }
16787
+ return React__default.createElement(Article, _extends$2({ key: index }, props, { changeUrl: changeUrl, article: article, cpModificationRequired: cpModificationRequired }));
16788
+ })
16789
+ );
16809
16790
  };
16810
16791
 
16811
16792
  var KMTracker = function KMTracker(props) {