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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (34) hide show
  1. package/README.md +1 -1
  2. package/dist/cjs/ArticleProgramLandingPage.js +1 -1
  3. package/dist/cjs/ExternalResources.js +1 -1
  4. package/dist/cjs/HorizontalArticleListing.js +1 -1
  5. package/dist/cjs/IssueLanding.js +1 -1
  6. package/dist/cjs/{MediaSeriesCard-ebf0b083.js → MediaSeriesCard-659279e0.js} +1 -1
  7. package/dist/cjs/MediaSeriesLanding.js +2 -2
  8. package/dist/cjs/MediaSeriesLandingPaginated.js +2 -2
  9. package/dist/cjs/PartnerDetailListing.js +1 -1
  10. package/dist/cjs/PartnerDetailListingPaginated.js +1 -1
  11. package/dist/cjs/TaxonomyDescription.js +1 -1
  12. package/dist/cjs/VideoProgramLandingPage.js +1 -1
  13. package/dist/cjs/View.js +369 -31
  14. package/dist/cjs/getQuery.js +2 -1
  15. package/dist/cjs/getSerializers.js +1 -1
  16. package/dist/cjs/{index-e6bae72c.js → index-c991e29a.js} +1 -0
  17. package/dist/cjs/index.js +1 -1
  18. package/dist/esm/ArticleProgramLandingPage.js +1 -1
  19. package/dist/esm/ExternalResources.js +1 -1
  20. package/dist/esm/HorizontalArticleListing.js +1 -1
  21. package/dist/esm/IssueLanding.js +1 -1
  22. package/dist/esm/{MediaSeriesCard-5b06f89b.js → MediaSeriesCard-06c6251a.js} +1 -1
  23. package/dist/esm/MediaSeriesLanding.js +2 -2
  24. package/dist/esm/MediaSeriesLandingPaginated.js +2 -2
  25. package/dist/esm/PartnerDetailListing.js +1 -1
  26. package/dist/esm/PartnerDetailListingPaginated.js +1 -1
  27. package/dist/esm/TaxonomyDescription.js +1 -1
  28. package/dist/esm/VideoProgramLandingPage.js +1 -1
  29. package/dist/esm/View.js +371 -33
  30. package/dist/esm/getQuery.js +2 -1
  31. package/dist/esm/getSerializers.js +1 -1
  32. package/dist/esm/{index-2eb00bbf.js → index-6dc67bdb.js} +1 -0
  33. package/dist/esm/index.js +1 -1
  34. package/package.json +1 -1
package/dist/esm/View.js CHANGED
@@ -1,4 +1,4 @@
1
- import { _ as _asyncToGenerator, r as regenerator } from './asyncToGenerator-958ef5fc.js';
1
+ import { _ as _asyncToGenerator, r as regenerator, a as _Promise } 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';
@@ -15,10 +15,10 @@ import FormControl from 'react-bootstrap/FormControl';
15
15
  import Button from 'react-bootstrap/Button';
16
16
  import { V as VisibilitySensor } from './visibility-sensor-72fd8f8b.js';
17
17
  import SocialShare from './SocialShare.js';
18
- import { r as renderAuthor, g as getSerializers } from './index-2eb00bbf.js';
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 { g as getTargeting, a as getContentPlacementUrl } from './getTargeting-42f9b439.js';
21
+ import { a as getContentPlacementUrl, g as getTargeting } 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 = ".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);
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);
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.mediaContainer },
359
+ { className: styles$1.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.mediaCard },
364
+ { id: 'related-card', key: index, className: styles$1.mediaCard },
365
365
  React__default.createElement(
366
366
  'a',
367
- { className: styles.imgWrapper, href: '/view/' + (article.url ? article.url.current : '') },
367
+ { className: styles$1.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.mediaBody },
380
+ { className: styles$1.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.cardTitle },
386
+ { className: styles$1.cardTitle },
387
387
  article.title
388
388
  )
389
389
  )
@@ -439,7 +439,336 @@ var getSocialShareDisableFlag = function getSocialShareDisableFlag(article) {
439
439
  return showSocialShare;
440
440
  };
441
441
 
