@mjhls/mjh-framework 1.0.393 → 1.0.395

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/cjs/index.js CHANGED
@@ -12,7 +12,7 @@ var main = require('./main-2020ba94.js');
12
12
  var toConsumableArray = require('./toConsumableArray-3cf1df2c.js');
13
13
  require('./_object-pie-68c5bcbc.js');
14
14
  var _extends$2 = require('./extends-60837c34.js');
15
- var inherits$2 = require('./inherits-2a0fa98c.js');
15
+ var inherits$2 = require('./inherits-e793003e.js');
16
16
  var _typeof$2 = require('./typeof-2747c582.js');
17
17
  var React = require('react');
18
18
  var React__default = _interopDefault(React);
@@ -36,7 +36,7 @@ var promise = require('./promise-d5136080.js');
36
36
  var ADInfeed = require('./ADInfeed-f544f2a5.js');
37
37
  var DeckContent = require('./DeckContent.js');
38
38
  var get$1 = require('./get-5aa7468c.js');
39
- var GridContent = require('./GridContent-dd1844d5.js');
39
+ var GridContent = require('./GridContent-19ce4f03.js');
40
40
  var AuthorComponent = require('./AuthorComponent-4706f297.js');
41
41
  var DeckQueue = require('./DeckQueue.js');
42
42
  require('react-bootstrap/Media');
@@ -57,7 +57,7 @@ var IssueDeck = require('./IssueDeck.js');
57
57
  require('react-bootstrap/Badge');
58
58
  var IssueContentDeck = require('./IssueContentDeck.js');
59
59
  var Spinner = _interopDefault(require('react-bootstrap/Spinner'));
60
- var TemplateNormal = require('./Normal-cc68fd44.js');
60
+ var TemplateNormal = require('./Normal-adc8ed7f.js');
61
61
  require('react-bootstrap/ListGroup');
62
62
  var Head = _interopDefault(require('next/head'));
63
63
  var Accordion = _interopDefault(require('react-bootstrap/Accordion'));
@@ -66,8 +66,8 @@ var reactShare = require('react-share');
66
66
  require('react-bootstrap/Nav');
67
67
  require('react-bootstrap/Navbar');
68
68
  require('react-bootstrap/NavDropdown');
69
- require('react-bootstrap/Form');
70
- require('react-bootstrap/FormControl');
69
+ var Form = _interopDefault(require('react-bootstrap/Form'));
70
+ var FormControl = _interopDefault(require('react-bootstrap/FormControl'));
71
71
  var Pagination = _interopDefault(require('react-bootstrap/Pagination'));
72
72
  var dynamic = _interopDefault(require('next/dynamic'));
73
73
  var Carousel = _interopDefault(require('react-bootstrap/Carousel'));
@@ -14234,6 +14234,54 @@ var NativeAd = function NativeAd(props) {
14234
14234
  );
14235
14235
  };
14236
14236
 
14237
+ var urlFor$4 = function urlFor(source, client) {
14238
+ var builder = index.imageUrlBuilder(client);
14239
+ return builder.image(source).auto('format');
14240
+ };
14241
+
14242
+ var MultiFigure = function MultiFigure(props) {
14243
+ var images = props.node.images,
14244
+ client = props.client;
14245
+
14246
+
14247
+ if (images && images.length > 0) {
14248
+ return React__default.createElement(
14249
+ 'div',
14250
+ { className: 'multi-figure-container' },
14251
+ React__default.createElement(
14252
+ reactBootstrap.Row,
14253
+ { noGutters: true },
14254
+ images.map(function (image, index) {
14255
+ return React__default.createElement(
14256
+ reactBootstrap.Col,
14257
+ { xs: 12, md: 12 / images.length, key: index },
14258
+ React__default.createElement(
14259
+ 'a',
14260
+ _extends$2._extends({}, image.link && { href: image.link, target: image.blank ? '_blank' : '_self' }, { style: { cursor: image.link ? 'pointer' : 'text' } }),
14261
+ React__default.createElement(
14262
+ 'div',
14263
+ null,
14264
+ React__default.createElement('img', { className: 'multi-figure-image', src: urlFor$4(image.asset, client).url(), alt: image.alt }),
14265
+ image.caption && React__default.createElement(
14266
+ 'p',
14267
+ { className: 'multi-figure-caption' },
14268
+ image.caption
14269
+ )
14270
+ )
14271
+ )
14272
+ );
14273
+ })
14274
+ ),
14275
+ React__default.createElement(
14276
+ 'style',
14277
+ { jsx: 'true' },
14278
+ '\n .multi-figure-container {\n margin-bottom: 8px;\n }\n .multi-figure-image {\n width: 100%;\n height: auto;\n max-height: 180px;\n min-height: 150px;\n object-fit: cover;\n }\n .multi-figure-caption {\n font-size: 90%;\n color: #6c757d;\n }\n\n @media only screen and (min-width: 768px) {\n .multi-figure-container [class*=\'col-\'] + [class*=\'col-\'] {\n padding-left: 10px;\n }\n }\n '
14279
+ )
14280
+ );
14281
+ }
14282
+ return null;
14283
+ };
14284
+
14237
14285
  var Figure = dynamic(function () {
14238
14286
  return Promise.resolve().then(function () { return require('./Figure-c49ee0f8.js'); });
14239
14287
  }, { ssr: false });
@@ -14300,70 +14348,75 @@ var getSerializers = function getSerializers() {
14300
14348
 
14301
14349
  return React__default.createElement(Figure, { node: node, client: client, contextualADFlag: contextualADFlag });
14302
14350
  },
