@mjhls/mjh-framework 1.0.935-segment-test → 1.0.935

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/View.js CHANGED
@@ -351,9 +351,9 @@ var ISI = function ISI(props) {
351
351
  );
352
352
  };
353
353
 
354
- var css$1 = ".RelatedArticles-module_mediaContainer__10h9k {\n display: flex;\n flex-direction: row;\n flex-wrap: nowrap;\n margin: 0 -1rem;\n}\n.RelatedArticles-module_mediaCard__3wQbn {\n margin: 0 1rem 1rem;\n width: calc(33% - 1rem);\n display: column;\n flex-direction: row;\n margin-bottom: 0.75rem;\n padding-bottom: 0.75rem;\n border-bottom: none;\n}\n.RelatedArticles-module_mediaCard__3wQbn:last-child {\n border-bottom: none;\n}\n.RelatedArticles-module_cardTitle__3P-Ib {\n font-weight: bold;\n color: #252525;\n margin-bottom: 0.25rem;\n font-size: 15px;\n}\n.RelatedArticles-module_authorListing__1EFg4 span.RelatedArticles-module_text-muted__3b0zX {\n color: #000;\n font-weight: bold;\n}\n.RelatedArticles-module_cardDate__1wOR5 {\n color: var(--dark);\n display: block;\n background: #fff !important;\n margin-bottom: 0;\n}\n.RelatedArticles-module_imgWrapper__5Jx_4 {\n display: block;\n text-align: center;\n margin-bottom: 0.5rem;\n}\n.RelatedArticles-module_imgWrapper__5Jx_4 img {\n height: 135px;\n width: 100%;\n object-fit: cover;\n object-position: center;\n}\n@media screen and (max-width: 1064px) {\n}\n@media screen and (max-width: 968px) {\n .RelatedArticles-module_mediaContainer__10h9k {\n flex-wrap: wrap;\n }\n .RelatedArticles-module_imgWrapper__5Jx_4 {\n display: none;\n }\n .RelatedArticles-module_mediaCard__3wQbn {\n width: 100%;\n margin-bottom: 0.5rem;\n padding: 0;\n }\n .RelatedArticles-module_cardTitle__3P-Ib {\n font-size: 0.75rem;\n margin-bottom: 0;\n }\n}\n";
355
- var styles$1 = { "mediaContainer": "RelatedArticles-module_mediaContainer__10h9k", "mediaCard": "RelatedArticles-module_mediaCard__3wQbn", "cardTitle": "RelatedArticles-module_cardTitle__3P-Ib", "authorListing": "RelatedArticles-module_authorListing__1EFg4", "text-muted": "RelatedArticles-module_text-muted__3b0zX", "cardDate": "RelatedArticles-module_cardDate__1wOR5", "imgWrapper": "RelatedArticles-module_imgWrapper__5Jx_4" };
356
- styleInject_es.styleInject(css$1);
354
+ var css = ".RelatedArticles-module_mediaContainer__10h9k {\n display: flex;\n flex-direction: row;\n flex-wrap: nowrap;\n margin: 0 -1rem;\n}\n.RelatedArticles-module_mediaCard__3wQbn {\n margin: 0 1rem 1rem;\n width: calc(33% - 1rem);\n display: column;\n flex-direction: row;\n margin-bottom: 0.75rem;\n padding-bottom: 0.75rem;\n border-bottom: none;\n}\n.RelatedArticles-module_mediaCard__3wQbn:last-child {\n border-bottom: none;\n}\n.RelatedArticles-module_cardTitle__3P-Ib {\n font-weight: bold;\n color: #252525;\n margin-bottom: 0.25rem;\n font-size: 15px;\n}\n.RelatedArticles-module_authorListing__1EFg4 span.RelatedArticles-module_text-muted__3b0zX {\n color: #000;\n font-weight: bold;\n}\n.RelatedArticles-module_cardDate__1wOR5 {\n color: var(--dark);\n display: block;\n background: #fff !important;\n margin-bottom: 0;\n}\n.RelatedArticles-module_imgWrapper__5Jx_4 {\n display: block;\n text-align: center;\n margin-bottom: 0.5rem;\n}\n.RelatedArticles-module_imgWrapper__5Jx_4 img {\n height: 135px;\n width: 100%;\n object-fit: cover;\n object-position: center;\n}\n@media screen and (max-width: 1064px) {\n}\n@media screen and (max-width: 968px) {\n .RelatedArticles-module_mediaContainer__10h9k {\n flex-wrap: wrap;\n }\n .RelatedArticles-module_imgWrapper__5Jx_4 {\n display: none;\n }\n .RelatedArticles-module_mediaCard__3wQbn {\n width: 100%;\n margin-bottom: 0.5rem;\n padding: 0;\n }\n .RelatedArticles-module_cardTitle__3P-Ib {\n font-size: 0.75rem;\n margin-bottom: 0;\n }\n}\n";
355
+ var styles = { "mediaContainer": "RelatedArticles-module_mediaContainer__10h9k", "mediaCard": "RelatedArticles-module_mediaCard__3wQbn", "cardTitle": "RelatedArticles-module_cardTitle__3P-Ib", "authorListing": "RelatedArticles-module_authorListing__1EFg4", "text-muted": "RelatedArticles-module_text-muted__3b0zX", "cardDate": "RelatedArticles-module_cardDate__1wOR5", "imgWrapper": "RelatedArticles-module_imgWrapper__5Jx_4" };
356
+ styleInject_es.styleInject(css);
357
357
 