442
- var Article = forwardRef(function (props, ref) {
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) {
443
772
  var onVote = function () {
444
773
  var _ref = _asyncToGenerator( /*#__PURE__*/regenerator.mark(function _callee(nodeKey, selectedChoice) {
445
774
  var response, result;
@@ -552,7 +881,9 @@ var Article = forwardRef(function (props, ref) {
552
881
  disqusConfig = props.disqusConfig,
553
882
  showDisqus = props.showDisqus,
554
883
  _props$downloadCitati = props.downloadCitation,
555
- downloadCitation = _props$downloadCitati === undefined ? false : _props$downloadCitati;
884
+ downloadCitation = _props$downloadCitati === undefined ? false : _props$downloadCitati,
885
+ _props$useSegmentReco = props.useSegmentRecommendedArticles,
886
+ useSegmentRecommendedArticles = _props$useSegmentReco === undefined ? false : _props$useSegmentReco;
556
887
  var sliderData = props.sliderData;
557
888
 
558
889
 
@@ -785,27 +1116,31 @@ var Article = forwardRef(function (props, ref) {
785
1116
 
786
1117
  var RelatedContent = function RelatedContent() {
787
1118
  return React__default.createElement(
788
- 'section',
789
- { id: 'related-content-section', className: 'my-1' },
790
- (article.relatedArticle || RelevantTopics()) && React__default.createElement(
791
- 'p',
792
- { className: 'mb-0' },
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),
793
1134
  React__default.createElement(
794
- 'b',
795
- null,
796
- 'Related Content:'
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
+ })
797
1143
  )
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
- })
809
1144
  )
810
1145
  );
811
1146
  };
@@ -1416,6 +1751,8 @@ var Article = forwardRef(function (props, ref) {
1416
1751
  } else {
1417
1752
  return detail();
1418
1753
  }
1754
+ }), function (prevProps, nextProps) {
1755
+ return prevProps.article === nextProps.article;
1419
1756
  });
1420
1757
 
1421
1758
  var _this$1 = undefined;
@@ -1700,7 +2037,8 @@ var ArticleQueue = function ArticleQueue(props) {
1700
2037
  active: active === article._id
1701
2038
  // Passing queueData to check for single article
1702
2039
  , queueData: queueData,
1703
- showRelatedArticles: showRelatedArticles
2040
+ showRelatedArticles: showRelatedArticles,
2041
+ index: index
1704
2042
  }))
1705
2043
  );
1706
2044
  })