14303
- slideshow: function slideshow(_ref4) {
14351
+ multifigure: function multifigure(_ref4) {
14304
14352
  var node = _ref4.node;
14353
+
14354
+ return React__default.createElement(MultiFigure, { node: node, client: client });
14355
+ },
14356
+ slideshow: function slideshow(_ref5) {
14357
+ var node = _ref5.node;
14305
14358
  var slides = node.slides;
14306
14359
 
14307
14360
  return React__default.createElement(Slideshow, { slides: slides, client: client, pageview: pageview });
14308
14361
  },
14309
- sidebar: function sidebar(_ref5) {
14310
- var node = _ref5.node;
14362
+ sidebar: function sidebar(_ref6) {
14363
+ var node = _ref6.node;
14311
14364
  var caption = node.caption,
14312
14365
  content = node.content;
14313
14366
 
14314
14367
  return React__default.createElement(Sidebar, { caption: caption, content: content, getSerializers: getSerializers(props) });
14315
14368
  },
14316
- datatable: function datatable(_ref6) {
14317
- var node = _ref6.node;
14369
+ datatable: function datatable(_ref7) {
14370
+ var node = _ref7.node;
14318
14371
  var table = node.table;
14319
14372
 
14320
14373
  return React__default.createElement(TableShow, { rows: table.rows });
14321
14374
  },
14322
- media: function media(_ref7) {
14323
- var node = _ref7.node;
14375
+ media: function media(_ref8) {
14376
+ var node = _ref8.node;
14324
14377
 
14325
14378
  return React__default.createElement(Media, { node: node, client: client });
14326
14379
  },
14327
- iframe: function iframe(_ref8) {
14328
- var node = _ref8.node;
14380
+ iframe: function iframe(_ref9) {
14381
+ var node = _ref9.node;
14329
14382
 
14330
14383
  return React__default.createElement(IFrame, { url: node.url });
14331
14384
  },
14332
- video: function video(_ref9) {
14333
- var node = _ref9.node;
14385
+ video: function video(_ref10) {
14386
+ var node = _ref10.node;
14334
14387
 
14335
14388
  return React__default.createElement(Video, { node: node, autoplay: autoplay, accountIDs: videoAccountIDs || {} });
14336
14389
  },
14337
- audio: function audio(_ref10) {
14338
- var node = _ref10.node;
14390
+ audio: function audio(_ref11) {
14391
+ var node = _ref11.node;
14339
14392
 
14340
14393
  return React__default.createElement(Audio, { node: node });
14341
14394
  },
14342
- poll: function poll(_ref11) {
14343
- var node = _ref11.node;
14395
+ poll: function poll(_ref12) {
14396
+ var node = _ref12.node;
14344
14397
 
14345
14398
  return React__default.createElement(Poll, { node: node, client: client, pageview: pageview, videoAccountIDs: videoAccountIDs, onVote: onVote, showVotes: showVotes, getSerializers: getSerializers(props) });
14346
14399
  },
14347
- quiz: function quiz(_ref12) {
14348
- var node = _ref12.node;
14400
+ quiz: function quiz(_ref13) {
14401
+ var node = _ref13.node;
14349
14402
  var quizzes = node.quizzes;
14350
14403
 
14351
14404
  return React__default.createElement(Quiz, { quizzes: quizzes, getSerializers: getSerializers(props), pageview: pageview, currentPage: currentPage });
14352
14405
  },
14353
- leads: function leads(_ref13) {
14354
- var node = _ref13.node;
14406
+ leads: function leads(_ref14) {
14407
+ var node = _ref14.node;
14355
14408
  var leadID = node.leadID;
14356
14409
 
14357
14410
  var url = '' + drupalLeadSettings.baseUrl + leadID;
14358
14411
  return React__default.createElement(Leads, { url: url });
14359
14412
  },
14360
- slideshows: function slideshows(_ref14) {
14361
- var node = _ref14.node;
14413
+ slideshows: function slideshows(_ref15) {
14414
+ var node = _ref15.node;
14362
14415
 
14363
14416
  return React__default.createElement(Slideshow$1, { node: node, client: client, pageview: pageview, getSerializers: getSerializers(props) });
14364
14417
  },
14365
- nativeAd: function nativeAd(_ref15) {
14366
- var node = _ref15.node;
14418
+ nativeAd: function nativeAd(_ref16) {
14419
+ var node = _ref16.node;
14367
14420
 
14368
14421
  return React__default.createElement(NativeAd, { node: node });
14369
14422
  }
@@ -14396,32 +14449,32 @@ var getSerializers = function getSerializers() {
14396
14449
  children
14397
14450
  );
14398
14451
  },
14399
- alignleft: function alignleft(_ref16) {
14400
- var children = _ref16.children;
14452
+ alignleft: function alignleft(_ref17) {
14453
+ var children = _ref17.children;
14401
14454
  return React__default.createElement(
14402
14455
  'div',
14403
14456
  { style: { textAlign: 'left' } },
14404
14457
  children
14405
14458
  );
14406
14459
  },
14407
- alignright: function alignright(_ref17) {
14408
- var children = _ref17.children;
14460
+ alignright: function alignright(_ref18) {
14461
+ var children = _ref18.children;
14409
14462
  return React__default.createElement(
14410
14463
  'div',
14411
14464
  { style: { textAlign: 'right' } },
14412
14465
  children
14413
14466
  );
14414
14467
  },
14415
- aligncenter: function aligncenter(_ref18) {
14416
- var children = _ref18.children;
14468
+ aligncenter: function aligncenter(_ref19) {
14469
+ var children = _ref19.children;
14417
14470
  return React__default.createElement(
14418
14471
  'div',
14419
14472
  { style: { textAlign: 'center' } },
14420
14473
  children
14421
14474
  );
14422
14475
  },
14423
- alignjustify: function alignjustify(_ref19) {
14424
- var children = _ref19.children;
14476
+ alignjustify: function alignjustify(_ref20) {
14477
+ var children = _ref20.children;
14425
14478
  return React__default.createElement(
14426
14479
  'div',
14427
14480
  { style: { textAlign: 'justify' } },
@@ -14628,13 +14681,13 @@ var SetCookie = function SetCookie(key, value) {
14628
14681
  js_cookie.set(key, value, { expires: 1, sameSite: 'none', secure: true });
14629
14682
  };
14630
14683
 
14631
- var urlFor$4 = function urlFor(source, client) {
14684
+ var urlFor$5 = function urlFor(source, client) {
14632
14685
  var builder = index.imageUrlBuilder(client);
14633
14686
  return builder.image(source).auto('format');
14634
14687
  };
14635
14688
 
14636
14689
  var renderCardImage$1 = function renderCardImage(thumbnail, client, imageHeight, imageWidth) {
14637
- var url = urlFor$4(thumbnail, client);
14690
+ var url = urlFor$5(thumbnail, client);
14638
14691
  if (imageHeight) url = url.height(imageHeight);
14639
14692
  if (imageWidth) url = url.width(imageWidth);
14640
14693
  return url.url();
@@ -22163,6 +22216,1163 @@ var auth = {
22163
22216
  ProcessData: ProcessData_1
22164
22217
  };
22165
22218
 
22219
+ var renderAuthor$2 = function renderAuthor(authorName, authorURL, index, length) {
22220
+ var defaultUrl = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 'authors';
22221
+
22222
+ if (authorName && authorURL) {
22223
+ return React__default.createElement(
22224
+ 'span',
22225
+ null,
22226
+ React__default.createElement(
22227
+ 'a',
22228
+ { href: '/' + defaultUrl + '/' + authorURL.current, key: index },
22229
+ authorName
22230
+ ),
22231
+ length !== index + 1 && ' , '
22232
+ );
22233
+ } else if (authorName) {
22234
+ return React__default.createElement(
22235
+ 'span',
22236
+ { key: index },
22237
+ authorName,
22238
+ length !== index + 1 && ' , '
22239
+ );
22240
+ }
22241
+ };
22242
+
22243
+ var getContentPlacementUrl = function getContentPlacementUrl(cp) {
22244
+ var cp_url = '';
22245
+ if (cp.ancestor && typeof cp.ancestor == 'string') {
22246
+ cp_url += (cp_url === '' ? '' : '/') + cp.ancestor;
22247
+ }
22248
+
22249
+ if (!cp.ancestor && cp.parent && typeof cp.parent == 'string') {
22250
+ cp_url += (cp_url === '' ? '' : '/') + cp.parent;
22251
+ }
22252
+
22253
+ cp_url += (cp_url === '' ? '' : '/') + cp.path;
22254
+
22255
+ return cp_url;
22256
+ };
22257
+
22258
+ var getArticleSummary$1 = function getArticleSummary(article) {
22259
+ if (article.summary && article.summary.length > 0) {
22260
+ return article.summary;
22261
+ } else {
22262
+ var _article$body = article.body,
22263
+ body = _article$body === undefined ? [] : _article$body;
22264
+
22265
+ var desc = '';
22266
+ body.some(function (children) {
22267
+ children.children && children.children.some(function (item) {
22268
+ if (item.text && String(item.text).trim().length > 0 && desc === '') {
22269
+ desc = String(item.text);
22270
+ return true;
22271
+ }
22272
+ });
22273
+ if (desc !== '') {
22274
+ return true;
22275
+ }
22276
+ });
22277
+ return desc;
22278
+ }
22279
+ };
22280
+
22281
+ function urlFor$6(client, source) {
22282
+ return index.imageUrlBuilder(client).image(source);
22283
+ }
22284
+
22285
+ var getDocumentGroupUrl = function getDocumentGroupUrl(docGroup) {
22286
+ if (!docGroup) {
22287
+ return null;
22288
+ }
22289
+ var url = void 0;
22290
+ if (docGroup.path.includes('/')) {
22291
+ return docGroup.path;
22292
+ }
22293
+
22294
+ if (docGroup.parent) {
22295
+ url = '/' + docGroup.parent.identifier.current;
22296
+ if (docGroup.parent.parent && docGroup.parent.parent.name) {
22297
+ url = '/' + docGroup.parent.parent.identifier.current + url;
22298
+ }
22299
+ }
22300
+
22301
+ if (!docGroup.thumbnail) ;
22302
+ url = url + '/' + docGroup.path;
22303
+
22304
+ return url;
22305
+ };
22306
+
22307
+ var getDocumentGroupName = function getDocumentGroupName(docGroup) {
22308
+ var name = void 0;
22309
+ if (!docGroup) {
22310
+ return null;
22311
+ }
22312
+
22313
+ if (docGroup.parent) {
22314
+ name = docGroup.parent.name;
22315
+
22316
+ if (docGroup.parent.parent && docGroup.parent.parent.name) {
22317
+ name = docGroup.parent.parent.name + ' | ' + name;
22318
+ }
22319
+ }
22320
+
22321
+ if (!docGroup.thumbnail) {
22322
+ name = name + ' | <b>' + docGroup.name + '</b>';
22323
+ }
22324
+
22325
+ return name;
22326
+ };
22327
+
22328
+ var DocumentGroup = function DocumentGroup(_ref) {
22329
+ var article = _ref.article,
22330
+ client = _ref.client;
22331
+
22332
+ if (!article.documentGroup) {
22333
+ return null;
22334
+ }
22335
+ var name = getDocumentGroupName(article.documentGroup);
22336
+ var url = getDocumentGroupUrl(article.documentGroup);
22337
+ var thumbnailUrl = false;
22338
+
22339
+ if (article.documentGroup.thumbnail) {
22340
+ thumbnailUrl = urlFor$6(client, article.documentGroup.thumbnail).url();
22341
+ }
22342
+
22343
+ return React__default.createElement(
22344
+ 'a',
22345
+ {
22346
+ href: url,
22347
+ className: 'doc-group',
22348
+ style: { display: 'flex', flexDirection: 'column', padding: '0 1rem', justifyContent: thumbnailUrl ? 'center' : 'flex-start', alignItems: 'center' } },
22349
+ thumbnailUrl && React__default.createElement('img', { style: { maxWidth: '220px', maxHeight: '100px', marginTop: '1rem' }, src: thumbnailUrl, alt: name }),
22350
+ React__default.createElement('p', {
22351
+ style: { maxWidth: '315px', margin: '0', color: 'var(--primary)', textAlign: thumbnailUrl ? 'center' : isMobileOnly ? 'left' : 'right', marginTop: '.25rem' },
22352
+ dangerouslySetInnerHTML: { __html: name } }),
22353
+ isMobileOnly && !thumbnailUrl && React__default.createElement(
22354
+ 'style',
22355
+ { jsx: 'true' },
22356
+ '\n a.doc-group {\n display: block !important;\n padding: 0!important;\n }\n '
22357
+ )
22358
+ );
22359
+ };
22360
+
22361
+ var Article$1 = function Article(props) {
22362
+ var article = props.article;
22363
+ var client = props.client,
22364
+ pageview = props.pageview,
22365
+ videoAccountIDs = props.videoAccountIDs,
22366
+ drupalLeadSettings = props.drupalLeadSettings,
22367
+ currentPage = props.currentPage,
22368
+ _props$article = props.article,
22369
+ title = _props$article.title,
22370
+ _props$article$passwo = _props$article.passwordLock,
22371
+ passwordLock = _props$article$passwo === undefined ? false : _props$article$passwo,
22372
+ authorDetails = _props$article.authorDetails,
22373
+ pageNumber = _props$article.pageNumber,
22374
+ published = _props$article.published,
22375
+ articleBody = _props$article.body,
22376
+ thumbnail = _props$article.thumbnail,
22377
+ content_placement = _props$article.content_placement,
22378
+ _props$article$url = _props$article.url;
22379
+ _props$article$url = _props$article$url === undefined ? {
22380
+ current: ''
22381
+ } : _props$article$url;
22382
+ var url = _props$article$url.current,
22383
+ issue = _props$article.issue,
22384
+ source = _props$article.source,
22385
+ regionalPages = props.regionalPages,
22386
+ nationalPage = props.nationalPage,
22387
+ ISIContent = props.ISIContent,
22388
+ shareOptions = props.shareOptions,
22389
+ cpModificationRequired = props.cpModificationRequired,
22390
+ authorPrefix = props.authorPrefix;
22391
+ var changeUrl = props.changeUrl;
22392
+
22393
+ var _useState = React.useState(null),
22394
+ _useState2 = slicedToArray._slicedToArray(_useState, 2),
22395
+ contextualADFlag = _useState2[0],
22396
+ setContextualADFlag = _useState2[1];
22397
+
22398
+ var summary = getArticleSummary$1(props.article);
22399
+
22400
+ var _useState3 = React.useState(1),
22401
+ _useState4 = slicedToArray._slicedToArray(_useState3, 2),
22402
+ auth = _useState4[0],
22403
+ setAuth = _useState4[1];
22404
+
22405
+ var _useState5 = React.useState(''),
22406
+ _useState6 = slicedToArray._slicedToArray(_useState5, 2),
22407
+ passwordKey = _useState6[0],
22408
+ setPasswordKey = _useState6[1];
22409
+
22410
+ var _useState7 = React.useState(false),
22411
+ _useState8 = slicedToArray._slicedToArray(_useState7, 2),
22412
+ showVotes = _useState8[0],
22413
+ setShowVotes = _useState8[1];
22414
+
22415
+ var isCutomPage = function isCutomPage(article) {
22416
+ var url = article.url.current;
22417
+
22418
+ if (regionalPages || nationalPage) {
22419
+ return regionalPages.includes(url) || nationalPage === url;
22420
+ } else {
22421
+ return false;
22422
+ }
22423
+ };
22424
+
22425
+ var renderIsiContent = function renderIsiContent(article) {
22426
+ var url = article.url.current;
22427
+
22428
+ if (regionalPages && regionalPages.includes(url)) {
22429
+ return React__default.createElement(ISIContent, null);
22430
+ } else if (nationalPage === url) {
22431
+ return React__default.createElement(ISIContent, { national: true });
22432
+ }
22433
+ return null;
22434
+ };
22435
+
22436
+ var renderRelevantTopicsDropdown = function renderRelevantTopicsDropdown() {
22437
+ if (content_placement && content_placement.length > 0) {
22438
+ return React__default.createElement(
22439
+ Dropdown,
22440
+ null,
22441
+ React__default.createElement(
22442
+ Dropdown.Toggle,
22443
+ { variant: 'primary', id: 'partner-dropdown' },
22444
+ 'Relevant Topics'
22445
+ ),
22446
+ React__default.createElement(
22447
+ Dropdown.Menu,
22448
+ null,
22449
+ content_placement.length > 0 ? content_placement.map(function (cp, index) {
22450
+ var cp_url = cpModificationRequired ? getContentPlacementUrl(cp) : cp.path;
22451
+ var href = '/' + cp_url;
22452
+ return React__default.createElement(
22453
+ Dropdown.Item,
22454
+ { key: index, href: href },
22455
+ cp.name
22456
+ );
22457
+ }) : null
22458
+ )
22459
+ );
22460
+ }
22461
+ return null;
22462
+ };
22463
+ var form = function form() {
22464
+ return React__default.createElement(
22465
+ React__default.Fragment,
22466
+ null,
22467
+ React__default.createElement(
22468
+ Head,
22469
+ null,
22470
+ React__default.createElement('meta', { name: 'googlebot', content: 'noindex' })
22471
+ ),
22472
+ React__default.createElement(
22473
+ 'div',
22474
+ { className: 'mt-5', style: { display: 'flex', justifyContent: 'center', alignItems: 'center' } },
22475
+ React__default.createElement(
22476
+ Form,
22477
+ {
22478
+ inline: true,
22479
+ onSubmit: function onSubmit(e) {
22480
+ e.preventDefault();
22481
+ } },
22482
+ React__default.createElement(FormControl, { type: 'text', className: 'mr-sm-2', value: passwordKey, onChange: function onChange(e) {
22483
+ return setPasswordKey(e.target.value);
22484
+ }, placeholder: 'Password' }),
22485
+ React__default.createElement(
22486
+ Button,
22487
+ {
22488
+ variant: 'primary',
22489
+ onClick: function onClick() {
22490
+ if (passwordKey === props.article.password) {
22491
+ setAuth(2);
22492
+ } else {
22493
+ alert('Incorrect Password');
22494
+ }
22495
+ } },
22496
+ 'Submit'
22497
+ )
22498
+ )
22499
+ )
22500
+ );
22501
+ };
22502
+
22503
+ var renderBlockContent = function renderBlockContent(payload) {
22504
+ var _payload = payload,
22505
+ body = _payload.body;
22506
+
22507
+ var findIndex = function findIndex(arr) {
22508
+ var indexes = [];
22509
+ var _iteratorNormalCompletion = true;
22510
+ var _didIteratorError = false;
22511
+ var _iteratorError = undefined;
22512
+
22513
+ try {
22514
+ for (var _iterator = slicedToArray._getIterator(arr), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
22515
+ var ele = _step.value;
22516
+
22517
+ if (ele['_type'] === 'block' && ele.children.some(function (child) {
22518
+ return child.text.trim().length > 0;
22519
+ }) && ele['listItem'] !== 'bullet' && ele['style'] === 'normal' || ele['_type'] === 'figure') {
22520
+ indexes.push(arr.indexOf(ele));
22521
+ }
22522
+ }
22523
+ } catch (err) {
22524
+ _didIteratorError = true;
22525
+ _iteratorError = err;
22526
+ } finally {
22527
+ try {
22528
+ if (!_iteratorNormalCompletion && _iterator.return) {
22529
+ _iterator.return();
22530
+ }
22531
+ } finally {
22532
+ if (_didIteratorError) {
22533
+ throw _iteratorError;
22534
+ }
22535
+ }
22536
+ }
22537
+
22538
+ return indexes;
22539
+ };
22540
+ var indexes = findIndex(body);
22541
+ if (indexes.length >= 2 && body.length > 3 && payload.contextualAD && payload.contextualVideoAD) {
22542
+ payload = _extends$2._extends({}, payload, {
22543
+ contextualAD: _extends$2._extends({}, payload.contextualAD, {
22544
+ slotId: (payload.contextualAD.slotId || 'native-ad') + '-' + payload._id
22545
+ }),
22546
+ contextualVideoAD: _extends$2._extends({}, payload.contextualVideoAD, {
22547
+ slotId: (payload.contextualVideoAD.slotId || 'in-context_video') + '-' + payload._id
22548
+ })
22549
+ });
22550
+ var selectedIndex = indexes[1] + 1;
22551
+
22552
+ var checkIsAdFound = function checkIsAdFound(isFound) {
22553
+ if (!isFound) {
22554
+ var parent = document.getElementById('contextual-native-ad-' + payload._id);
22555
+ parent.style.height = '0%';
22556
+ parent.style.width = '0%';
22557
+ parent.style.display = 'none';
22558
+ setContextualADFlag(false);
22559
+ } else {
22560
+ setContextualADFlag(true);
22561
+ }
22562
+ };
22563
+
22564
+ var checkIsVideoAdFound = function checkIsVideoAdFound(isFound) {
22565
+ if (!isFound) {
22566
+ var parent = document.getElementById('contextual-video-ad-' + payload._id);
22567
+ parent.style.height = '0%';
22568
+ parent.style.width = '0%';
22569
+ parent.style.display = 'none';
22570
+ setContextualADFlag(false);
22571
+ } else {
22572
+ setContextualADFlag(true);
22573
+ }
22574
+ };
22575
+
22576
+ return React__default.createElement(
22577
+ React__default.Fragment,
22578
+ null,
22579
+ React__default.createElement(TaxonomyCard.BlockContent, _extends$2._extends({
22580
+ serializers: getSerializers(client, pageview, videoAccountIDs, function () {}, true, drupalLeadSettings, currentPage, false, contextualADFlag),
22581
+ blocks: [].concat(toConsumableArray._toConsumableArray(body.slice(0, selectedIndex))),
22582
+ imageOptions: { w: 320, h: 240, fit: 'max' }
22583
+ }, client.config())),
22584
+ React__default.createElement('span', { className: 'clearfix' }),
22585
+ React__default.createElement(
22586
+ 'div',
22587
+ { id: 'contextual-native-ad-' + payload._id, className: 'contextual-native-ad' },
22588
+ React__default.createElement(AdSlot.DFPAdSlot, _extends$2._extends({}, payload.contextualAD, { refreshFlag: false, checkIsAdFound: checkIsAdFound }))
22589
+ ),
22590
+ React__default.createElement('span', { className: 'clearfix' }),
22591
+ React__default.createElement(
22592
+ 'div',
22593
+ { id: 'contextual-video-ad-' + payload._id, className: 'contextual-video-ad' },
22594
+ React__default.createElement(AdSlot.DFPAdSlot, _extends$2._extends({}, payload.contextualVideoAD, { refreshFlag: false, checkIsAdFound: checkIsVideoAdFound }))
22595
+ ),
22596
+ React__default.createElement(TaxonomyCard.BlockContent, _extends$2._extends({
22597
+ serializers: getSerializers(client, pageview, videoAccountIDs, function () {}, true, drupalLeadSettings, currentPage, false),
22598
+ blocks: [].concat(toConsumableArray._toConsumableArray(body.slice(selectedIndex))),
22599
+ imageOptions: { w: 320, h: 240, fit: 'max' }
22600
+ }, client.config()))
22601
+ );
22602
+ } else if (indexes.length >= 2 && body.length > 3 && payload.contextualAD && !payload.contextualVideoAD) {
22603
+ payload = _extends$2._extends({}, payload, {
22604
+ contextualAD: _extends$2._extends({}, payload.contextualAD, {
22605
+ slotId: (payload.contextualAD.slotId || 'native-ad') + '-' + payload._id
22606
+ })
22607
+ });
22608
+ var _selectedIndex = indexes[1] + 1;
22609
+
22610
+ var _checkIsAdFound = function _checkIsAdFound(isFound) {
22611
+ if (!isFound) {
22612
+ var parent = document.getElementById('contextual-native-ad-' + payload._id);
22613
+ parent.style.height = '0%';
22614
+ parent.style.width = '0%';
22615
+ parent.style.display = 'none';
22616
+ setContextualADFlag(false);
22617
+ } else {
22618
+ setContextualADFlag(true);
22619
+ }
22620
+ };
22621
+
22622
+ return React__default.createElement(
22623
+ React__default.Fragment,
22624
+ null,
22625
+ React__default.createElement(TaxonomyCard.BlockContent, _extends$2._extends({
22626
+ serializers: getSerializers(client, pageview, videoAccountIDs, function () {}, true, drupalLeadSettings, currentPage, false, contextualADFlag),
22627
+ blocks: [].concat(toConsumableArray._toConsumableArray(body.slice(0, _selectedIndex))),
22628
+ imageOptions: { w: 320, h: 240, fit: 'max' }
22629
+ }, client.config())),
22630
+ React__default.createElement('span', { className: 'clearfix' }),
22631
+ React__default.createElement(
22632
+ 'div',
22633
+ { id: 'contextual-native-ad-' + payload._id, className: 'contextual-native-ad' },
22634
+ React__default.createElement(AdSlot.DFPAdSlot, _extends$2._extends({}, payload.contextualAD, { refreshFlag: false, checkIsAdFound: _checkIsAdFound }))
22635
+ ),
22636
+ React__default.createElement(TaxonomyCard.BlockContent, _extends$2._extends({
22637
+ serializers: getSerializers(client, pageview, videoAccountIDs, function () {}, true, drupalLeadSettings, currentPage, false),
22638
+ blocks: [].concat(toConsumableArray._toConsumableArray(body.slice(_selectedIndex))),
22639
+ imageOptions: { w: 320, h: 240, fit: 'max' }
22640
+ }, client.config()))
22641
+ );
22642
+ } else if (indexes.length >= 2 && body.length > 3 && payload.contextualVideoAD && !payload.contextualAD) {
22643
+ payload = _extends$2._extends({}, payload, {
22644
+ contextualVideoAD: _extends$2._extends({}, payload.contextualVideoAD, {
22645
+ slotId: (payload.contextualVideoAD.slotId || 'in-context_video') + '-' + payload._id
22646
+ })
22647
+ });
22648
+ var _selectedIndex2 = indexes[1] + 1;
22649
+
22650
+ var _checkIsAdFound2 = function _checkIsAdFound2(isFound) {
22651
+ if (!isFound) {
22652
+ var parent = document.getElementById('contextual-video-ad-' + payload._id);
22653
+ parent.style.height = '0%';
22654
+ parent.style.width = '0%';
22655
+ parent.style.display = 'none';
22656
+ setContextualADFlag(false);
22657
+ } else {
22658
+ if (body && body[1] && body[1]._type === 'figure') {
22659
+ setContextualADFlag(true);
22660
+ }
22661
+ }
22662
+ };
22663
+
22664
+ return React__default.createElement(
22665
+ React__default.Fragment,
22666
+ null,
22667
+ React__default.createElement(TaxonomyCard.BlockContent, _extends$2._extends({
22668
+ serializers: getSerializers(client, pageview, videoAccountIDs, function () {}, true, drupalLeadSettings, currentPage, false, contextualADFlag),
22669
+ blocks: [].concat(toConsumableArray._toConsumableArray(body.slice(0, _selectedIndex2))),
22670
+ imageOptions: { w: 320, h: 240, fit: 'max' }
22671
+ }, client.config())),
22672
+ React__default.createElement('span', { className: 'clearfix' }),
22673
+ React__default.createElement(
22674
+ 'div',
22675
+ { id: 'contextual-video-ad-' + payload._id, className: 'contextual-video-ad' },
22676
+ React__default.createElement(AdSlot.DFPAdSlot, _extends$2._extends({}, payload.contextualVideoAD, { refreshFlag: false, checkIsAdFound: _checkIsAdFound2 }))
22677
+ ),
22678
+ React__default.createElement(TaxonomyCard.BlockContent, _extends$2._extends({
22679
+ serializers: getSerializers(client, pageview, videoAccountIDs, function () {}, true, drupalLeadSettings, currentPage, false),
22680
+ blocks: [].concat(toConsumableArray._toConsumableArray(body.slice(_selectedIndex2))),
22681
+ imageOptions: { w: 320, h: 240, fit: 'max' }
22682
+ }, client.config()))
22683
+ );
22684
+ } else {
22685
+ return React__default.createElement(TaxonomyCard.BlockContent, _extends$2._extends({
22686
+ serializers: getSerializers(client, pageview, videoAccountIDs, function () {}, true, drupalLeadSettings, currentPage, false),
22687
+ blocks: articleBody,
22688
+ imageOptions: { w: 320, h: 240, fit: 'max' }
22689
+ }, client.config()));
22690
+ }
22691
+ };
22692
+
22693
+ var detail = function detail() {
22694
+ var shareVia = shareOptions.shareVia,
22695
+ shareSubject = shareOptions.shareSubject,
22696
+ twitterSiteName = shareOptions.twitterSiteName,
22697
+ shareImageDefault = shareOptions.shareImageDefault,
22698
+ shareBaseUrl = shareOptions.shareBaseUrl,
22699
+ shareSiteTitle = shareOptions.shareSiteTitle;
22700
+
22701
+ var shareUrl = shareBaseUrl + props.article.url.current;
22702
+ var shareTitle = article.title;
22703
+ var shareSummary = article.summary;
22704
+ var shareImage = thumbnail && thumbnail.asset ? urlFor$6(props.client, thumbnail.asset).url() : shareImageDefault;
22705
+ var siteName = props.website && props.website.title ? props.website.title : '';
22706
+
22707
+ var meta = {
22708
+ shareTitle: shareTitle,
22709
+ shareSiteName: props.cache.siteSettingCache.name,
22710
+ shareSummary: shareSummary,
22711
+ shareUrl: shareUrl,
22712
+ shareImage: shareImage,
22713
+ shareVia: props.Settings.title
22714
+ };
22715
+ if (!props.infiniteScroll) {
22716
+ changeUrl = function changeUrl() {
22717
+ return null;
22718
+ };
22719
+ }
22720
+
22721
+ return React__default.createElement(
22722
+ React__default.Fragment,
22723
+ null,
22724
+ React__default.createElement(
22725
+ InscreenSensor,
22726
+ {
22727
+ offSetTop: 45,
22728
+ onChange: function onChange(visible) {
22729
+ if (visible !== false) {
22730
+ changeUrl(url, visible, meta);
22731
+ }
22732
+ } },
22733
+ React__default.createElement(
22734
+ 'div',
22735
+ null,
22736
+ React__default.createElement(
22737
+ Head,
22738
+ null,
22739
+ React__default.createElement(
22740
+ 'title',
22741
+ { key: 'title' },
22742
+ shareTitle + ' | ' + props.cache.siteSettingCache.name
22743
+ ),
22744
+ React__default.createElement('meta', { name: 'description', key: 'description', content: shareSummary }),
22745
+ passwordLock && React__default.createElement('meta', { name: 'robots', content: 'noindex, nofollow' }),
22746
+ React__default.createElement('meta', { property: 'og:url', content: shareUrl, key: 'og:url' }),
22747
+ React__default.createElement('meta', { property: 'og:title', content: shareTitle, key: 'og:title' }),
22748
+ React__default.createElement('meta', { property: 'og:image', content: shareImage, key: 'og:image' }),
22749
+ React__default.createElement('meta', { property: 'og:site_name', content: props.Settings.title, key: 'og:site_name' }),
22750
+ React__default.createElement('meta', { property: 'og:description', content: shareSummary, key: 'og:description' }),
22751
+ React__default.createElement('meta', { name: 'twitter:card', content: 'summary', key: 'twitter:card' }),
22752
+ React__default.createElement('meta', { name: 'twitter:title', content: shareTitle, key: 'twitter:title' }),
22753
+ React__default.createElement('meta', { name: 'twitter:image', content: shareImage, key: 'twitter:image' }),
22754
+ React__default.createElement('meta', { name: 'twitter:site', content: '@' + props.Settings.title, key: 'twitter:site' }),
22755
+ React__default.createElement('meta', { name: 'twitter:description', content: shareSummary, key: 'twitter:description' }),
22756
+ React__default.createElement(
22757
+ 'noscript',
22758
+ null,
22759
+ props.article.seriesDetail && props.article.seriesDetail.prevUrl && React__default.createElement('link', { rel: 'prev', href: props.article.seriesDetail.prevUrl }),
22760
+ props.article.seriesDetail && props.article.seriesDetail.nextUrl && React__default.createElement('link', { rel: 'next', href: props.article.seriesDetail.nextUrl })
22761
+ )
22762
+ ),
22763
+ React__default.createElement(
22764
+ 'div',
22765
+ { className: 'video-detail', style: { marginBottom: isCutomPage(props.article) ? '150px' : 0 } },
22766
+ React__default.createElement(
22767
+ 'h1',
22768
+ { className: 'page-title' },
22769
+ title
22770
+ ),
22771
+ React__default.createElement(
22772
+ 'div',
22773
+ { className: 'mb-4 doc-group-container', style: { display: 'flex', justifyContent: 'space-between', alignItems: 'flex-end' } },
22774
+ React__default.createElement(
22775
+ 'style',
22776
+ { jsx: 'true' },
22777
+ '\n @media screen and (max-width: 468px) {\n .video-detail .doc-group-container {\n flex-direction: column;\n align-items: flex-start !important;\n }\n .video-detail .doc-group {\n margin-top: 2rem;\n width: calc(100vw - 45px);\n align-items: center;\n }\n .video-detail .doc-group img,\n .doc-group p {\n max-width: calc(100vw - 45px) !important;\n }\n }\n '
22778
+ ),
22779
+ React__default.createElement(
22780
+ 'div',
22781
+ { className: 'left-wrap' },
22782
+ React__default.createElement(
22783
+ 'div',
22784
+ null,
22785
+ moment.moment(published).format('LL')
22786
+ ),
22787
+ React__default.createElement(
22788
+ 'div',
22789
+ { className: 'mb-3' },
22790
+ authorDetails && authorDetails.map(function (authorDetail, index) {
22791
+ return React__default.createElement(
22792
+ 'span',
22793
+ { key: index },
22794
+ renderAuthor$2(authorDetail.displayName, authorDetail.url, index, authorDetails.length, authorPrefix)
22795
+ );
22796
+ }),
22797
+ React__default.createElement(
22798
+ 'div',
22799
+ null,
22800
+ source && React__default.createElement(
22801
+ 'p',
22802
+ null,
22803
+ source
22804
+ )
22805
+ ),
22806
+ issue && React__default.createElement(
22807
+ 'div',
22808
+ null,
22809
+ React__default.createElement(
22810
+ 'div',
22811
+ { className: 'volume-issue' },
22812
+ React__default.createElement(
22813
+ 'p',
22814
+ null,
22815
+ issue.volume && React__default.createElement(
22816
+ 'span',
22817
+ null,
22818
+ 'Volume ' + issue.volume,
22819
+ ','
22820
+ ),
22821
+ issue.issueNumber && React__default.createElement(
22822
+ 'span',
22823
+ null,
22824
+ ' Issue ' + issue.issueNumber
22825
+ )
22826
+ )
22827
+ )
22828
+ ),
22829
+ pageNumber && React__default.createElement(
22830
+ 'div',
22831
+ { className: 'article-pageNumber' },
22832
+ 'Page Number: ' + pageNumber
22833
+ )
22834
+ ),
22835
+ React__default.createElement(
22836
+ 'p',
22837
+ null,
22838
+ React__default.createElement(SocialShare$1, {
22839
+ shareUrl: shareUrl,
22840
+ shareTitle: shareTitle,
22841
+ shareVia: shareVia,
22842
+ shareSummary: shareSummary,
22843
+ shareSubject: shareSubject,
22844
+ shareImage: shareImage,
22845
+ size: 32,
22846
+ siteName: siteName,
22847
+ twitterSiteName: twitterSiteName,
22848
+ disableMeta: true
22849
+ })
22850
+ ),
22851
+ renderRelevantTopicsDropdown()
22852
+ ),
22853
+ React__default.createElement(
22854
+ 'div',
22855
+ null,
22856
+ React__default.createElement(DocumentGroup, { article: props.article, client: props.client })
22857
+ )
22858
+ ),
22859
+ React__default.createElement(
22860
+ 'p',
22861
+ null,
22862
+ React__default.createElement('div', null),
22863
+ React__default.createElement(
22864
+ 'em',
22865
+ null,
22866
+ summary
22867
+ ),
22868
+ React__default.createElement('br', null),
22869
+ React__default.createElement('br', null)
22870
+ ),
22871
+ React__default.createElement(
22872
+ 'div',
22873
+ { className: 'ad-box', style: { textAlign: 'center' } },
22874
+ main.main_39 && props.article.Ads && props.article.Ads.length > 0 && props.article.Ads.map(function (ad, index) {
22875
+ if (index === 0) {
22876
+ return React__default.createElement(
22877
+ 'div',
22878
+ {
22879
+ key: index,
22880
+ id: 'addid-' + index,
22881
+ style: {
22882
+ display: 'flex',
22883
+ flex: '1 0 auto',
22884
+ justifyContent: 'center',
22885
+ alignItems: 'center',
22886
+ textAlign: 'center'
22887
+ } },
22888
+ ad.component
22889
+ );
22890
+ }
22891
+ })
22892
+ ),
22893
+ React__default.createElement(
22894
+ 'div',
22895
+ { className: 'block-content' },
22896
+ renderBlockContent(props.article),
22897
+ React__default.createElement(
22898
+ 'noscript',
22899
+ null,
22900
+ React__default.createElement(
22901
+ 'div',
22902
+ { style: { display: 'flex', justifyContent: 'center' }, className: 'series-links' },
22903
+ props.article.seriesDetail && props.article.seriesDetail.prevUrl && React__default.createElement(
22904
+ 'a',
22905
+ { className: 'mx-3', href: props.article.seriesDetail.prevUrl },
22906
+ 'Previous ',
22907
+ props.article.seriesDetail.type
22908
+ ),
22909
+ props.article.seriesDetail && props.article.seriesDetail.nextUrl && React__default.createElement(
22910
+ 'a',
22911
+ { className: 'mx-3', href: props.article.seriesDetail.nextUrl },
22912
+ 'Next ',
22913
+ props.article.seriesDetail.type
22914
+ )
22915
+ )
22916
+ ),
22917
+ issue && issue.url && React__default.createElement(
22918
+ 'a',
22919
+ { href: issue.url, target: '_blank', title: 'Download issue' },
22920
+ React__default.createElement('img', { style: { margin: '1rem', maxHeight: '40px', maxWidth: '40px' }, src: '/download.png', alt: 'download issue' }),
22921
+ 'Download Issue : ',
22922
+ issue.name
22923
+ )
22924
+ )
22925
+ ),
22926
+ renderIsiContent(props.article)
22927
+ )
22928
+ ),
22929
+ main.main_39 && props.article.Ads && props.article.Ads.length > 0 && props.article.Ads.map(function (ad, index) {
22930
+ if (index > 0) {
22931
+ return React__default.createElement(
22932
+ 'div',
22933
+ { key: index, id: 'addid-' + index, style: { display: 'flex', flex: '1 0 auto' } },
22934
+ ad.component
22935
+ );
22936
+ }
22937
+ }),
22938
+ React__default.createElement('div', { className: 'clearfix', style: { minHeight: '1px' } }),
22939
+ React__default.createElement('hr', { className: 'article-seperater my-5' })
22940
+ );
22941
+ };
22942
+
22943
+ if (passwordLock) {
22944
+ if (auth === 2) {
22945
+ return detail();
22946
+ } else {
22947
+ return form();
22948
+ }
22949
+ } else {
22950
+ return detail();
22951
+ }
22952
+ };
22953
+
22954
+ var defineProperty$1 = _commonjsHelpers.createCommonjsModule(function (module, exports) {
22955
+
22956
+ exports.__esModule = true;
22957
+
22958
+
22959
+
22960
+ var _defineProperty2 = _interopRequireDefault(inherits$2.defineProperty);
22961
+
22962
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
22963
+
22964
+ exports.default = function (obj, key, value) {
22965
+ if (key in obj) {
22966
+ (0, _defineProperty2.default)(obj, key, {
22967
+ value: value,
22968
+ enumerable: true,
22969
+ configurable: true,
22970
+ writable: true
22971
+ });
22972
+ } else {
22973
+ obj[key] = value;
22974
+ }
22975
+
22976
+ return obj;
22977
+ };
22978
+ });
22979
+
22980
+ var _defineProperty$1 = _commonjsHelpers.unwrapExports(defineProperty$1);
22981
+
22982
+ var getTargeting = function getTargeting(props) {
22983
+ var article = props.article,
22984
+ position = props.position,
22985
+ prevUrl = props.prevUrl,
22986
+ _props$cpModification = props.cpModificationRequired,
22987
+ cpModificationRequired = _props$cpModification === undefined ? true : _props$cpModification;
22988
+ var _article$internalTag = article.internalTag,
22989
+ internalTag = _article$internalTag === undefined ? [] : _article$internalTag,
22990
+ _article$userDefinedT = article.userDefinedTag,
22991
+ userDefinedTag = _article$userDefinedT === undefined ? [] : _article$userDefinedT,
22992
+ _article$SponsorshipT = article.SponsorshipTag,
22993
+ SponsorshipTag = _article$SponsorshipT === undefined ? [] : _article$SponsorshipT,
22994
+ _article$seoTag = article.seoTag,
22995
+ seoTag = _article$seoTag === undefined ? [] : _article$seoTag,
22996
+ _article$url = article.url;
22997
+ _article$url = _article$url === undefined ? {
22998
+ current: ''
22999
+ } : _article$url;
23000
+ var url = _article$url.current,
23001
+ _article$documentGrou = article.documentGroup;
23002
+ _article$documentGrou = _article$documentGrou === undefined ? {
23003
+ path: ''
23004
+ } : _article$documentGrou;
23005
+ var document_group = _article$documentGrou.path,
23006
+ content_placement = article.content_placement;
23007
+
23008
+ var context = url;
23009
+ var localHistory = props.historyCookie ? JSON.parse(props.historyCookie) : [];
23010
+ if (!context && localHistory) {
23011
+ context = localHistory[localHistory.length - 1];
23012
+ }
23013
+ context = context && context.split('?')[0];
23014
+ context = context && context.split('&')[0];
23015
+ var content_placement_urls = [];
23016
+ if (content_placement && prevUrl && prevUrl.length) {
23017
+ content_placement.forEach(function (item) {
23018
+ var path = item.path;
23019
+ if (cpModificationRequired) {
23020
+ path = getContentPlacementUrl(item);
23021
+ }
23022
+
23023
+ if (includes_1(prevUrl, path)) {
23024
+ content_placement_urls.push(path);
23025
+ }
23026
+ });
23027
+ }
23028
+
23029
+ if (content_placement) {
23030
+ if (content_placement_urls.length === 0) {
23031
+ content_placement_urls = content_placement.map(function (item) {
23032
+ return cpModificationRequired ? getContentPlacementUrl(item) : item.path;
23033
+ });
23034
+ }
23035
+ } else {
23036
+ content_placement_urls = ['/'];
23037
+ }
23038
+ var articleKeywords = [].concat(toConsumableArray._toConsumableArray(internalTag), toConsumableArray._toConsumableArray(userDefinedTag), toConsumableArray._toConsumableArray(SponsorshipTag), toConsumableArray._toConsumableArray(seoTag));
23039
+ var targeting = {
23040
+ tags: articleKeywords,
23041
+ document_group: [document_group],
23042
+ document_url: [url],
23043
+ content_placement: content_placement_urls
23044
+ };
23045
+
23046
+ if (article.issue && article.issue.path) {
23047
+ targeting.issue_url = [article.issue.path];
23048
+ if (article.issue.publication && article.issue.publication.path) {
23049
+ targeting.publication_url = [article.issue.publication.path];
23050
+ }
23051
+ }
23052
+
23053
+ if (props.cache && props.cache.hyperTargeting) {
23054
+ targeting = _extends$2._extends({}, targeting, { campaign_id: props.cache.hyperTargeting });
23055
+ }
23056
+
23057
+ if (position && position.length) {
23058
+ targeting['pos'] = position;
23059
+ }
23060
+ return targeting;
23061
+ };
23062
+
23063
+ var ArticleQueue$1 = function ArticleQueue(props) {
23064
+ var _props$prevUrl = props.prevUrl,
23065
+ Ads = props.Ads,
23066
+ _props$maxListLength = props.maxListLength,
23067
+ maxListLength = _props$maxListLength === undefined ? 10 : _props$maxListLength,
23068
+ _props$sponsoredTaxon = props.sponsoredTaxonomies,
23069
+ sponsoredTaxonomies = _props$sponsoredTaxon === undefined ? [] : _props$sponsoredTaxon,
23070
+ _props$cpModification = props.cpModificationRequired,
23071
+ cpModificationRequired = _props$cpModification === undefined ? false : _props$cpModification,
23072
+ _props$authorPrefix = props.authorPrefix,
23073
+ authorPrefix = _props$authorPrefix === undefined ? 'authors' : _props$authorPrefix;
23074
+
23075
+
23076
+ var firstArticle = function firstArticle() {
23077
+ var article = _extends$2._Object$assign({}, props.article);
23078
+ var targeting = getTargeting(props);
23079
+ article.Ads = Ads.getRightItems(targeting);
23080
+ return article;
23081
+ };
23082
+
23083
+ var _useState = React.useState([firstArticle()]),
23084
+ _useState2 = slicedToArray._slicedToArray(_useState, 2),
23085
+ queueData = _useState2[0],
23086
+ setQueueData = _useState2[1];
23087
+
23088
+ var refreshAD = function refreshAD(path) {
23089
+ if (!main.main_39) {
23090
+ var activeArticle = queueData.find(function (item) {
23091
+ return item.url.current === path;
23092
+ });
23093
+ var targeting = getTargeting(props);
23094
+ debounce.lib_3.getGoogletag().then(function (googletag) {
23095
+ if (window.googletag && googletag.pubadsReady) {
23096
+ var slots = googletag.pubads().getSlots();
23097
+ slots.forEach(function (slot) {
23098
+ var pos = slot.getTargeting('pos');
23099
+ slot.clearTargeting();
23100
+ _Object$keys(targeting).forEach(function (key) {
23101
+ slot.setTargeting(key, targeting[key]);
23102
+ });
23103
+ slot.setTargeting('pos', pos);
23104
+ });
23105
+ debounce.lib_3.refresh();
23106
+ }
23107
+ });
23108
+ }
23109
+ };
23110
+
23111
+ var checkSponseredArticle = function checkSponseredArticle(article) {
23112
+ var _article$taxonomyMapp = article.taxonomyMapping,
23113
+ taxonomyMapping = _article$taxonomyMapp === undefined ? [] : _article$taxonomyMapp;
23114
+
23115
+ if (props.checkSponsered) {
23116
+ return taxonomyMapping.some(function (item) {
23117
+ return includes_1(sponsoredTaxonomies, item._ref);
23118
+ });
23119
+ } else {
23120
+ return false;
23121
+ }
23122
+ };
23123
+
23124
+ var preVscroll = 0;
23125
+ var isScrollDown = true;
23126
+
23127
+ var scrollDirectionDetect = function scrollDirectionDetect(e) {
23128
+ var window = e.currentTarget;
23129
+ if (preVscroll > window.scrollY) {
23130
+ if (!isScrollDown) {
23131
+ isScrollDown = true;
23132
+ }
23133
+ } else if (preVscroll < window.scrollY) {
23134
+ if (isScrollDown) {
23135
+ isScrollDown = false;
23136
+ }
23137
+ }
23138
+ preVscroll = window.scrollY;
23139
+ };
23140
+
23141
+ React.useEffect(function () {
23142
+ window.addEventListener('scroll', scrollDirectionDetect);
23143
+ return function () {
23144
+ return window.removeEventListener('scroll', scrollDirectionDetect);
23145
+ };
23146
+ });
23147
+
23148
+ var loadmore = function loadmore() {
23149
+ var query = props.relatedArticleQuery;
23150
+ var params = props.params;
23151
+ if (queueData && queueData.length < maxListLength) {
23152
+ params.index = queueData.length - 1;
23153
+ props.client.fetch(query, params).then(function (article) {
23154
+ if (article && article._id) {
23155
+ var targeting = getTargeting({ article: article });
23156
+ article.Ads = Ads.getRightItems(targeting);
23157
+ setQueueData([].concat(toConsumableArray._toConsumableArray(queueData), [article]));
23158
+ }
23159
+ });
23160
+ }
23161
+ };
23162
+
23163
+ var changeMeta = function changeMeta(meta) {
23164
+ document.title = meta.shareTitle;
23165
+ document.querySelector('meta[name="description"]').setAttribute('content', meta.shareSummary);
23166
+ document.querySelector('meta[property="og:url"]').setAttribute('content', meta.shareUrl);
23167
+ document.querySelector('meta[property="og:title"]').setAttribute('content', meta.shareTitle);
23168
+ document.querySelector('meta[property="og:site_name"]').setAttribute('content', meta.shareVia);
23169
+ document.querySelector('meta[property="og:description"]').setAttribute('content', meta.shareSummary);
23170
+ document.querySelector('meta[name="twitter:title"]').setAttribute('content', meta.shareTitle);
23171
+ document.querySelector('meta[name="twitter:image"]').setAttribute('content', meta.shareImage);
23172
+ document.querySelector('meta[name="twitter:site"]').setAttribute('content', meta.shareVia);
23173
+ document.querySelector('meta[name="twitter:description"]').setAttribute('content', meta.shareSummary);
23174
+ };
23175
+
23176
+ var changeUrl = function changeUrl(path, visibility, meta) {
23177
+ var newPath = '/view/' + path;
23178
+ if (!isScrollDown) {
23179
+ if (visibility === 'top') {
23180
+ // router.push('/view/[url]', newPath, { shallow: true })
23181
+ window.history.pushState({ page: path }, path, newPath);
23182
+ if (props.pageview) {
23183
+ props.pageview(newPath);
23184
+ }
23185
+ refreshAD(path);
23186
+ changeMeta(meta);
23187
+ }
23188
+ } else {
23189
+ if (visibility === 'bottom') {
23190
+ // router.push('/view/[url]', newPath, { shallow: true })
23191
+ window.history.pushState({ page: path }, path, newPath);
23192
+ if (props.pageview) {
23193
+ props.pageview(newPath);
23194
+ }
23195
+ refreshAD(path);
23196
+ changeMeta(meta);
23197
+ }
23198
+ }
23199
+ };
23200
+
23201
+ return React__default.createElement(
23202
+ visibilitySensor.InfiniteScroll,
23203
+ { dataLength: queueData.length, next: loadmore, scrollThreshold: '60%', hasMore: true, style: { overflow: 'hidden' } },
23204
+ queueData.map(function (article, index) {
23205
+ if (!checkSponseredArticle(article) && Ads.getVideoContextualAD) {
23206
+ article.contextualVideoAD = Ads.getVideoContextualAD(getTargeting(props));
23207
+ }
23208
+ if (!checkSponseredArticle(article) && Ads.getNativeContextualAD) {
23209
+ article.contextualAD = Ads.getNativeContextualAD(getTargeting(props));
23210
+ }
23211
+ return React__default.createElement(Article$1, _extends$2._extends({ key: index }, props, { changeUrl: changeUrl, authorPrfix: authorPrefix, article: article, cpModificationRequired: cpModificationRequired }));
23212
+ })
23213
+ );
23214
+ };
23215
+
23216
+ var Articles = function Articles(props) {
23217
+ var _extends2;
23218
+
23219
+ var videoAccountIDs = props.videoAccountIDs,
23220
+ Ads = props.Ads,
23221
+ Settings = props.Settings,
23222
+ ISIContent = props.ISIContent,
23223
+ prevUrl = props.prevUrl,
23224
+ setActiveArticle = props.setActiveArticle,
23225
+ article = props.article,
23226
+ client = props.client,
23227
+ relatedArticleQuery = props.relatedArticleQuery,
23228
+ Website = props.Website,
23229
+ pageview = props.pageview,
23230
+ shareOptions = props.shareOptions,
23231
+ WAds = props.WAds,
23232
+ regionalPages = props.regionalPages,
23233
+ nationalPage = props.nationalPage;
23234
+ var taxonomyMapping = article.taxonomyMapping,
23235
+ _article$url = article.url;
23236
+ _article$url = _article$url === undefined ? {
23237
+ current: null
23238
+ } : _article$url;
23239
+ var url = _article$url.current,
23240
+ content_placement = article.content_placement;
23241
+
23242
+
23243
+ var taxonomy = [];
23244
+ content_placement.forEach(function (_ref2) {
23245
+ var path = _ref2.path,
23246
+ _id = _ref2._id;
23247
+
23248
+ if (includes_1(prevUrl, path)) taxonomy.push(_id);
23249
+ });
23250
+
23251
+ if (taxonomy.length === 0) {
23252
+ taxonomy = taxonomyMapping.map(function (_ref3) {
23253
+ var _ref = _ref3._ref;
23254
+ return _ref;
23255
+ });
23256
+ }
23257
+
23258
+ var params = {
23259
+ url: url,
23260
+ taxonomy: taxonomy,
23261
+ index: 0
23262
+ };
23263
+
23264
+ return React__default.createElement(ArticleQueue$1, _extends$2._extends((_extends2 = {
23265
+ client: client,
23266
+ params: params,
23267
+ relatedArticleQuery: relatedArticleQuery,
23268
+ website: Website,
23269
+ checkSponsered: true,
23270
+ pageview: pageview,
23271
+ shareOptions: shareOptions,
23272
+ Ads: WAds,
23273
+ regionalPages: regionalPages,
23274
+ nationalPage: nationalPage
23275
+ }, _defineProperty$1(_extends2, 'pageview', pageview), _defineProperty$1(_extends2, 'onVote', function onVote() {}), _defineProperty$1(_extends2, 'ISIContent', ISIContent), _defineProperty$1(_extends2, 'videoAccountIDs', videoAccountIDs), _defineProperty$1(_extends2, 'sponsoredTaxonomies', []), _defineProperty$1(_extends2, 'cpModificationRequired', true), _defineProperty$1(_extends2, 'Settings', Settings), _extends2), props));
23276
+ };
23277
+
23278
+ var View = function View(props) {
23279
+ var shareOptions = props.shareOptions,
23280
+ article = props.article;
23281
+ var _props$article = props.article,
23282
+ _props$article$passwo = _props$article.passwordLock,
23283
+ passwordLock = _props$article$passwo === undefined ? false : _props$article$passwo,
23284
+ description = _props$article.description,
23285
+ title = _props$article.title;
23286
+
23287
+ //disable infinite scroll
23288
+
23289
+ var checkVideoSeries = function checkVideoSeries(article) {
23290
+ for (var i = 0; i < article.body.length; i++) {
23291
+ var row = article.body[i];
23292
+ if (typeof row.videos !== 'undefined') {
23293
+ return true;
23294
+ }
23295
+ }
23296
+ return false;
23297
+ };
23298
+ var isVideoSeries = checkVideoSeries(props.article);
23299
+ var needInfiniteScroll = ['Articles', 'Videos', 'Podcasts'].includes(article.category.name) && article.taxonomyMapping && article.passwordLock !== true && !isVideoSeries && !article.ExcludeFromInfiniteScroll;
23300
+
23301
+ if (['Articles', 'Videos', 'Podcasts'].includes(article.category.name)) {
23302
+ description = null;
23303
+ title = null;
23304
+ }
23305
+
23306
+ if (!needInfiniteScroll && !title) {
23307
+ title = props.article ? props.article.title : '';
23308
+ }
23309
+
23310
+ return React__default.createElement(
23311
+ React__default.Fragment,
23312
+ null,
23313
+ React__default.createElement(
23314
+ Head,
23315
+ null,
23316
+ React__default.createElement(
23317
+ 'title',
23318
+ { key: 'title' },
23319
+ article.title + ' | ' + props.cache.siteSettingCache.name
23320
+ ),
23321
+ React__default.createElement('meta', { name: 'description', key: 'description', content: shareOptions.shareSummary }),
23322
+ passwordLock && React__default.createElement('meta', { name: 'robots', content: 'noindex, nofollow' }),
23323
+ React__default.createElement('meta', { property: 'og:url', content: shareOptions.shareUrl, key: 'og:url' }),
23324
+ React__default.createElement('meta', { property: 'og:title', content: shareOptions.shareTitle, key: 'og:title' }),
23325
+ React__default.createElement('meta', { property: 'og:image', content: shareOptions.shareImage, key: 'og:image' }),
23326
+ React__default.createElement('meta', { property: 'og:site_name', content: props.Settings.title, key: 'og:site_name' }),
23327
+ React__default.createElement('meta', { property: 'og:description', content: shareOptions.shareSummary, key: 'og:description' }),
23328
+ React__default.createElement('meta', { name: 'twitter:card', content: 'summary', key: 'twitter:card' }),
23329
+ React__default.createElement('meta', { name: 'twitter:title', content: shareOptions.shareTitle, key: 'twitter:title' }),
23330
+ React__default.createElement('meta', { name: 'twitter:image', content: shareOptions.shareImage, key: 'twitter:image' }),
23331
+ React__default.createElement('meta', { name: 'twitter:site', content: '@' + props.Settings.title, key: 'twitter:site' }),
23332
+ React__default.createElement('meta', { name: 'twitter:description', content: shareOptions.shareSummary, key: 'twitter:description' })
23333
+ ),
23334
+ !needInfiniteScroll ? React__default.createElement(Article$1, _extends$2._extends({ infiniteScroll: false }, props)) : React__default.createElement(Articles, _extends$2._extends({ infiniteScroll: true }, props))
23335
+ );
23336
+ };
23337
+
23338
+ var getKeywords = function getKeywords(article) {
23339
+ var keywords = [];
23340
+ var internalTag = article.internalTag,
23341
+ userDefinedTag = article.userDefinedTag,
23342
+ SponsorshipTag = article.SponsorshipTag;
23343
+
23344
+
23345
+ if (internalTag) {
23346
+ internalTag.map(function (item) {
23347
+ keywords.push(item);
23348
+ });
23349
+ }
23350
+
23351
+ if (userDefinedTag) {
23352
+ userDefinedTag.map(function (item) {
23353
+ keywords.push(item);
23354
+ });
23355
+ }
23356
+
23357
+ if (SponsorshipTag) {
23358
+ SponsorshipTag.map(function (item) {
23359
+ keywords.push(item);
23360
+ });
23361
+ }
23362
+
23363
+ return keywords;
23364
+ };
23365
+
23366
+ var getQuery = function getQuery(type) {
23367
+ var today = moment.moment().utc().format();
23368
+ switch (type) {
23369
+ case 'related':
23370
+ return '*[\n _type == "article" \n && defined(title) \n && defined(url) \n && !(_id in path("drafts.**")) \n && is_visible == true \n && published <= \'' + today + '\' \n && passwordLock!=true \n && taxonomyMapping[]._ref in $taxonomy \n && contentCategory->.name != \'Poll\' \n && contentCategory->.name != \'Slideshows\' \n && url.current != $url \n && !defined(body[].videos)\n ]| order(published desc)[$index]{\n title,\n published,\n summary,\n thumbnail,\n ...,\n passwordLock,\n password,\n "authorDetails": authorMapping[]->{ displayName, url },\n body[] {\n ...,\n upload_doc {\n _type,\n asset->\n },\n uploadAudio {\n _type,\n asset->\n }\n },\n \'content_placement\': taxonomyMapping[]-> {\n \'ancestor\': parent->parent->identifier,\n \'parent\': parent->identifier,\n \'name\': name,\n \'path\': identifier\n },\n documentGroup-> {\n name,\n thumbnail,\n parent->{...,parent->},\n \'path\': identifier.current\n },\n \'issue\' : *[_type == \'publication\' && !(_id in path("drafts.**")) && is_visible == true && _id == ^.issueGroup._ref][0] {\n name,\n \'path\': identifier.current,\n \'publication\' : *[_type == \'publication\' && !(_id in path("drafts.**")) && is_visible == true && _id == ^.parent._ref][0] {\n name,\n \'path\': identifier.current\n },\n \'url\' : pdf.asset-> url\n }\n }';
23371
+ case 'article':
23372
+ return '*[\n _type == "article" \n && !(_id in path("drafts.**")) \n && defined(title) \n && defined(url) \n && url.current == $url \n ][0]{\n title,\n published,\n summary,\n thumbnail,\n ...,\n passwordLock,\n password,\n "authorDetails": authorMapping[]->{ displayName, url },\n body[] {\n ...,\n upload_doc {\n _type,\n asset->\n },\n uploadAudio {\n _type,\n asset->\n }\n },\n \'content_placement\': taxonomyMapping[]-> {\n ...,\n \'ancestor\': parent->parent->identifier,\n \'parent\': parent->identifier,\n \'name\': name,\n \'path\': identifier\n },\n documentGroup-> {\n name,\n thumbnail,\n parent->{...,parent->},\n \'path\': identifier.current\n },\n \'category\':contentCategory->{\n name\n },\n \'issue\' : *[_type == \'publication\' && !(_id in path("drafts.**")) && is_visible == true && _id == ^.issueGroup._ref][0] {\n name,\n \'path\': identifier.current,\n \'publication\' : *[_type == \'publication\' && !(_id in path("drafts.**")) && is_visible == true && _id == ^.parent._ref][0] {\n name,\n \'path\': identifier.current\n },\n \'url\' : pdf.asset-> url\n }\n \n }';
23373
+ }
23374
+ };
23375
+
22166
23376
  exports.AdSlot = AdSlot.DFPAdSlot;
22167
23377
  exports.Beam = AdSlot.Beam;
22168
23378
  exports.DeckContent = DeckContent;
@@ -22230,6 +23440,11 @@ exports.RelatedTopicsDropdown = RelatedTopicsDropdown;
22230
23440
  exports.SetCookie = SetCookie;
22231
23441
  exports.SocialShare = SocialShare$1;
22232
23442
  exports.VerticalHero = VerticalHero;
23443
+ exports.View = View;
22233
23444
  exports.YahooHero = YahooHero;
23445
+ exports.getKeywords = getKeywords;
23446
+ exports.getQuery = getQuery;
22234
23447
  exports.getSerializers = getSerializers;
22235
23448
  exports.getSeriesDetail = getSeriesDetail;
23449
+ exports.getTargeting = getTargeting;
23450
+ exports.urlFor = urlFor$6;