358
358
  var RelatedArticle = function RelatedArticle(_ref) {
359
359
  var articles = _ref.articles,
@@ -367,15 +367,15 @@ var RelatedArticle = function RelatedArticle(_ref) {
367
367
  }
368
368
  return React__default['default'].createElement(
369
369
  'div',
370
- { className: styles$1.mediaContainer },
370
+ { className: styles.mediaContainer },
371
371
  articles.map(function (article, index) {
372
372
  if (article && article.url && article.url.current) {
373
373
  return React__default['default'].createElement(
374
374
  'div',
375
- { id: 'related-card', key: index, className: styles$1.mediaCard },
375
+ { id: 'related-card', key: index, className: styles.mediaCard },
376
376
  React__default['default'].createElement(
377
377
  'a',
378
- { className: styles$1.imgWrapper, href: '/view/' + (article.url ? article.url.current : '') },
378
+ { className: styles.imgWrapper, href: '/view/' + (article.url ? article.url.current : '') },
379
379
  article.thumbnail ? React__default['default'].createElement('img', {
380
380
  style: { objectFit: 'cover', objectPosition: 'center' },
381
381
  src: article.thumbnail && urlFor({ client: client, source: article.thumbnail.asset, imageWidth: 250 }),
@@ -388,13 +388,13 @@ var RelatedArticle = function RelatedArticle(_ref) {
388
388
  ),
389
389
  React__default['default'].createElement(
390
390
  'div',
391
- { className: styles$1.mediaBody },
391
+ { className: styles.mediaBody },
392
392
  React__default['default'].createElement(
393
393
  'a',
394
394
  { href: '/view/' + (article.url ? article.url.current : '') },
395
395
  React__default['default'].createElement(
396
396
  'div',
397
- { className: styles$1.cardTitle },
397
+ { className: styles.cardTitle },
398
398
  article.title
399
399
  )
400
400
  )
@@ -450,336 +450,7 @@ var getSocialShareDisableFlag = function getSocialShareDisableFlag(article) {
450
450
  return showSocialShare;
451
451
  };
452
452
 
453
- var css = ".RecommendedArticles-module_recommendTitle__2kUji {\n border-bottom: 2px solid var(--secondary-blue);\n font-size: 1.5rem;\n font-weight: bold;\n color: #0d335a;\n padding: 0.5rem;\n}\n.RecommendedArticles-module_recommendContainer__sZukI {\n display: flex;\n flex-direction: row;\n flex-wrap: wrap;\n margin: 0 -0.5rem;\n}\n.RecommendedArticles-module_recommendTop__1_yqw {\n margin: 0.5rem;\n width: 100%;\n flex-basis: 100%;\n display: flex;\n\n}\n.RecommendedArticles-module_recommendTopImg__1b9gu {\n min-width: 55%;\n width: 55%;\n height: 100%;\n}\n.RecommendedArticles-module_recommendTopImg__1b9gu img {\n width: 100%;\n height: 100%;\n object-fit: cover;\n}\n.RecommendedArticles-module_recommendTopBody__-13FI {\n margin-left: 1rem;\n line-height: 1.3;\n color: #121212;\n display: flex;\n flex-direction: column;\n}\n.RecommendedArticles-module_topTitle__2EafN {\n font-size: 25px;\n font-weight: bold;\n margin-bottom: 0.5rem;\n}\n.RecommendedArticles-module_topBody__2_VNi {\n font-size: 19px;\n margin-bottom: 0.5rem;\n}\n.RecommendedArticles-module_topLink__2RnXu {\n font-size: 19px;\n color: rgb(43, 43, 151);\n text-decoration: underline;\n margin-top: auto;\n}\n.RecommendedArticles-module_smContainer__4byBO {\n width: calc(25% - 1rem);\n margin: 0 0.5rem;\n}\n.RecommendedArticles-module_smImage__TYZGY img {\n width: 100%;\n}\n.RecommendedArticles-module_title__3q1ud {\n margin-top: 1rem;\n line-height: 1.2;\n color: #121212;\n}\n.RecommendedArticles-module_category__2jRto {\n text-transform: uppercase;\n font-size: 16px;\n letter-spacing: 2px;\n margin: 0.25rem 0;\n}\n\n/* media query */\n\n@media screen and (max-width: 1399px) {\n .RecommendedArticles-module_topTitle__2EafN {\n font-size: 21px;\n }\n .RecommendedArticles-module_topBody__2_VNi {\n font-size: 15px;\n }\n}\n@media screen and (max-width: 1191px) {\n .RecommendedArticles-module_topTitle__2EafN {\n font-size: 23px;\n }\n .RecommendedArticles-module_topBody__2_VNi,\n .RecommendedArticles-module_topLink__2RnXu {\n font-size: 17px;\n }\n}\n@media screen and (max-width: 968px) {\n .RecommendedArticles-module_topTitle__2EafN {\n font-size: 18px;\n }\n .RecommendedArticles-module_topBody__2_VNi,\n .RecommendedArticles-module_topLink__2RnXu {\n font-size: 15px;\n }\n}\n@media screen and (max-width: 768px) {\n .RecommendedArticles-module_recommendTop__1_yqw {\n flex-direction: column;\n }\n .RecommendedArticles-module_recommendTopImg__1b9gu,\n .RecommendedArticles-module_recommendTopBody__-13FI {\n width: 100%;\n margin: 0;\n }\n .RecommendedArticles-module_recommendTopBody__-13FI {\n margin-bottom: 1rem;\n }\n .RecommendedArticles-module_smContainer__4byBO {\n width: calc(50% - 1rem);\n }\n}";
454
- var styles = { "recommendTitle": "RecommendedArticles-module_recommendTitle__2kUji", "recommendContainer": "RecommendedArticles-module_recommendContainer__sZukI", "recommendTop": "RecommendedArticles-module_recommendTop__1_yqw", "recommendTopImg": "RecommendedArticles-module_recommendTopImg__1b9gu", "recommendTopBody": "RecommendedArticles-module_recommendTopBody__-13FI", "topTitle": "RecommendedArticles-module_topTitle__2EafN", "topBody": "RecommendedArticles-module_topBody__2_VNi", "topLink": "RecommendedArticles-module_topLink__2RnXu", "smContainer": "RecommendedArticles-module_smContainer__4byBO", "smImage": "RecommendedArticles-module_smImage__TYZGY", "title": "RecommendedArticles-module_title__3q1ud", "category": "RecommendedArticles-module_category__2jRto" };
455
- styleInject_es.styleInject(css);
456
-
457
- var _this$2 = undefined;
458
-
459
- var Recommended = function Recommended(props) {
460
- var article = props.article,
461
- client = props.client,
462
- _props$index = props.index,
463
- index = _props$index === undefined ? 0 : _props$index,
464
- cpModificationRequired = props.cpModificationRequired;
465
-
466
- var _useState = React.useState(false),
467
- _useState2 = slicedToArray._slicedToArray(_useState, 2),
468
- segmentLoaded = _useState2[0],
469
- setSegmentLoaded = _useState2[1];
470
-
471
- var _useState3 = React.useState([]),
472
- _useState4 = slicedToArray._slicedToArray(_useState3, 2),
473
- articles = _useState4[0],
474
- setArticles = _useState4[1];
475
-
476
- var _useState5 = React.useState(false),
477
- _useState6 = slicedToArray._slicedToArray(_useState5, 2),
478
- loaded = _useState6[0],
479
- setLoaded = _useState6[1];
480
-
481
- var starting = index * 5;
482
- var contentMapping = {
483
- videos: 'video',
484
- articles: 'article',
485
- podcasts: 'podcast'
486
- };
487
-
488
- var mainCategories = article.content_placement.filter(function (cp) {
489
- return cp.usedForRecommendations === true;
490
- }).map(function (cp) {
491
- return cp.name;
492
- }).sort();
493
-
494
- React.useEffect(function () {
495
- try {
496
- if (!segmentLoaded) {
497
- return;
498
- }
499
- if (mainCategories.length > 0) {
500
- //console.log(mainCategories)
501
- analytics.track('Article Category Viewed', {
502
- categories: stringify._JSON$stringify(mainCategories)
503
- });
504
- }
505
- var anonymousId = analytics.user().anonymousId();
506
- // get users traits
507
- var getSegmentProfile = function () {
508
- var _ref = asyncToGenerator._asyncToGenerator( /*#__PURE__*/asyncToGenerator.regenerator.mark(function _callee() {
509
- var response, data, favoriteCategories, articlesQuery, videosQuery, podcastQuery, params, _ref2, _ref3, _articles, videos, podcasts;
510
-
511
- return asyncToGenerator.regenerator.wrap(function _callee$(_context) {
512
- while (1) {
513
- switch (_context.prev = _context.next) {
514
- case 0:
515
- _context.next = 2;
516
- return fetch('/api/getSegmentProfile', {
517
- method: 'POST',
518
- body: stringify._JSON$stringify({ anonymousId: anonymousId })
519
- });
520
-
521
- case 2:
522
- response = _context.sent;
523
- _context.next = 5;
524
- return response.json();
525
-
526
- case 5:
527
- data = _context.sent;
528
-
529
- if (!(data && data.traits && data.traits.favorite_article_category)) {
530
- _context.next = 20;
531
- break;
532
- }
533
-
534
- //console.log('%csegment user profile', 'font-size:1.5rem;color:#000000;padding:1rem;background-color:yellow;', data.traits)
535
- favoriteCategories = JSON.parse(data.traits.favorite_article_category);
536
- // grab 3 articles from sanity different from the one currently being read
537
-
538
- articlesQuery = '*[_type == \'article\'\n && !(_id in path("drafts.**"))\n && defined(title)\n && defined(url)\n && is_visible\n && references(*[_type == \'contentCategory\' && name == \'Articles\']._id)\n && references(*[_type == \'taxonomy\' ' + favoriteCategories.map(function (cat) {
539
- return ' && name == \'' + cat + '\' ';
540
- }) + ']._id)\n && defined(published)\n && _id != $id\n && dateTime(published) <= dateTime(now())] | order(published desc) [' + starting + '...' + (starting + 5) + '] {\n ...,\n title,\n thumbnail,\n url,\n contentCategory->,\n published,\n }';
541
- videosQuery = '*[_type == \'article\'\n && !(_id in path("drafts.**"))\n && defined(title)\n && defined(url)\n && is_visible\n && references(*[_type == \'contentCategory\' && name == \'Videos\']._id)\n && references(*[_type == \'taxonomy\' ' + favoriteCategories.map(function (cat) {
542
- return ' && name == \'' + cat + '\' ';
543
- }) + ']._id)\n && defined(published)\n && _id != $id\n && dateTime(published) <= dateTime(now())] | order(published desc) [' + starting + '...' + (starting + 1) + '] {\n ...,\n title,\n thumbnail,\n url,\n contentCategory->,\n published,\n }';
544
- podcastQuery = '*[_type == \'article\'\n && !(_id in path("drafts.**"))\n && defined(title)\n && defined(url)\n && is_visible\n && references(*[_type == \'contentCategory\' && name == \'Podcasts\']._id)\n && references(*[_type == \'taxonomy\' ' + favoriteCategories.map(function (cat) {
545
- return ' && name == \'' + cat + '\' ';
546
- }) + ']._id)\n && defined(published)\n && _id != $id\n && dateTime(published) <= dateTime(now())] | order(published desc) [' + starting + '...' + (starting + 2) + '] {\n ...,\n title,\n thumbnail,\n url,\n contentCategory->,\n published,\n }';
547
- params = {
548
- id: article._id
549
- };
550
- _context.next = 14;
551
- return asyncToGenerator._Promise.all([client.fetch(articlesQuery, params), client.fetch(videosQuery, params), client.fetch(podcastQuery, params)]);
552
-
553
- case 14:
554
- _ref2 = _context.sent;
555
- _ref3 = slicedToArray._slicedToArray(_ref2, 3);
556
- _articles = _ref3[0];
557
- videos = _ref3[1];
558
- podcasts = _ref3[2];
559
-
560
- if (_articles) {
561
- if (videos[0] && _articles[2]) {
562
- _articles[2] = videos[0];
563
- }
564
- if (videos[1] && _articles[4]) {
565
- _articles[4] = videos[1];
566
- }
567
- if (podcasts[0] && _articles[3]) {
568
- _articles[3] = podcasts[0];
569
- }
570
- setArticles(_articles);
571
- }
572
-
573
- case 20:
574
- case 'end':
575
- return _context.stop();
576
- }
577
- }
578
- }, _callee, _this$2);
579
- }));
580
-
581
- return function getSegmentProfile() {
582
- return _ref.apply(this, arguments);
583
- };
584
- }();
585
-
586
- getSegmentProfile();
587
- } catch (err) {
588
- console.log(err);
589
- }
590
- }, [segmentLoaded]);
591
-
592
- React.useEffect(function () {
593
- if (articles && articles.length > 0) {
594
- setLoaded(true);
595
- }
596
- }, [articles]);
597
-
598
- React.useEffect(function () {
599
- try {
600
- analytics.ready(function () {
601
- setSegmentLoaded(function () {
602
- return true;
603
- });
604
- });
605
- } catch (err) {
606
- console.log(err);
607
- }
608
- }, []);
609
-
610
- return React__default['default'].createElement(
611
- 'div',
612
- { id: 'recommended' },
613
- loaded ? React__default['default'].createElement(
614
- React__default['default'].Fragment,
615
- null,
616
- React__default['default'].createElement(
617
- 'h4',
618
- { className: styles.recommendTitle },
619
- 'Recommended For You'
620
- ),
621
- React__default['default'].createElement(
622
- 'div',
623
- { className: styles.recommendContainer, id: 'recommendedContent' },
624
- articles.map(function (article, index) {
625
- if (index === 0) {
626
- return React__default['default'].createElement(
627
- 'div',
628
- { key: article._id + ('-' + index), className: styles.recommendTop },
629
- React__default['default'].createElement(
630
- 'div',
631
- { className: styles.recommendTopImg },
632
- React__default['default'].createElement(
633
- 'a',
634
- { href: '/view/' + article.url.current },
635
- React__default['default'].createElement('img', { src: urlFor({ source: article.thumbnail, client: client, imageHeight: 306, imageWidth: 544 }) })
636
- )
637
- ),
638
- React__default['default'].createElement(
639
- 'div',
640
- { className: styles.recommendTopBody },
641
- React__default['default'].createElement(
642
- 'div',
643
- { className: styles.topTitle },
644
- article.title
645
- ),
646
- React__default['default'].createElement(
647
- 'p',
648
- { className: styles.topBody },
649
- article.summary
650
- ),
651
- React__default['default'].createElement(
652
- 'a',
653
- { href: '/view/' + article.url.current, className: styles.topLink },
654
- '>> ',
655
- 'Read Article'
656
- )
657
- )
658
- );
659
- } else {
660
- return React__default['default'].createElement(
661
- 'div',
662
- { key: article._id + ('-' + index), className: styles.smContainer },
663
- React__default['default'].createElement(
664
- 'div',
665
- { className: styles.category },
666
- contentMapping[article.contentCategory.name.toLowerCase()] ? contentMapping[article.contentCategory.name.toLowerCase()] : article.contentCategory.name
667
- ),
668
- React__default['default'].createElement(
669
- 'a',
670
- { href: '/view/' + article.url.current },
671
- React__default['default'].createElement(
672
- 'div',
673
- { className: styles.smImage },
674
- React__default['default'].createElement('img', { src: urlFor({ source: article.thumbnail, client: client, imageHeight: 270, imageWidth: 480 }) })
675
- ),
676
- React__default['default'].createElement(
677
- 'div',
678
- { className: styles.title },
679
- article.title
680
- )
681
- )
682
- );
683
- }
684
- })
685
- )
686
- ) : React__default['default'].createElement(
687
- 'section',
688
- { id: 'related-content-section', className: 'my-1' },
689
- (article.relatedArticle || RelevantTopics()) && React__default['default'].createElement(
690
- 'p',
691
- { className: 'mb-0' },
692
- React__default['default'].createElement(
693
- 'b',
694
- null,
695
- 'Related Content:'
696
- )
697
- ),
698
- React__default['default'].createElement(RelevantTopics, { article: article, cpModificationRequired: cpModificationRequired, Settings: props.Settings }),
699
- React__default['default'].createElement(
700
- 'div',
701
- { className: 'pt-2' },
702
- React__default['default'].createElement(RelatedArticle, {
703
- articles: article.relatedArticle,
704
- client: client,
705
- fallbackImage: props.Settings.logo,
706
- showRelatedArticleFallbackImage: props.showRelatedArticleFallbackImage
707
- })
708
- )
709
- )
710
- );
711
- };
712
-
713
- var RelevantTopics = function RelevantTopics(props) {
714
- var article = props.article,
715
- cpModificationRequired = props.cpModificationRequired;
716
- var content_placement = article.content_placement,
717
- documentGroupMapping = article.documentGroupMapping,
718
- issueGroup = article.issueGroup;
719
-
720
- if (content_placement && content_placement.length > 0 || documentGroupMapping && documentGroupMapping.length > 0) {
721
- var relatedLinks = [];
722
- if (documentGroupMapping && documentGroupMapping.length > 0) {
723
- documentGroupMapping.forEach(function (documentGroup) {
724
- if (documentGroup.isShow === false || documentGroup.excludeRelatedContents) {
725
- return null;
726
- }
727
- if (documentGroup.parent) {
728
- relatedLinks = [].concat(toConsumableArray._toConsumableArray(relatedLinks), [{
729
- label: documentGroup.name,
730
- href: cpModificationRequired ? getDocumentGroupUrl(documentGroup) : documentGroup.parent.identifier && documentGroup.parent.identifier.current && !documentGroup.path.includes('/') ? '/' + documentGroup.parent.identifier.current + '/' + documentGroup.path : '/' + documentGroup.path
731
- }]);
732
- }
733
- });
734
- }
735
- if (content_placement && content_placement.length > 0) {
736
- content_placement.filter(function (item) {
737
- return item.path !== 'news';
738
- }).forEach(function (cp) {
739
- if (cp.excludeRelatedContents) {
740
- return null;
741
- }
742
- var cp_url = cpModificationRequired ? getTargeting.getContentPlacementUrl(cp) : cp.path;
743
- var href = '/' + cp_url;
744
- relatedLinks = [].concat(toConsumableArray._toConsumableArray(relatedLinks), [{ label: cp.name, href: href }]);
745
- });
746
- }
747
- if (issueGroup && issueGroup.name && issueGroup.identifier && issueGroup.identifier.current && issueGroup.parent && issueGroup.parent.identifier && issueGroup.parent.identifier.current) {
748
- var _props$Settings$issue = props.Settings.issueMapping,
749
- issueMapping = _props$Settings$issue === undefined ? '/publications' : _props$Settings$issue;
750
-
751
- relatedLinks = [].concat(toConsumableArray._toConsumableArray(relatedLinks), [{ label: issueGroup.name, href: issueMapping + '/' + issueGroup.parent.identifier.current + '/' + issueGroup.identifier.current }]);
752
- }
753
- if (relatedLinks && relatedLinks.length > 0) {
754
- return React__default['default'].createElement(
755
- 'div',
756
- null,
757
- relatedLinks.map(function (relatedLink, index) {
758
- if (relatedLink && relatedLink.href && relatedLink.label) {
759
- return React__default['default'].createElement(
760
- 'span',
761
- { key: relatedLink.label, className: 'related-link' },
762
- React__default['default'].createElement(
763
- 'a',
764
- { className: 'related-links', style: { color: 'blue' }, href: relatedLink.href },
765
- relatedLink.label
766
- ),
767
- React__default['default'].createElement(
768
- 'style',
769
- { jsx: 'true' },
770
- '\n .related-link:not(:first-child):before {\n content: \' | \';\n }\n '
771
- )
772
- );
773
- }
774
- })
775
- );
776
- }
777
- return null;
778
- }
779
- return null;
780
- };
781
-
782
- var Article = React__default['default'].memo(React.forwardRef(function (props, ref) {
453
+ var Article = React.forwardRef(function (props, ref) {
783
454
  var onVote = function () {
784
455
  var _ref = asyncToGenerator._asyncToGenerator( /*#__PURE__*/asyncToGenerator.regenerator.mark(function _callee(nodeKey, selectedChoice) {
785
456
  var response, result;
@@ -892,9 +563,7 @@ var Article = React__default['default'].memo(React.forwardRef(function (props, r
892
563
  disqusConfig = props.disqusConfig,
893
564
  showDisqus = props.showDisqus,
894
565
  _props$downloadCitati = props.downloadCitation,
895
- downloadCitation = _props$downloadCitati === undefined ? false : _props$downloadCitati,
896
- _props$useSegmentReco = props.useSegmentRecommendedArticles,
897
- useSegmentRecommendedArticles = _props$useSegmentReco === undefined ? false : _props$useSegmentReco;
566
+ downloadCitation = _props$downloadCitati === undefined ? false : _props$downloadCitati;
898
567
  var sliderData = props.sliderData;
899
568
 
900
569
 
@@ -1127,31 +796,27 @@ var Article = React__default['default'].memo(React.forwardRef(function (props, r
1127
796
 
1128
797
  var RelatedContent = function RelatedContent() {
1129
798
  return React__default['default'].createElement(
1130
- 'div',
1131
- null,
1132
- useSegmentRecommendedArticles ? React__default['default'].createElement(Recommended, { client: client, article: article, index: props.index, Settings: props.Settings, showRelatedArticleFallbackImage: props.showRelatedArticleFallbackImage, cpModificationRequired: cpModificationRequired }) : React__default['default'].createElement(
1133
- 'section',
1134
- { id: 'related-content-section', className: 'my-1' },
1135
- (article.relatedArticle || RelevantTopics()) && React__default['default'].createElement(
1136
- 'p',
1137
- { className: 'mb-0' },
1138
- React__default['default'].createElement(
1139
- 'b',
1140
- null,
1141
- 'Related Content:'
1142
- )
1143
- ),
1144
- React__default['default'].createElement(RelevantTopics, null),
799
+ 'section',
800
+ { id: 'related-content-section', className: 'my-1' },
801
+ (article.relatedArticle || RelevantTopics()) && React__default['default'].createElement(
802
+ 'p',
803
+ { className: 'mb-0' },
1145
804
  React__default['default'].createElement(
1146
- 'div',
1147
- { className: 'pt-2' },
1148
- React__default['default'].createElement(RelatedArticle, {
1149
- articles: article.relatedArticle,
1150
- client: client,
1151
- fallbackImage: props.Settings.logo,
1152
- showRelatedArticleFallbackImage: props.showRelatedArticleFallbackImage
1153
- })
805
+ 'b',
806
+ null,
807
+ 'Related Content:'
1154
808
  )
809
+ ),
810
+ React__default['default'].createElement(RelevantTopics, null),
811
+ React__default['default'].createElement(
812
+ 'div',
813
+ { className: 'pt-2' },
814
+ React__default['default'].createElement(RelatedArticle, {
815
+ articles: article.relatedArticle,
816
+ client: client,
817
+ fallbackImage: props.Settings.logo,
818
+ showRelatedArticleFallbackImage: props.showRelatedArticleFallbackImage
819
+ })
1155
820
  )
1156
821
  );
1157
822
  };
@@ -1762,8 +1427,6 @@ var Article = React__default['default'].memo(React.forwardRef(function (props, r
1762
1427
  } else {
1763
1428
  return detail();
1764
1429
  }
1765
- }), function (prevProps, nextProps) {
1766
- return prevProps.article === nextProps.article;
1767
1430
  });
1768
1431
 
1769
1432
  var _this$1 = undefined;
@@ -2048,8 +1711,7 @@ var ArticleQueue = function ArticleQueue(props) {
2048
1711
  active: active === article._id
2049
1712
  // Passing queueData to check for single article
2050
1713
  , queueData: queueData,
2051
- showRelatedArticles: showRelatedArticles,
2052
- index: index
1714
+ showRelatedArticles: showRelatedArticles
2053
1715
  }))
2054
1716
  );
2055
1717
  })
package/dist/esm/View.js CHANGED
@@ -1,4 +1,4 @@
1
- import { _ as _asyncToGenerator, r as regenerator, a as _Promise } from './asyncToGenerator-958ef5fc.js';
1
+ import { _ as _asyncToGenerator, r as regenerator } from './asyncToGenerator-958ef5fc.js';
2
2
  import { _ as _extends, a as _Object$assign } from './extends-6d8e3924.js';
3
3
  import { a as _getIterator, _ as _slicedToArray } from './slicedToArray-6ebcbfea.js';
4
4
  import React__default, { useState, useRef, useEffect, forwardRef } from 'react';
@@ -18,7 +18,7 @@ import SocialShare from './SocialShare.js';
18
18
  import { r as renderAuthor, g as getSerializers } from './index-6dc67bdb.js';
19
19
  import DFPAdSlot from './AdSlot.js';
20
20
  import { S as SeriesSlider } from './SeriesSlider-45adb8dc.js';
21
- import { a as getContentPlacementUrl, g as getTargeting } from './getTargeting-42f9b439.js';
21
+ import { g as getTargeting, a as getContentPlacementUrl } from './getTargeting-42f9b439.js';
22
22
  import getKeywords from './getKeywords.js';
23
23
  import urlFor from './urlFor.js';
24
24
  import { u as urlForFile } from './urlForFile-b69adffc.js';
@@ -340,9 +340,9 @@ var ISI = function ISI(props) {
340
340
  );
341
341
  };
342
342
 
343
- var css$1 = ".RelatedArticles-module_mediaContainer__10h9k {\n display: flex;\n flex-direction: row;\n flex-wrap: nowrap;\n margin: 0 -1rem;\n}\n.RelatedArticles-module_mediaCard__3wQbn {\n margin: 0 1rem 1rem;\n width: calc(33% - 1rem);\n display: column;\n flex-direction: row;\n margin-bottom: 0.75rem;\n padding-bottom: 0.75rem;\n border-bottom: none;\n}\n.RelatedArticles-module_mediaCard__3wQbn:last-child {\n border-bottom: none;\n}\n.RelatedArticles-module_cardTitle__3P-Ib {\n font-weight: bold;\n color: #252525;\n margin-bottom: 0.25rem;\n font-size: 15px;\n}\n.RelatedArticles-module_authorListing__1EFg4 span.RelatedArticles-module_text-muted__3b0zX {\n color: #000;\n font-weight: bold;\n}\n.RelatedArticles-module_cardDate__1wOR5 {\n color: var(--dark);\n display: block;\n background: #fff !important;\n margin-bottom: 0;\n}\n.RelatedArticles-module_imgWrapper__5Jx_4 {\n display: block;\n text-align: center;\n margin-bottom: 0.5rem;\n}\n.RelatedArticles-module_imgWrapper__5Jx_4 img {\n height: 135px;\n width: 100%;\n object-fit: cover;\n object-position: center;\n}\n@media screen and (max-width: 1064px) {\n}\n@media screen and (max-width: 968px) {\n .RelatedArticles-module_mediaContainer__10h9k {\n flex-wrap: wrap;\n }\n .RelatedArticles-module_imgWrapper__5Jx_4 {\n display: none;\n }\n .RelatedArticles-module_mediaCard__3wQbn {\n width: 100%;\n margin-bottom: 0.5rem;\n padding: 0;\n }\n .RelatedArticles-module_cardTitle__3P-Ib {\n font-size: 0.75rem;\n margin-bottom: 0;\n }\n}\n";
344
- var styles$1 = { "mediaContainer": "RelatedArticles-module_mediaContainer__10h9k", "mediaCard": "RelatedArticles-module_mediaCard__3wQbn", "cardTitle": "RelatedArticles-module_cardTitle__3P-Ib", "authorListing": "RelatedArticles-module_authorListing__1EFg4", "text-muted": "RelatedArticles-module_text-muted__3b0zX", "cardDate": "RelatedArticles-module_cardDate__1wOR5", "imgWrapper": "RelatedArticles-module_imgWrapper__5Jx_4" };
345
- styleInject(css$1);
343
+ var css = ".RelatedArticles-module_mediaContainer__10h9k {\n display: flex;\n flex-direction: row;\n flex-wrap: nowrap;\n margin: 0 -1rem;\n}\n.RelatedArticles-module_mediaCard__3wQbn {\n margin: 0 1rem 1rem;\n width: calc(33% - 1rem);\n display: column;\n flex-direction: row;\n margin-bottom: 0.75rem;\n padding-bottom: 0.75rem;\n border-bottom: none;\n}\n.RelatedArticles-module_mediaCard__3wQbn:last-child {\n border-bottom: none;\n}\n.RelatedArticles-module_cardTitle__3P-Ib {\n font-weight: bold;\n color: #252525;\n margin-bottom: 0.25rem;\n font-size: 15px;\n}\n.RelatedArticles-module_authorListing__1EFg4 span.RelatedArticles-module_text-muted__3b0zX {\n color: #000;\n font-weight: bold;\n}\n.RelatedArticles-module_cardDate__1wOR5 {\n color: var(--dark);\n display: block;\n background: #fff !important;\n margin-bottom: 0;\n}\n.RelatedArticles-module_imgWrapper__5Jx_4 {\n display: block;\n text-align: center;\n margin-bottom: 0.5rem;\n}\n.RelatedArticles-module_imgWrapper__5Jx_4 img {\n height: 135px;\n width: 100%;\n object-fit: cover;\n object-position: center;\n}\n@media screen and (max-width: 1064px) {\n}\n@media screen and (max-width: 968px) {\n .RelatedArticles-module_mediaContainer__10h9k {\n flex-wrap: wrap;\n }\n .RelatedArticles-module_imgWrapper__5Jx_4 {\n display: none;\n }\n .RelatedArticles-module_mediaCard__3wQbn {\n width: 100%;\n margin-bottom: 0.5rem;\n padding: 0;\n }\n .RelatedArticles-module_cardTitle__3P-Ib {\n font-size: 0.75rem;\n margin-bottom: 0;\n }\n}\n";
344
+ var styles = { "mediaContainer": "RelatedArticles-module_mediaContainer__10h9k", "mediaCard": "RelatedArticles-module_mediaCard__3wQbn", "cardTitle": "RelatedArticles-module_cardTitle__3P-Ib", "authorListing": "RelatedArticles-module_authorListing__1EFg4", "text-muted": "RelatedArticles-module_text-muted__3b0zX", "cardDate": "RelatedArticles-module_cardDate__1wOR5", "imgWrapper": "RelatedArticles-module_imgWrapper__5Jx_4" };
345
+ styleInject(css);
346
346
 
347
347
  var RelatedArticle = function RelatedArticle(_ref) {
348
348
  var articles = _ref.articles,
@@ -356,15 +356,15 @@ var RelatedArticle = function RelatedArticle(_ref) {
356
356
  }
357
357
  return React__default.createElement(
358
358
  'div',
359
- { className: styles$1.mediaContainer },
359
+ { className: styles.mediaContainer },
360
360
  articles.map(function (article, index) {
361
361
  if (article && article.url && article.url.current) {
362
362
  return React__default.createElement(
363
363
  'div',
364
- { id: 'related-card', key: index, className: styles$1.mediaCard },
364
+ { id: 'related-card', key: index, className: styles.mediaCard },
365
365
  React__default.createElement(
366
366
  'a',
367
- { className: styles$1.imgWrapper, href: '/view/' + (article.url ? article.url.current : '') },
367
+ { className: styles.imgWrapper, href: '/view/' + (article.url ? article.url.current : '') },
368
368
  article.thumbnail ? React__default.createElement('img', {
369
369
  style: { objectFit: 'cover', objectPosition: 'center' },
370
370
  src: article.thumbnail && urlFor({ client: client, source: article.thumbnail.asset, imageWidth: 250 }),
@@ -377,13 +377,13 @@ var RelatedArticle = function RelatedArticle(_ref) {
377
377
  ),
378
378
  React__default.createElement(
379
379
  'div',
380
- { className: styles$1.mediaBody },
380
+ { className: styles.mediaBody },
381
381
  React__default.createElement(
382
382
  'a',
383
383
  { href: '/view/' + (article.url ? article.url.current : '') },
384
384
  React__default.createElement(
385
385
  'div',
386
- { className: styles$1.cardTitle },
386
+ { className: styles.cardTitle },
387
387
  article.title
388
388
  )
389
389
  )
@@ -439,336 +439,7 @@ var getSocialShareDisableFlag = function getSocialShareDisableFlag(article) {
439
439
  return showSocialShare;
440
440
  };
441
441
 
442
- var css = ".RecommendedArticles-module_recommendTitle__2kUji {\n border-bottom: 2px solid var(--secondary-blue);\n font-size: 1.5rem;\n font-weight: bold;\n color: #0d335a;\n padding: 0.5rem;\n}\n.RecommendedArticles-module_recommendContainer__sZukI {\n display: flex;\n flex-direction: row;\n flex-wrap: wrap;\n margin: 0 -0.5rem;\n}\n.RecommendedArticles-module_recommendTop__1_yqw {\n margin: 0.5rem;\n width: 100%;\n flex-basis: 100%;\n display: flex;\n\n}\n.RecommendedArticles-module_recommendTopImg__1b9gu {\n min-width: 55%;\n width: 55%;\n height: 100%;\n}\n.RecommendedArticles-module_recommendTopImg__1b9gu img {\n width: 100%;\n height: 100%;\n object-fit: cover;\n}\n.RecommendedArticles-module_recommendTopBody__-13FI {\n margin-left: 1rem;\n line-height: 1.3;\n color: #121212;\n display: flex;\n flex-direction: column;\n}\n.RecommendedArticles-module_topTitle__2EafN {\n font-size: 25px;\n font-weight: bold;\n margin-bottom: 0.5rem;\n}\n.RecommendedArticles-module_topBody__2_VNi {\n font-size: 19px;\n margin-bottom: 0.5rem;\n}\n.RecommendedArticles-module_topLink__2RnXu {\n font-size: 19px;\n color: rgb(43, 43, 151);\n text-decoration: underline;\n margin-top: auto;\n}\n.RecommendedArticles-module_smContainer__4byBO {\n width: calc(25% - 1rem);\n margin: 0 0.5rem;\n}\n.RecommendedArticles-module_smImage__TYZGY img {\n width: 100%;\n}\n.RecommendedArticles-module_title__3q1ud {\n margin-top: 1rem;\n line-height: 1.2;\n color: #121212;\n}\n.RecommendedArticles-module_category__2jRto {\n text-transform: uppercase;\n font-size: 16px;\n letter-spacing: 2px;\n margin: 0.25rem 0;\n}\n\n/* media query */\n\n@media screen and (max-width: 1399px) {\n .RecommendedArticles-module_topTitle__2EafN {\n font-size: 21px;\n }\n .RecommendedArticles-module_topBody__2_VNi {\n font-size: 15px;\n }\n}\n@media screen and (max-width: 1191px) {\n .RecommendedArticles-module_topTitle__2EafN {\n font-size: 23px;\n }\n .RecommendedArticles-module_topBody__2_VNi,\n .RecommendedArticles-module_topLink__2RnXu {\n font-size: 17px;\n }\n}\n@media screen and (max-width: 968px) {\n .RecommendedArticles-module_topTitle__2EafN {\n font-size: 18px;\n }\n .RecommendedArticles-module_topBody__2_VNi,\n .RecommendedArticles-module_topLink__2RnXu {\n font-size: 15px;\n }\n}\n@media screen and (max-width: 768px) {\n .RecommendedArticles-module_recommendTop__1_yqw {\n flex-direction: column;\n }\n .RecommendedArticles-module_recommendTopImg__1b9gu,\n .RecommendedArticles-module_recommendTopBody__-13FI {\n width: 100%;\n margin: 0;\n }\n .RecommendedArticles-module_recommendTopBody__-13FI {\n margin-bottom: 1rem;\n }\n .RecommendedArticles-module_smContainer__4byBO {\n width: calc(50% - 1rem);\n }\n}";
443
- var styles = { "recommendTitle": "RecommendedArticles-module_recommendTitle__2kUji", "recommendContainer": "RecommendedArticles-module_recommendContainer__sZukI", "recommendTop": "RecommendedArticles-module_recommendTop__1_yqw", "recommendTopImg": "RecommendedArticles-module_recommendTopImg__1b9gu", "recommendTopBody": "RecommendedArticles-module_recommendTopBody__-13FI", "topTitle": "RecommendedArticles-module_topTitle__2EafN", "topBody": "RecommendedArticles-module_topBody__2_VNi", "topLink": "RecommendedArticles-module_topLink__2RnXu", "smContainer": "RecommendedArticles-module_smContainer__4byBO", "smImage": "RecommendedArticles-module_smImage__TYZGY", "title": "RecommendedArticles-module_title__3q1ud", "category": "RecommendedArticles-module_category__2jRto" };
444
- styleInject(css);
445
-
446
- var _this$2 = undefined;
447
-
448
- var Recommended = function Recommended(props) {
449
- var article = props.article,
450
- client = props.client,
451
- _props$index = props.index,
452
- index = _props$index === undefined ? 0 : _props$index,
453
- cpModificationRequired = props.cpModificationRequired;
454
-
455
- var _useState = useState(false),
456
- _useState2 = _slicedToArray(_useState, 2),
457
- segmentLoaded = _useState2[0],
458
- setSegmentLoaded = _useState2[1];
459
-
460
- var _useState3 = useState([]),
461
- _useState4 = _slicedToArray(_useState3, 2),
462
- articles = _useState4[0],
463
- setArticles = _useState4[1];
464
-
465
- var _useState5 = useState(false),
466
- _useState6 = _slicedToArray(_useState5, 2),
467
- loaded = _useState6[0],
468
- setLoaded = _useState6[1];
469
-
470
- var starting = index * 5;
471
- var contentMapping = {
472
- videos: 'video',
473
- articles: 'article',
474
- podcasts: 'podcast'
475
- };
476
-
477
- var mainCategories = article.content_placement.filter(function (cp) {
478
- return cp.usedForRecommendations === true;
479
- }).map(function (cp) {
480
- return cp.name;
481
- }).sort();
482
-
483
- useEffect(function () {
484
- try {
485
- if (!segmentLoaded) {
486
- return;
487
- }
488
- if (mainCategories.length > 0) {
489
- //console.log(mainCategories)
490
- analytics.track('Article Category Viewed', {
491
- categories: _JSON$stringify(mainCategories)
492
- });
493
- }
494
- var anonymousId = analytics.user().anonymousId();
495
- // get users traits
496
- var getSegmentProfile = function () {
497
- var _ref = _asyncToGenerator( /*#__PURE__*/regenerator.mark(function _callee() {
498
- var response, data, favoriteCategories, articlesQuery, videosQuery, podcastQuery, params, _ref2, _ref3, _articles, videos, podcasts;
499
-
500
- return regenerator.wrap(function _callee$(_context) {
501
- while (1) {
502
- switch (_context.prev = _context.next) {
503
- case 0:
504
- _context.next = 2;
505
- return fetch('/api/getSegmentProfile', {
506
- method: 'POST',
507
- body: _JSON$stringify({ anonymousId: anonymousId })
508
- });
509
-
510
- case 2:
511
- response = _context.sent;
512
- _context.next = 5;
513
- return response.json();
514
-
515
- case 5:
516
- data = _context.sent;
517
-
518
- if (!(data && data.traits && data.traits.favorite_article_category)) {
519
- _context.next = 20;
520
- break;
521
- }
522
-
523
- //console.log('%csegment user profile', 'font-size:1.5rem;color:#000000;padding:1rem;background-color:yellow;', data.traits)
524
- favoriteCategories = JSON.parse(data.traits.favorite_article_category);
525
- // grab 3 articles from sanity different from the one currently being read
526
-
527
- articlesQuery = '*[_type == \'article\'\n && !(_id in path("drafts.**"))\n && defined(title)\n && defined(url)\n && is_visible\n && references(*[_type == \'contentCategory\' && name == \'Articles\']._id)\n && references(*[_type == \'taxonomy\' ' + favoriteCategories.map(function (cat) {
528
- return ' && name == \'' + cat + '\' ';
529
- }) + ']._id)\n && defined(published)\n && _id != $id\n && dateTime(published) <= dateTime(now())] | order(published desc) [' + starting + '...' + (starting + 5) + '] {\n ...,\n title,\n thumbnail,\n url,\n contentCategory->,\n published,\n }';
530
- videosQuery = '*[_type == \'article\'\n && !(_id in path("drafts.**"))\n && defined(title)\n && defined(url)\n && is_visible\n && references(*[_type == \'contentCategory\' && name == \'Videos\']._id)\n && references(*[_type == \'taxonomy\' ' + favoriteCategories.map(function (cat) {
531
- return ' && name == \'' + cat + '\' ';
532
- }) + ']._id)\n && defined(published)\n && _id != $id\n && dateTime(published) <= dateTime(now())] | order(published desc) [' + starting + '...' + (starting + 1) + '] {\n ...,\n title,\n thumbnail,\n url,\n contentCategory->,\n published,\n }';
533
- podcastQuery = '*[_type == \'article\'\n && !(_id in path("drafts.**"))\n && defined(title)\n && defined(url)\n && is_visible\n && references(*[_type == \'contentCategory\' && name == \'Podcasts\']._id)\n && references(*[_type == \'taxonomy\' ' + favoriteCategories.map(function (cat) {
534
- return ' && name == \'' + cat + '\' ';
535
- }) + ']._id)\n && defined(published)\n && _id != $id\n && dateTime(published) <= dateTime(now())] | order(published desc) [' + starting + '...' + (starting + 2) + '] {\n ...,\n title,\n thumbnail,\n url,\n contentCategory->,\n published,\n }';
536
- params = {
537
- id: article._id
538
- };
539
- _context.next = 14;
540
- return _Promise.all([client.fetch(articlesQuery, params), client.fetch(videosQuery, params), client.fetch(podcastQuery, params)]);
541
-
542
- case 14:
543
- _ref2 = _context.sent;
544
- _ref3 = _slicedToArray(_ref2, 3);
545
- _articles = _ref3[0];
546
- videos = _ref3[1];
547
- podcasts = _ref3[2];
548
-
549
- if (_articles) {
550
- if (videos[0] && _articles[2]) {
551
- _articles[2] = videos[0];
552
- }
553
- if (videos[1] && _articles[4]) {
554
- _articles[4] = videos[1];
555
- }
556
- if (podcasts[0] && _articles[3]) {
557
- _articles[3] = podcasts[0];
558
- }
559
- setArticles(_articles);
560
- }
561
-
562
- case 20:
563
- case 'end':
564
- return _context.stop();
565
- }
566
- }
567
- }, _callee, _this$2);
568
- }));
569
-
570
- return function getSegmentProfile() {
571
- return _ref.apply(this, arguments);
572
- };
573
- }();
574
-
575
- getSegmentProfile();
576
- } catch (err) {
577
- console.log(err);
578
- }
579
- }, [segmentLoaded]);
580
-
581
- useEffect(function () {
582
- if (articles && articles.length > 0) {
583
- setLoaded(true);
584
- }
585
- }, [articles]);
586
-
587
- useEffect(function () {
588
- try {
589
- analytics.ready(function () {
590
- setSegmentLoaded(function () {
591
- return true;
592
- });
593
- });
594
- } catch (err) {
595
- console.log(err);
596
- }
597
- }, []);
598
-
599
- return React__default.createElement(
600
- 'div',
601
- { id: 'recommended' },
602
- loaded ? React__default.createElement(
603
- React__default.Fragment,
604
- null,
605
- React__default.createElement(
606
- 'h4',
607
- { className: styles.recommendTitle },
608
- 'Recommended For You'
609
- ),
610
- React__default.createElement(
611
- 'div',
612
- { className: styles.recommendContainer, id: 'recommendedContent' },
613
- articles.map(function (article, index) {
614
- if (index === 0) {
615
- return React__default.createElement(
616
- 'div',
617
- { key: article._id + ('-' + index), className: styles.recommendTop },
618
- React__default.createElement(
619
- 'div',
620
- { className: styles.recommendTopImg },
621
- React__default.createElement(
622
- 'a',
623
- { href: '/view/' + article.url.current },
624
- React__default.createElement('img', { src: urlFor({ source: article.thumbnail, client: client, imageHeight: 306, imageWidth: 544 }) })
625
- )
626
- ),
627
- React__default.createElement(
628
- 'div',
629
- { className: styles.recommendTopBody },
630
- React__default.createElement(
631
- 'div',
632
- { className: styles.topTitle },
633
- article.title
634
- ),
635
- React__default.createElement(
636
- 'p',
637
- { className: styles.topBody },
638
- article.summary
639
- ),
640
- React__default.createElement(
641
- 'a',
642
- { href: '/view/' + article.url.current, className: styles.topLink },
643
- '>> ',
644
- 'Read Article'
645
- )
646
- )
647
- );
648
- } else {
649
- return React__default.createElement(
650
- 'div',
651
- { key: article._id + ('-' + index), className: styles.smContainer },
652
- React__default.createElement(
653
- 'div',
654
- { className: styles.category },
655
- contentMapping[article.contentCategory.name.toLowerCase()] ? contentMapping[article.contentCategory.name.toLowerCase()] : article.contentCategory.name
656
- ),
657
- React__default.createElement(
658
- 'a',
659
- { href: '/view/' + article.url.current },
660
- React__default.createElement(
661
- 'div',
662
- { className: styles.smImage },
663
- React__default.createElement('img', { src: urlFor({ source: article.thumbnail, client: client, imageHeight: 270, imageWidth: 480 }) })
664
- ),
665
- React__default.createElement(
666
- 'div',
667
- { className: styles.title },
668
- article.title
669
- )
670
- )
671
- );
672
- }
673
- })
674
- )
675
- ) : React__default.createElement(
676
- 'section',
677
- { id: 'related-content-section', className: 'my-1' },
678
- (article.relatedArticle || RelevantTopics()) && React__default.createElement(
679
- 'p',
680
- { className: 'mb-0' },
681
- React__default.createElement(
682
- 'b',
683
- null,
684
- 'Related Content:'
685
- )
686
- ),
687
- React__default.createElement(RelevantTopics, { article: article, cpModificationRequired: cpModificationRequired, Settings: props.Settings }),
688
- React__default.createElement(
689
- 'div',
690
- { className: 'pt-2' },
691
- React__default.createElement(RelatedArticle, {
692
- articles: article.relatedArticle,
693
- client: client,
694
- fallbackImage: props.Settings.logo,
695
- showRelatedArticleFallbackImage: props.showRelatedArticleFallbackImage
696
- })
697
- )
698
- )
699
- );
700
- };
701
-
702
- var RelevantTopics = function RelevantTopics(props) {
703
- var article = props.article,
704
- cpModificationRequired = props.cpModificationRequired;
705
- var content_placement = article.content_placement,
706
- documentGroupMapping = article.documentGroupMapping,
707
- issueGroup = article.issueGroup;
708
-
709
- if (content_placement && content_placement.length > 0 || documentGroupMapping && documentGroupMapping.length > 0) {
710
- var relatedLinks = [];
711
- if (documentGroupMapping && documentGroupMapping.length > 0) {
712
- documentGroupMapping.forEach(function (documentGroup) {
713
- if (documentGroup.isShow === false || documentGroup.excludeRelatedContents) {
714
- return null;
715
- }
716
- if (documentGroup.parent) {
717
- relatedLinks = [].concat(_toConsumableArray(relatedLinks), [{
718
- label: documentGroup.name,
719
- href: cpModificationRequired ? getDocumentGroupUrl(documentGroup) : documentGroup.parent.identifier && documentGroup.parent.identifier.current && !documentGroup.path.includes('/') ? '/' + documentGroup.parent.identifier.current + '/' + documentGroup.path : '/' + documentGroup.path
720
- }]);
721
- }
722
- });
723
- }
724
- if (content_placement && content_placement.length > 0) {
725
- content_placement.filter(function (item) {
726
- return item.path !== 'news';
727
- }).forEach(function (cp) {
728
- if (cp.excludeRelatedContents) {
729
- return null;
730
- }
731
- var cp_url = cpModificationRequired ? getContentPlacementUrl(cp) : cp.path;
732
- var href = '/' + cp_url;
733
- relatedLinks = [].concat(_toConsumableArray(relatedLinks), [{ label: cp.name, href: href }]);
734
- });
735
- }
736
- if (issueGroup && issueGroup.name && issueGroup.identifier && issueGroup.identifier.current && issueGroup.parent && issueGroup.parent.identifier && issueGroup.parent.identifier.current) {
737
- var _props$Settings$issue = props.Settings.issueMapping,
738
- issueMapping = _props$Settings$issue === undefined ? '/publications' : _props$Settings$issue;
739
-
740
- relatedLinks = [].concat(_toConsumableArray(relatedLinks), [{ label: issueGroup.name, href: issueMapping + '/' + issueGroup.parent.identifier.current + '/' + issueGroup.identifier.current }]);
741
- }
742
- if (relatedLinks && relatedLinks.length > 0) {
743
- return React__default.createElement(
744
- 'div',
745
- null,
746
- relatedLinks.map(function (relatedLink, index) {
747
- if (relatedLink && relatedLink.href && relatedLink.label) {
748
- return React__default.createElement(
749
- 'span',
750
- { key: relatedLink.label, className: 'related-link' },
751
- React__default.createElement(
752
- 'a',
753
- { className: 'related-links', style: { color: 'blue' }, href: relatedLink.href },
754
- relatedLink.label
755
- ),
756
- React__default.createElement(
757
- 'style',
758
- { jsx: 'true' },
759
- '\n .related-link:not(:first-child):before {\n content: \' | \';\n }\n '
760
- )
761
- );
762
- }
763
- })
764
- );
765
- }
766
- return null;
767
- }
768
- return null;
769
- };
770
-
771
- var Article = React__default.memo(forwardRef(function (props, ref) {
442
+ var Article = forwardRef(function (props, ref) {
772
443
  var onVote = function () {
773
444
  var _ref = _asyncToGenerator( /*#__PURE__*/regenerator.mark(function _callee(nodeKey, selectedChoice) {
774
445
  var response, result;
@@ -881,9 +552,7 @@ var Article = React__default.memo(forwardRef(function (props, ref) {
881
552
  disqusConfig = props.disqusConfig,
882
553
  showDisqus = props.showDisqus,
883
554
  _props$downloadCitati = props.downloadCitation,
884
- downloadCitation = _props$downloadCitati === undefined ? false : _props$downloadCitati,
885
- _props$useSegmentReco = props.useSegmentRecommendedArticles,
886
- useSegmentRecommendedArticles = _props$useSegmentReco === undefined ? false : _props$useSegmentReco;
555
+ downloadCitation = _props$downloadCitati === undefined ? false : _props$downloadCitati;
887
556
  var sliderData = props.sliderData;
888
557
 
889
558
 
@@ -1116,31 +785,27 @@ var Article = React__default.memo(forwardRef(function (props, ref) {
1116
785
 
1117
786
  var RelatedContent = function RelatedContent() {
1118
787
  return React__default.createElement(
1119
- 'div',
1120
- null,
1121
- useSegmentRecommendedArticles ? React__default.createElement(Recommended, { client: client, article: article, index: props.index, Settings: props.Settings, showRelatedArticleFallbackImage: props.showRelatedArticleFallbackImage, cpModificationRequired: cpModificationRequired }) : React__default.createElement(
1122
- 'section',
1123
- { id: 'related-content-section', className: 'my-1' },
1124
- (article.relatedArticle || RelevantTopics()) && React__default.createElement(
1125
- 'p',
1126
- { className: 'mb-0' },
1127
- React__default.createElement(
1128
- 'b',
1129
- null,
1130
- 'Related Content:'
1131
- )
1132
- ),
1133
- React__default.createElement(RelevantTopics, null),
788
+ 'section',
789
+ { id: 'related-content-section', className: 'my-1' },
790
+ (article.relatedArticle || RelevantTopics()) && React__default.createElement(
791
+ 'p',
792
+ { className: 'mb-0' },
1134
793
  React__default.createElement(
1135
- 'div',
1136
- { className: 'pt-2' },
1137
- React__default.createElement(RelatedArticle, {
1138
- articles: article.relatedArticle,
1139
- client: client,
1140
- fallbackImage: props.Settings.logo,
1141
- showRelatedArticleFallbackImage: props.showRelatedArticleFallbackImage
1142
- })
794
+ 'b',
795
+ null,
796
+ 'Related Content:'
1143
797
  )
798
+ ),
799
+ React__default.createElement(RelevantTopics, null),
800
+ React__default.createElement(
801
+ 'div',
802
+ { className: 'pt-2' },
803
+ React__default.createElement(RelatedArticle, {
804
+ articles: article.relatedArticle,
805
+ client: client,
806
+ fallbackImage: props.Settings.logo,
807
+ showRelatedArticleFallbackImage: props.showRelatedArticleFallbackImage
808
+ })
1144
809
  )
1145
810
  );
1146
811
  };
@@ -1751,8 +1416,6 @@ var Article = React__default.memo(forwardRef(function (props, ref) {
1751
1416
  } else {
1752
1417
  return detail();
1753
1418
  }
1754
- }), function (prevProps, nextProps) {
1755
- return prevProps.article === nextProps.article;
1756
1419
  });
1757
1420
 
1758
1421
  var _this$1 = undefined;
@@ -2037,8 +1700,7 @@ var ArticleQueue = function ArticleQueue(props) {
2037
1700
  active: active === article._id
2038
1701
  // Passing queueData to check for single article
2039
1702
  , queueData: queueData,
2040
- showRelatedArticles: showRelatedArticles,
2041
- index: index
1703
+ showRelatedArticles: showRelatedArticles
2042
1704
  }))
2043
1705
  );
2044
1706
  })
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mjhls/mjh-framework",
3
- "version": "1.0.935-segment-test",
3
+ "version": "1.0.935",
4
4
  "description": "Foundation Framework",
5
5
  "author": "mjh-framework",
6
6
  "license": "MIT",