@@ -7,8 +7,9 @@ var getQuery = function getQuery(type) {
7
7
  //Site level conditions should start with && (logical AND), and site level params should end with , (comma) in order to execute query
8
8
 
9
9
  switch (type) {
10
+ // quiz video series and slideshow
10
11
  case 'related':
11
- return '*[\n _type == "article"\n && defined(title)\n && defined(url)\n && !(_id in path("drafts.**"))\n && is_visible == true\n && defined(published) \n && dateTime(published) <= dateTime(now())\n && passwordLock!=true\n && taxonomyMapping[]._ref in $taxonomy\n && taxonomyMapping[].disableAds != \'true\'\n && contentCategory->.name != \'Poll\'\n && contentCategory->.name != \'Slideshows\'\n && contentCategory->.disableAds != \'true\'\n && ExcludeFromInfiniteScroll !=true\n && url.current != $url\n && !defined(body[].videos)\n ' + conditions + '\n ]| order(published desc)[' + (articleCount ? articleCount : '$index') + ']{\n ' + params + '\n title,\n published,\n summary,\n thumbnail,\n fieldAbstract,\n ...,\n passwordLock,\n password,\n "authorDetails": authorMapping[]->{ displayName, url, profileImage, biography, showSocialShare },\n body[] {\n ...,\n asset->,\n images[]{\n ...,\n asset->\n },\n content[]{\n ...,\n asset->\n },\n videos[]{\n ...,\n thumbnail{\n _type,\n asset->\n }\n },\n response[]{\n ...,\n asset->\n },\n quizzes[]{\n ...,\n answer[]{\n ...,\n asset->\n },\n question[]{\n ...,\n asset->\n }\n },\n poster {\n _type,\n asset->\n },\n slides[]{\n ...,\n slideshowImage{\n ...,\n asset->\n }\n },\n upload_doc {\n _type,\n asset->\n },\n uploadAudio {\n _type,\n asset->\n }\n },\n \'category\':contentCategory->{\n name,\n disableAds\n },\n \'content_placement\': taxonomyMapping[]-> {\n _id,\n \'ancestor\': parent->parent->identifier,\n \'parent\': parent->identifier,\n \'name\': name,\n \'path\': identifier,\n disableAds,\n showSocialShare\n },\n documentGroup-> {\n name,\n thumbnail,\n parent->{...,parent->},\n isShow,\n showSocialShare,\n \'path\': identifier.current,\n adTargetingURL,\n hideSeriesSlider\n },\n documentGroupMapping[]-> {\n _id,\n name,\n thumbnail,\n parent->{...,parent->},\n isShow,\n showSocialShare,\n \'path\': identifier.current,\n adTargetingURL,\n hideSeriesSlider\n },\n \'issue\' : *[_type == \'publication\' && !(_id in path("drafts.**")) && is_visible == true && _id == ^.issueGroup._ref][0] {\n name,\n \'path\': identifier.current,\n show_download_ris_button,\n \'publication\' : *[_type == \'publication\' && !(_id in path("drafts.**")) && is_visible == true && _id == ^.parent._ref][0] {\n name,\n \'path\': identifier.current,\n show_download_ris_button,\n },\n \'url\' : pdf.asset-> url,\n \'pdf\': pdf.asset->,\n isbn_issn,\n abbreviatedJournal,\n }\n }';
12
+ return '*[\n _type == "article"\n && defined(title)\n && defined(url)\n && !(_id in path("drafts.**"))\n && is_visible == true\n && defined(published) \n && dateTime(published) <= dateTime(now())\n && passwordLock!=true\n && taxonomyMapping[]._ref in $taxonomy\n && taxonomyMapping[].disableAds != \'true\'\n && contentCategory->.name != \'Poll\'\n && contentCategory->.name != \'Slideshows\'\n && contentCategory->.disableAds != \'true\'\n && ExcludeFromInfiniteScroll !=true\n && url.current != $url\n && !defined(body[].videos)\n && !defined(body[].quizzes)\n && !defined(body[].slides)\n && !defined(body[].articles)\n ' + conditions + '\n ]| order(published desc)[' + (articleCount ? articleCount : '$index') + ']{\n ' + params + '\n title,\n published,\n summary,\n thumbnail,\n fieldAbstract,\n ...,\n passwordLock,\n password,\n "authorDetails": authorMapping[]->{ displayName, url, profileImage, biography, showSocialShare },\n body[] {\n ...,\n asset->,\n images[]{\n ...,\n asset->\n },\n content[]{\n ...,\n asset->\n },\n videos[]{\n ...,\n thumbnail{\n _type,\n asset->\n }\n },\n response[]{\n ...,\n asset->\n },\n quizzes[]{\n ...,\n answer[]{\n ...,\n asset->\n },\n question[]{\n ...,\n asset->\n }\n },\n poster {\n _type,\n asset->\n },\n slides[]{\n ...,\n slideshowImage{\n ...,\n asset->\n }\n },\n upload_doc {\n _type,\n asset->\n },\n uploadAudio {\n _type,\n asset->\n }\n },\n \'category\':contentCategory->{\n name,\n disableAds\n },\n \'content_placement\': taxonomyMapping[]-> {\n _id,\n \'ancestor\': parent->parent->identifier,\n \'parent\': parent->identifier,\n \'name\': name,\n \'path\': identifier,\n disableAds,\n showSocialShare\n },\n documentGroup-> {\n name,\n thumbnail,\n parent->{...,parent->},\n isShow,\n showSocialShare,\n \'path\': identifier.current,\n adTargetingURL,\n hideSeriesSlider\n },\n documentGroupMapping[]-> {\n _id,\n name,\n thumbnail,\n parent->{...,parent->},\n isShow,\n showSocialShare,\n \'path\': identifier.current,\n adTargetingURL,\n hideSeriesSlider\n },\n \'issue\' : *[_type == \'publication\' && !(_id in path("drafts.**")) && is_visible == true && _id == ^.issueGroup._ref][0] {\n name,\n \'path\': identifier.current,\n show_download_ris_button,\n \'publication\' : *[_type == \'publication\' && !(_id in path("drafts.**")) && is_visible == true && _id == ^.parent._ref][0] {\n name,\n \'path\': identifier.current,\n show_download_ris_button,\n },\n \'url\' : pdf.asset-> url,\n \'pdf\': pdf.asset->,\n isbn_issn,\n abbreviatedJournal,\n }\n }';
12
13
  case 'article':
13
14
  return '*[\n _type == "article"\n && !(_id in path("drafts.**"))\n && defined(title)\n && defined(url)\n && is_visible != false\n && url.current == $url\n ' + conditions + '\n ][0]{\n ' + params + '\n title,\n published,\n summary,\n thumbnail,\n fieldAbstract,\n ...,\n passwordLock,\n password,\n issueGroup-> { _id, name, identifier, parent-> },\n "authorDetails": authorMapping[]->{ displayName, url, profileImage, biography, showSocialShare },\n body[] {\n ...,\n asset->,\n images[]{\n ...,\n asset->\n },\n content[]{\n ...,\n asset->\n },\n videos[]{\n ...,\n thumbnail{\n _type,\n asset->\n }\n },\n response[]{\n ...,\n asset->\n },\n quizzes[]{\n ...,\n answer[]{\n ...,\n asset->\n },\n question[]{\n ...,\n asset->\n }\n },\n poster {\n _type,\n asset->\n },\n slides[]{\n ...,\n slideshowImage{\n ...,\n asset->\n }\n },\n upload_doc {\n _type,\n asset->\n },\n uploadAudio {\n _type,\n asset->\n },\n medias[]{\n ...,\n upload_doc {\n _type,\n asset-> \n },\n poster {\n _type,\n asset-> \n }\n },\n articles[]{\n ...,\n thumbnail{\n ...,\n asset-> \n },\n "authorDetails": authorMapping[]->{ displayName, url, profileImage, biography, showSocialShare },\n text[]{\n ...,\n upload_doc {\n _type,\n asset->\n },\n uploadAudio {\n _type,\n asset->\n },\n }\n }\n },\n \'content_placement\': taxonomyMapping[]-> {\n ...,\n \'ancestor\': parent->parent->identifier,\n \'parent\': parent->identifier,\n \'name\': name,\n \'path\': identifier,\n showSocialShare\n },\n documentGroup-> {\n _id,\n name,\n thumbnail,\n parent->{...,parent->},\n isShow,\n isSeries,\n excludeRelatedContents,\n showSocialShare,\n \'path\': identifier.current,\n adTargetingURL,\n hideSeriesSlider\n },\n documentGroupMapping[]-> {\n _id,\n name,\n thumbnail,\n parent->{...,parent->},\n isShow,\n showSocialShare,\n excludeRelatedContents,\n \'path\': identifier.current,\n hideSeriesSlider\n },\n \'category\':contentCategory->{\n name,\n disableAds\n },\n \'issue\' : *[_type == \'publication\' && !(_id in path("drafts.**")) && is_visible == true && _id == ^.issueGroup._ref][0] {\n name,\n volume,\n year,\n \'issueNumber\': number,\n \'articleSource\': source,\n \'path\': identifier.current,\n show_download_ris_button,\n \'publication\' : *[_type == \'publication\' && !(_id in path("drafts.**")) && is_visible == true && _id == ^.parent._ref][0] {\n name,\n \'path\': identifier.current,\n show_download_ris_button,\n },\n \'url\' : pdf.asset-> url,\n \'pdf\': pdf.asset->,\n isbn_issn,\n abbreviatedJournal,\n }\n\n }';
14
15
  case 'publication':
@@ -1,6 +1,6 @@
1
1
  import './extends-6d8e3924.js';
2
2
  import 'react';
3
- export { g as default } from './index-2eb00bbf.js';
3
+ export { g as default } from './index-6dc67bdb.js';
4
4
  import './BlockContent-1e73bd2c.js';
5
5
  import './entities-6d9154b4.js';
6
6
  import './_commonjsHelpers-0c4b6f40.js';
@@ -2929,6 +2929,7 @@ var Video = function Video(_ref) {
2929
2929
  return React__default.createElement(
2930
2930
  'div',
2931
2931
  { className: 'brightcove-playlist', style: { position: 'relative', display: 'block', margin: '0px auto' } },
2932
+ React__default.createElement('div', { 'data-experience': experienceID }),
2932
2933
  isPollingTime ? React__default.createElement(PopupPollModal
2933
2934
  // eslint-disable-next-line react/jsx-indent-props
2934
2935
  , { pollItems: pollItems
package/dist/esm/index.js CHANGED
@@ -86,7 +86,7 @@ export { default as VerticalHero } from './VerticalHero.js';
86
86
  export { default as YahooHero } from './YahooHero.js';
87
87
  export { default as GridHero } from './GridHero.js';
88
88
  export { default as ConferenceArticleCard } from './ConferenceArticleCard.js';
89
- export { g as getSerializers } from './index-2eb00bbf.js';
89
+ export { g as getSerializers } from './index-6dc67bdb.js';
90
90
  export { default as Beam } from './Beam.js';
91
91
  export { default as Segment } from './Segment.js';
92
92
  export { default as KMTracker } from './KMTracker.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mjhls/mjh-framework",
3
- "version": "1.0.933",
3
+ "version": "1.0.935-segment-test",
4
4
  "description": "Foundation Framework",
5
5
  "author": "mjh-framework",
6
6
  "license": "MIT",