@mjhls/mjh-framework 1.0.665-beta.2 → 1.0.665-beta.4
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 +98 -97
- package/dist/cjs/getRelatedArticle.js +440 -6
- package/dist/cjs/index.js +2 -2
- package/dist/esm/View.js +96 -95
- package/dist/esm/getRelatedArticle.js +443 -5
- package/dist/esm/index.js +1 -1
- package/package.json +1 -1
- package/dist/cjs/getRelatedArticle-c944847e.js +0 -447
- package/dist/esm/getRelatedArticle-2d4942b4.js +0 -443
package/dist/esm/View.js
CHANGED
|
@@ -53,7 +53,7 @@ import { _ as _Object$keys } from './keys-fc2d4c34.js';
|
|
|
53
53
|
import 'react-bootstrap/Dropdown';
|
|
54
54
|
import getSeriesDetail from './getSeriesDetail.js';
|
|
55
55
|
import './index-db3bb315.js';
|
|
56
|
-
import
|
|
56
|
+
import getRelatedArticle from './getRelatedArticle.js';
|
|
57
57
|
import getQuery from './getQuery.js';
|
|
58
58
|
import { g as getTargeting, a as getContentPlacementUrl } from './getTargeting-2acdec91.js';
|
|
59
59
|
import getKeywords from './getKeywords.js';
|
|
@@ -182,7 +182,7 @@ var findIndex = function findIndex(arr) {
|
|
|
182
182
|
return indexes;
|
|
183
183
|
};
|
|
184
184
|
|
|
185
|
-
var css = ".RelatedArticles-module_mediaContainer__10h9k {\r\n display: flex;\r\n flex-direction: row;\r\n flex-wrap: nowrap;\r\n margin: 0 -1rem;\r\n}\r\n.RelatedArticles-module_mediaCard__3wQbn {\r\n margin: 0 1rem 1rem;\r\n width: calc(33% - 1rem);\r\n display: column;\r\n flex-direction: row;\r\n margin-bottom: 0.75rem;\r\n
|
|
185
|
+
var css = ".RelatedArticles-module_mediaContainer__10h9k {\r\n display: flex;\r\n flex-direction: row;\r\n flex-wrap: nowrap;\r\n margin: 0 -1rem;\r\n}\r\n.RelatedArticles-module_mediaCard__3wQbn {\r\n margin: 0 1rem 1rem;\r\n width: calc(33% - 1rem);\r\n display: column;\r\n flex-direction: row;\r\n margin-bottom: 0.75rem;\r\n border-bottom: none;\r\n}\r\n.RelatedArticles-module_mediaCard__3wQbn:last-child {\r\n border-bottom: none;\r\n}\r\n.RelatedArticles-module_cardTitle__3P-Ib {\r\n font-weight: bold;\r\n color: #252525;\r\n margin-bottom: 0.25rem;\r\n font-size: 15px;\r\n}\r\n.RelatedArticles-module_authorListing__1EFg4 span.RelatedArticles-module_text-muted__3b0zX {\r\n color: #000;\r\n font-weight: bold;\r\n}\r\n.RelatedArticles-module_cardDate__1wOR5 {\r\n color: var(--dark);\r\n display: block;\r\n background: #fff !important;\r\n margin-bottom: 0;\r\n}\r\n.RelatedArticles-module_imgWrapper__5Jx_4 {\r\n display: block;\r\n text-align: center;\r\n margin-bottom: 0.5rem;\r\n}\r\n.RelatedArticles-module_imgWrapper__5Jx_4 img {\r\n height: 135px;\r\n width: 100%;\r\n object-fit: cover;\r\n object-position: center;\r\n}\r\n@media screen and (max-width: 1064px) {\r\n}\r\n@media screen and (max-width: 968px) {\r\n .RelatedArticles-module_mediaContainer__10h9k {\r\n flex-wrap: wrap;\r\n }\r\n .RelatedArticles-module_mediaCard__3wQbn {\r\n width: 100%;\r\n background-color: #cccccc;\r\n margin-bottom: 0.5rem;\r\n padding: 0.5rem;\r\n border-radius: 0.25rem;\r\n }\r\n .RelatedArticles-module_imgWrapper__5Jx_4 {\r\n display: none;\r\n }\r\n}\r\n";
|
|
186
186
|
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" };
|
|
187
187
|
styleInject(css);
|
|
188
188
|
|
|
@@ -403,72 +403,65 @@ var Article = function Article(props) {
|
|
|
403
403
|
};
|
|
404
404
|
|
|
405
405
|
var RelevantTopics = function RelevantTopics() {
|
|
406
|
-
if (content_placement && content_placement.length > 0 || documentGroupMapping) {
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
{ className: 'mb-0' },
|
|
413
|
-
React__default.createElement(
|
|
414
|
-
'b',
|
|
415
|
-
null,
|
|
416
|
-
'Related Content:'
|
|
417
|
-
)
|
|
418
|
-
),
|
|
419
|
-
documentGroupMapping && documentGroupMapping.map(function (documentGroup) {
|
|
420
|
-
if (!documentGroup.parent) {
|
|
421
|
-
return null;
|
|
406
|
+
if (content_placement && content_placement.length > 0 || documentGroupMapping && documentGroupMapping.length > 0) {
|
|
407
|
+
var relatedLinks = [];
|
|
408
|
+
if (documentGroupMapping && documentGroupMapping.length > 0) {
|
|
409
|
+
documentGroupMapping.forEach(function (documentGroup) {
|
|
410
|
+
if (documentGroup.parent) {
|
|
411
|
+
relatedLinks = [].concat(_toConsumableArray(relatedLinks), [{ label: documentGroup.name, href: cpModificationRequired ? '/' + documentGroup.parent.identifier.current + '/' + documentGroup.path : '/' + documentGroup.path }]);
|
|
422
412
|
}
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
React__default.createElement(
|
|
428
|
-
'span',
|
|
429
|
-
{ className: '' },
|
|
430
|
-
React__default.createElement(
|
|
431
|
-
'a',
|
|
432
|
-
{
|
|
433
|
-
className: 'related-links',
|
|
434
|
-
style: { color: 'blue' },
|
|
435
|
-
href: cpModificationRequired ? '/' + documentGroup.parent.identifier.current + '/' + documentGroup.path : '/' + documentGroup.path },
|
|
436
|
-
documentGroup.name
|
|
437
|
-
)
|
|
438
|
-
),
|
|
439
|
-
content_placement && content_placement.length ? ' | ' : null
|
|
440
|
-
);
|
|
441
|
-
}),
|
|
442
|
-
content_placement && content_placement.length > 0 ? content_placement.filter(function (item) {
|
|
413
|
+
});
|
|
414
|
+
}
|
|
415
|
+
if (content_placement && content_placement.length > 0) {
|
|
416
|
+
content_placement.filter(function (item) {
|
|
443
417
|
return item.path !== 'news';
|
|
444
|
-
}).
|
|
418
|
+
}).forEach(function (cp) {
|
|
445
419
|
var cp_url = cpModificationRequired ? getContentPlacementUrl(cp) : cp.path;
|
|
446
420
|
var href = '/' + cp_url;
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
421
|
+
relatedLinks = [].concat(_toConsumableArray(relatedLinks), [{ label: cp.name, href: href }]);
|
|
422
|
+
});
|
|
423
|
+
}
|
|
424
|
+
if (relatedLinks && relatedLinks.length > 0) {
|
|
425
|
+
return React__default.createElement(
|
|
426
|
+
'div',
|
|
427
|
+
null,
|
|
428
|
+
relatedLinks.map(function (relatedLink, index) {
|
|
429
|
+
return React__default.createElement(
|
|
451
430
|
'span',
|
|
452
|
-
|
|
431
|
+
{ key: index, className: 'related-link' },
|
|
453
432
|
React__default.createElement(
|
|
454
433
|
'a',
|
|
455
|
-
{ className: 'related-links',
|
|
456
|
-
|
|
434
|
+
{ className: 'related-links', style: { color: 'blue' }, href: relatedLink.href },
|
|
435
|
+
relatedLink.label
|
|
436
|
+
),
|
|
437
|
+
React__default.createElement(
|
|
438
|
+
'style',
|
|
439
|
+
{ jsx: 'true' },
|
|
440
|
+
'\n .related-link:not(:first-child):before {\n content: \' | \';\n }\n '
|
|
457
441
|
)
|
|
458
|
-
)
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
442
|
+
);
|
|
443
|
+
})
|
|
444
|
+
);
|
|
445
|
+
}
|
|
446
|
+
return null;
|
|
463
447
|
}
|
|
464
448
|
return null;
|
|
465
449
|
};
|
|
466
450
|
|
|
467
|
-
var
|
|
451
|
+
var renderRelatedSection = function renderRelatedSection() {
|
|
468
452
|
if (showRelatedArticles) {
|
|
469
453
|
return React__default.createElement(
|
|
470
|
-
'
|
|
471
|
-
{ className: 'related-contents-
|
|
454
|
+
'section',
|
|
455
|
+
{ className: 'related-contents-section' },
|
|
456
|
+
React__default.createElement(
|
|
457
|
+
'p',
|
|
458
|
+
{ className: 'mb-0' },
|
|
459
|
+
React__default.createElement(
|
|
460
|
+
'b',
|
|
461
|
+
null,
|
|
462
|
+
'Related Content:'
|
|
463
|
+
)
|
|
464
|
+
),
|
|
472
465
|
React__default.createElement(
|
|
473
466
|
'div',
|
|
474
467
|
null,
|
|
@@ -482,7 +475,7 @@ var Article = function Article(props) {
|
|
|
482
475
|
React__default.createElement(
|
|
483
476
|
'style',
|
|
484
477
|
{ jsx: 'true' },
|
|
485
|
-
'\n
|
|
478
|
+
'\n .related-contents-section {\n padding: 0.5rem;\n background-color: #e6e6e6;\n border-radius: 0.25rem;\n }\n '
|
|
486
479
|
)
|
|
487
480
|
);
|
|
488
481
|
}
|
|
@@ -592,7 +585,7 @@ var Article = function Article(props) {
|
|
|
592
585
|
{ id: 'contextual-video-ad-' + payload._id, className: 'contextual-video-ad' },
|
|
593
586
|
React__default.createElement(DFPAdSlot, _extends({}, payload.contextualVideoAD, { refreshFlag: false, checkIsAdFound: checkIsVideoAdFound }))
|
|
594
587
|
),
|
|
595
|
-
|
|
588
|
+
renderRelatedSection(),
|
|
596
589
|
React__default.createElement(BlockContent, _extends({
|
|
597
590
|
serializers: getSerializers(client, pageview, videoAccountIDs, onVote, true, drupalLeadSettings, currentPage, false, null, null, null, targeting),
|
|
598
591
|
blocks: [].concat(_toConsumableArray(articleBody.slice(selectedIndex))),
|
|
@@ -660,7 +653,7 @@ var Article = function Article(props) {
|
|
|
660
653
|
React__default.createElement(DFPAdSlot, _extends({}, payload.contextualAD, { refreshFlag: false, checkIsAdFound: _checkIsAdFound }))
|
|
661
654
|
),
|
|
662
655
|
contextualADFlag && React__default.createElement('span', { className: 'clearfix' }),
|
|
663
|
-
|
|
656
|
+
renderRelatedSection(),
|
|
664
657
|
React__default.createElement(BlockContent, _extends({
|
|
665
658
|
serializers: getSerializers(client, pageview, videoAccountIDs, onVote, true, drupalLeadSettings, currentPage, false, null, null, null, targeting),
|
|
666
659
|
blocks: [].concat(_toConsumableArray(articleBody.slice(_selectedIndex))),
|
|
@@ -703,7 +696,7 @@ var Article = function Article(props) {
|
|
|
703
696
|
{ id: 'contextual-video-ad-' + payload._id, className: 'contextual-video-ad' },
|
|
704
697
|
React__default.createElement(DFPAdSlot, _extends({}, payload.contextualVideoAD, { refreshFlag: false, checkIsAdFound: _checkIsAdFound2 }))
|
|
705
698
|
),
|
|
706
|
-
|
|
699
|
+
renderRelatedSection(),
|
|
707
700
|
React__default.createElement(BlockContent, _extends({
|
|
708
701
|
serializers: getSerializers(client, pageview, videoAccountIDs, onVote, true, drupalLeadSettings, currentPage, false, null, null, null, targeting),
|
|
709
702
|
blocks: [].concat(_toConsumableArray(articleBody.slice(_selectedIndex2))),
|
|
@@ -721,7 +714,7 @@ var Article = function Article(props) {
|
|
|
721
714
|
imageOptions: { w: 320, h: 240, fit: 'max' }
|
|
722
715
|
}, client.config())),
|
|
723
716
|
React__default.createElement('span', { className: 'clearfix' }),
|
|
724
|
-
|
|
717
|
+
renderRelatedSection(),
|
|
725
718
|
React__default.createElement(BlockContent, _extends({
|
|
726
719
|
serializers: getSerializers(client, pageview, videoAccountIDs, onVote, true, drupalLeadSettings, currentPage, false, null, null, null, targeting),
|
|
727
720
|
blocks: [].concat(_toConsumableArray(articleBody.slice(_selectedIndex3))),
|
|
@@ -1014,13 +1007,12 @@ var _this = undefined;
|
|
|
1014
1007
|
|
|
1015
1008
|
var getRelatedContents = function () {
|
|
1016
1009
|
var _ref = _asyncToGenerator( /*#__PURE__*/regenerator.mark(function _callee() {
|
|
1017
|
-
var ctx = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
|
|
1018
1010
|
var client = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
|
|
1019
1011
|
var article = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
1020
1012
|
var prevUrl = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : '/';
|
|
1021
1013
|
var articleCount = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 0;
|
|
1022
1014
|
|
|
1023
|
-
var _article$url, url, content_placement, documentGroupMapping, issueGroup, params, conditions, taxonomy, documentGroup,
|
|
1015
|
+
var _article$url, url, content_placement, documentGroupMapping, issueGroup, params, conditions, taxonomy, documentGroup, relatedContents, relatedContentQuery;
|
|
1024
1016
|
|
|
1025
1017
|
return regenerator.wrap(function _callee$(_context) {
|
|
1026
1018
|
while (1) {
|
|
@@ -1031,13 +1023,9 @@ var getRelatedContents = function () {
|
|
|
1031
1023
|
current: null
|
|
1032
1024
|
} : _article$url;
|
|
1033
1025
|
url = _article$url.current, content_placement = article.content_placement, documentGroupMapping = article.documentGroupMapping, issueGroup = article.issueGroup;
|
|
1034
|
-
params = {
|
|
1035
|
-
url: url,
|
|
1036
|
-
index: articleCount
|
|
1037
|
-
};
|
|
1026
|
+
params = { url: url };
|
|
1038
1027
|
conditions = '';
|
|
1039
1028
|
|
|
1040
|
-
//404 articles were throwing server error
|
|
1041
1029
|
|
|
1042
1030
|
if (content_placement && content_placement.length > 0) {
|
|
1043
1031
|
taxonomy = [];
|
|
@@ -1055,15 +1043,20 @@ var getRelatedContents = function () {
|
|
|
1055
1043
|
}
|
|
1056
1044
|
if (prev_url_to_check.endsWith(path) && _id) taxonomy.push(_id);
|
|
1057
1045
|
});
|
|
1058
|
-
if (taxonomy.length === 0)
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1046
|
+
if (taxonomy.length === 0) {
|
|
1047
|
+
content_placement.filter(function (_ref3) {
|
|
1048
|
+
var identifier = _ref3.identifier;
|
|
1049
|
+
return identifier !== 'news';
|
|
1050
|
+
}).forEach(function (_ref4) {
|
|
1051
|
+
var _id = _ref4._id;
|
|
1052
|
+
|
|
1053
|
+
if (_id) taxonomy.push(_id);
|
|
1054
|
+
});
|
|
1055
|
+
}
|
|
1056
|
+
if (taxonomy.length > 0) {
|
|
1057
|
+
params = _extends({}, params, { taxonomy: taxonomy });
|
|
1058
|
+
conditions = '&& taxonomyMapping[]._ref in $taxonomy';
|
|
1059
|
+
}
|
|
1067
1060
|
}
|
|
1068
1061
|
|
|
1069
1062
|
if (documentGroupMapping && documentGroupMapping.length > 0) {
|
|
@@ -1074,48 +1067,56 @@ var getRelatedContents = function () {
|
|
|
1074
1067
|
|
|
1075
1068
|
if (_id) documentGroup.push(_id);
|
|
1076
1069
|
});
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
if (issueGroup) {
|
|
1082
|
-
params = _extends({}, params, { issueAssociation: issueGroup._ref });
|
|
1083
|
-
conditions = conditions.concat('&& issueGroup._ref == $issueAssociation ');
|
|
1070
|
+
if (params.taxonomy && documentGroup.length > 0) {
|
|
1071
|
+
params = _extends({}, params, { documentGroup: documentGroup });
|
|
1072
|
+
conditions = '&& (taxonomyMapping[]._ref in $taxonomy || documentGroupMapping[]._ref in $documentGroup)';
|
|
1073
|
+
}
|
|
1084
1074
|
}
|
|
1085
1075
|
|
|
1086
|
-
if (
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
if (
|
|
1091
|
-
|
|
1092
|
-
conditions = '&&
|
|
1093
|
-
}
|
|
1076
|
+
if (issueGroup && issueGroup._ref) {
|
|
1077
|
+
if (params.taxonomy && params.documentGroup) {
|
|
1078
|
+
params = _extends({}, params, { issueAssociation: issueGroup._ref });
|
|
1079
|
+
conditions = '&& (taxonomyMapping[]._ref in $taxonomy || documentGroupMapping[]._ref in $documentGroup || issueGroup._ref == $issueAssociation )';
|
|
1080
|
+
} else if (params.taxonomy) {
|
|
1081
|
+
params = _extends({}, params, { issueAssociation: issueGroup._ref });
|
|
1082
|
+
conditions = '&& (taxonomyMapping[]._ref in $taxonomy || issueGroup._ref == $issueAssociation )';
|
|
1083
|
+
}
|
|
1094
1084
|
}
|
|
1095
1085
|
|
|
1096
1086
|
relatedContents = [];
|
|
1097
1087
|
|
|
1098
1088
|
if (!(params.taxonomy && params.taxonomy.length > 0)) {
|
|
1099
|
-
_context.next =
|
|
1089
|
+
_context.next = 21;
|
|
1100
1090
|
break;
|
|
1101
1091
|
}
|
|
1102
1092
|
|
|
1103
|
-
relatedContentQuery =
|
|
1093
|
+
relatedContentQuery = '*[\n _type == "article"\n && defined(title)\n && defined(url)\n && !(_id in path("drafts.**"))\n && is_visible == true\n && passwordLock != true\n && taxonomyMapping[].disableAds != \'true\'\n && contentCategory.name != \'Poll\'\n && contentCategory.name != \'Slideshows\'\n \t&& contentCategory.disableAds != \'true\'\n && ExcludeFromInfiniteScroll != true\n && url.current != $url\n && !defined(body[].videos)\n && published <= \'' + new Date().toISOString() + '\'\n ' + conditions + '\n ]| order(published desc)[' + articleCount + ']\n {\n title,\n url,\n thumbnail\n }';
|
|
1094
|
+
_context.prev = 11;
|
|
1104
1095
|
_context.next = 14;
|
|
1105
1096
|
return client.fetch(relatedContentQuery, params);
|
|
1106
1097
|
|
|
1107
1098
|
case 14:
|
|
1108
1099
|
relatedContents = _context.sent;
|
|
1109
1100
|
|
|
1110
|
-
|
|
1101
|
+
debugger;
|
|
1102
|
+
_context.next = 21;
|
|
1103
|
+
break;
|
|
1104
|
+
|
|
1105
|
+
case 18:
|
|
1106
|
+
_context.prev = 18;
|
|
1107
|
+
_context.t0 = _context['catch'](11);
|
|
1108
|
+
|
|
1109
|
+
console.error(_context.t0);
|
|
1110
|
+
|
|
1111
|
+
case 21:
|
|
1111
1112
|
return _context.abrupt('return', relatedContents);
|
|
1112
1113
|
|
|
1113
|
-
case
|
|
1114
|
+
case 22:
|
|
1114
1115
|
case 'end':
|
|
1115
1116
|
return _context.stop();
|
|
1116
1117
|
}
|
|
1117
1118
|
}
|
|
1118
|
-
}, _callee, _this);
|
|
1119
|
+
}, _callee, _this, [[11, 18]]);
|
|
1119
1120
|
}));
|
|
1120
1121
|
|
|
1121
1122
|
return function getRelatedContents() {
|