@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/cjs/View.js
CHANGED
|
@@ -59,7 +59,7 @@ var keys = require('./keys-a586b7a0.js');
|
|
|
59
59
|
require('react-bootstrap/Dropdown');
|
|
60
60
|
var getSeriesDetail = require('./getSeriesDetail.js');
|
|
61
61
|
require('./index-bd6c9f56.js');
|
|
62
|
-
var getRelatedArticle = require('./getRelatedArticle
|
|
62
|
+
var getRelatedArticle = require('./getRelatedArticle.js');
|
|
63
63
|
var getQuery = require('./getQuery.js');
|
|
64
64
|
var getTargeting = require('./getTargeting-9af0ef69.js');
|
|
65
65
|
var getKeywords = require('./getKeywords.js');
|
|
@@ -188,7 +188,7 @@ var findIndex = function findIndex(arr) {
|
|
|
188
188
|
return indexes;
|
|
189
189
|
};
|
|
190
190
|
|
|
191
|
-
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
|
|
191
|
+
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";
|
|
192
192
|
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" };
|
|
193
193
|
styleInject_es.styleInject(css);
|
|
194
194
|
|
|
@@ -409,72 +409,65 @@ var Article = function Article(props) {
|
|
|
409
409
|
};
|
|
410
410
|
|
|
411
411
|
var RelevantTopics = function RelevantTopics() {
|
|
412
|
-
if (content_placement && content_placement.length > 0 || documentGroupMapping) {
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
{ className: 'mb-0' },
|
|
419
|
-
React__default.createElement(
|
|
420
|
-
'b',
|
|
421
|
-
null,
|
|
422
|
-
'Related Content:'
|
|
423
|
-
)
|
|
424
|
-
),
|
|
425
|
-
documentGroupMapping && documentGroupMapping.map(function (documentGroup) {
|
|
426
|
-
if (!documentGroup.parent) {
|
|
427
|
-
return null;
|
|
412
|
+
if (content_placement && content_placement.length > 0 || documentGroupMapping && documentGroupMapping.length > 0) {
|
|
413
|
+
var relatedLinks = [];
|
|
414
|
+
if (documentGroupMapping && documentGroupMapping.length > 0) {
|
|
415
|
+
documentGroupMapping.forEach(function (documentGroup) {
|
|
416
|
+
if (documentGroup.parent) {
|
|
417
|
+
relatedLinks = [].concat(toConsumableArray._toConsumableArray(relatedLinks), [{ label: documentGroup.name, href: cpModificationRequired ? '/' + documentGroup.parent.identifier.current + '/' + documentGroup.path : '/' + documentGroup.path }]);
|
|
428
418
|
}
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
React__default.createElement(
|
|
434
|
-
'span',
|
|
435
|
-
{ className: '' },
|
|
436
|
-
React__default.createElement(
|
|
437
|
-
'a',
|
|
438
|
-
{
|
|
439
|
-
className: 'related-links',
|
|
440
|
-
style: { color: 'blue' },
|
|
441
|
-
href: cpModificationRequired ? '/' + documentGroup.parent.identifier.current + '/' + documentGroup.path : '/' + documentGroup.path },
|
|
442
|
-
documentGroup.name
|
|
443
|
-
)
|
|
444
|
-
),
|
|
445
|
-
content_placement && content_placement.length ? ' | ' : null
|
|
446
|
-
);
|
|
447
|
-
}),
|
|
448
|
-
content_placement && content_placement.length > 0 ? content_placement.filter(function (item) {
|
|
419
|
+
});
|
|
420
|
+
}
|
|
421
|
+
if (content_placement && content_placement.length > 0) {
|
|
422
|
+
content_placement.filter(function (item) {
|
|
449
423
|
return item.path !== 'news';
|
|
450
|
-
}).
|
|
424
|
+
}).forEach(function (cp) {
|
|
451
425
|
var cp_url = cpModificationRequired ? getTargeting.getContentPlacementUrl(cp) : cp.path;
|
|
452
426
|
var href = '/' + cp_url;
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
427
|
+
relatedLinks = [].concat(toConsumableArray._toConsumableArray(relatedLinks), [{ label: cp.name, href: href }]);
|
|
428
|
+
});
|
|
429
|
+
}
|
|
430
|
+
if (relatedLinks && relatedLinks.length > 0) {
|
|
431
|
+
return React__default.createElement(
|
|
432
|
+
'div',
|
|
433
|
+
null,
|
|
434
|
+
relatedLinks.map(function (relatedLink, index) {
|
|
435
|
+
return React__default.createElement(
|
|
457
436
|
'span',
|
|
458
|
-
|
|
437
|
+
{ key: index, className: 'related-link' },
|
|
459
438
|
React__default.createElement(
|
|
460
439
|
'a',
|
|
461
|
-
{ className: 'related-links',
|
|
462
|
-
|
|
440
|
+
{ className: 'related-links', style: { color: 'blue' }, href: relatedLink.href },
|
|
441
|
+
relatedLink.label
|
|
442
|
+
),
|
|
443
|
+
React__default.createElement(
|
|
444
|
+
'style',
|
|
445
|
+
{ jsx: 'true' },
|
|
446
|
+
'\n .related-link:not(:first-child):before {\n content: \' | \';\n }\n '
|
|
463
447
|
)
|
|
464
|
-
)
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
448
|
+
);
|
|
449
|
+
})
|
|
450
|
+
);
|
|
451
|
+
}
|
|
452
|
+
return null;
|
|
469
453
|
}
|
|
470
454
|
return null;
|
|
471
455
|
};
|
|
472
456
|
|
|
473
|
-
var
|
|
457
|
+
var renderRelatedSection = function renderRelatedSection() {
|
|
474
458
|
if (showRelatedArticles) {
|
|
475
459
|
return React__default.createElement(
|
|
476
|
-
'
|
|
477
|
-
{ className: 'related-contents-
|
|
460
|
+
'section',
|
|
461
|
+
{ className: 'related-contents-section' },
|
|
462
|
+
React__default.createElement(
|
|
463
|
+
'p',
|
|
464
|
+
{ className: 'mb-0' },
|
|
465
|
+
React__default.createElement(
|
|
466
|
+
'b',
|
|
467
|
+
null,
|
|
468
|
+
'Related Content:'
|
|
469
|
+
)
|
|
470
|
+
),
|
|
478
471
|
React__default.createElement(
|
|
479
472
|
'div',
|
|
480
473
|
null,
|
|
@@ -488,7 +481,7 @@ var Article = function Article(props) {
|
|
|
488
481
|
React__default.createElement(
|
|
489
482
|
'style',
|
|
490
483
|
{ jsx: 'true' },
|
|
491
|
-
'\n
|
|
484
|
+
'\n .related-contents-section {\n padding: 0.5rem;\n background-color: #e6e6e6;\n border-radius: 0.25rem;\n }\n '
|
|
492
485
|
)
|
|
493
486
|
);
|
|
494
487
|
}
|
|
@@ -598,7 +591,7 @@ var Article = function Article(props) {
|
|
|
598
591
|
{ id: 'contextual-video-ad-' + payload._id, className: 'contextual-video-ad' },
|
|
599
592
|
React__default.createElement(AdSlot, _extends$1._extends({}, payload.contextualVideoAD, { refreshFlag: false, checkIsAdFound: checkIsVideoAdFound }))
|
|
600
593
|
),
|
|
601
|
-
|
|
594
|
+
renderRelatedSection(),
|
|
602
595
|
React__default.createElement(BlockContent.BlockContent, _extends$1._extends({
|
|
603
596
|
serializers: getSerializers.getSerializers(client, pageview, videoAccountIDs, onVote, true, drupalLeadSettings, currentPage, false, null, null, null, targeting),
|
|
604
597
|
blocks: [].concat(toConsumableArray._toConsumableArray(articleBody.slice(selectedIndex))),
|
|
@@ -666,7 +659,7 @@ var Article = function Article(props) {
|
|
|
666
659
|
React__default.createElement(AdSlot, _extends$1._extends({}, payload.contextualAD, { refreshFlag: false, checkIsAdFound: _checkIsAdFound }))
|
|
667
660
|
),
|
|
668
661
|
contextualADFlag && React__default.createElement('span', { className: 'clearfix' }),
|
|
669
|
-
|
|
662
|
+
renderRelatedSection(),
|
|
670
663
|
React__default.createElement(BlockContent.BlockContent, _extends$1._extends({
|
|
671
664
|
serializers: getSerializers.getSerializers(client, pageview, videoAccountIDs, onVote, true, drupalLeadSettings, currentPage, false, null, null, null, targeting),
|
|
672
665
|
blocks: [].concat(toConsumableArray._toConsumableArray(articleBody.slice(_selectedIndex))),
|
|
@@ -709,7 +702,7 @@ var Article = function Article(props) {
|
|
|
709
702
|
{ id: 'contextual-video-ad-' + payload._id, className: 'contextual-video-ad' },
|
|
710
703
|
React__default.createElement(AdSlot, _extends$1._extends({}, payload.contextualVideoAD, { refreshFlag: false, checkIsAdFound: _checkIsAdFound2 }))
|
|
711
704
|
),
|
|
712
|
-
|
|
705
|
+
renderRelatedSection(),
|
|
713
706
|
React__default.createElement(BlockContent.BlockContent, _extends$1._extends({
|
|
714
707
|
serializers: getSerializers.getSerializers(client, pageview, videoAccountIDs, onVote, true, drupalLeadSettings, currentPage, false, null, null, null, targeting),
|
|
715
708
|
blocks: [].concat(toConsumableArray._toConsumableArray(articleBody.slice(_selectedIndex2))),
|
|
@@ -727,7 +720,7 @@ var Article = function Article(props) {
|
|
|
727
720
|
imageOptions: { w: 320, h: 240, fit: 'max' }
|
|
728
721
|
}, client.config())),
|
|
729
722
|
React__default.createElement('span', { className: 'clearfix' }),
|
|
730
|
-
|
|
723
|
+
renderRelatedSection(),
|
|
731
724
|
React__default.createElement(BlockContent.BlockContent, _extends$1._extends({
|
|
732
725
|
serializers: getSerializers.getSerializers(client, pageview, videoAccountIDs, onVote, true, drupalLeadSettings, currentPage, false, null, null, null, targeting),
|
|
733
726
|
blocks: [].concat(toConsumableArray._toConsumableArray(articleBody.slice(_selectedIndex3))),
|
|
@@ -1020,13 +1013,12 @@ var _this = undefined;
|
|
|
1020
1013
|
|
|
1021
1014
|
var getRelatedContents = function () {
|
|
1022
1015
|
var _ref = asyncToGenerator._asyncToGenerator( /*#__PURE__*/asyncToGenerator.regenerator.mark(function _callee() {
|
|
1023
|
-
var ctx = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
|
|
1024
1016
|
var client = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
|
|
1025
1017
|
var article = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
1026
1018
|
var prevUrl = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : '/';
|
|
1027
1019
|
var articleCount = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 0;
|
|
1028
1020
|
|
|
1029
|
-
var _article$url, url, content_placement, documentGroupMapping, issueGroup, params, conditions, taxonomy, documentGroup,
|
|
1021
|
+
var _article$url, url, content_placement, documentGroupMapping, issueGroup, params, conditions, taxonomy, documentGroup, relatedContents, relatedContentQuery;
|
|
1030
1022
|
|
|
1031
1023
|
return asyncToGenerator.regenerator.wrap(function _callee$(_context) {
|
|
1032
1024
|
while (1) {
|
|
@@ -1037,13 +1029,9 @@ var getRelatedContents = function () {
|
|
|
1037
1029
|
current: null
|
|
1038
1030
|
} : _article$url;
|
|
1039
1031
|
url = _article$url.current, content_placement = article.content_placement, documentGroupMapping = article.documentGroupMapping, issueGroup = article.issueGroup;
|
|
1040
|
-
params = {
|
|
1041
|
-
url: url,
|
|
1042
|
-
index: articleCount
|
|
1043
|
-
};
|
|
1032
|
+
params = { url: url };
|
|
1044
1033
|
conditions = '';
|
|
1045
1034
|
|
|
1046
|
-
//404 articles were throwing server error
|
|
1047
1035
|
|
|
1048
1036
|
if (content_placement && content_placement.length > 0) {
|
|
1049
1037
|
taxonomy = [];
|
|
@@ -1061,15 +1049,20 @@ var getRelatedContents = function () {
|
|
|
1061
1049
|
}
|
|
1062
1050
|
if (prev_url_to_check.endsWith(path) && _id) taxonomy.push(_id);
|
|
1063
1051
|
});
|
|
1064
|
-
if (taxonomy.length === 0)
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1052
|
+
if (taxonomy.length === 0) {
|
|
1053
|
+
content_placement.filter(function (_ref3) {
|
|
1054
|
+
var identifier = _ref3.identifier;
|
|
1055
|
+
return identifier !== 'news';
|
|
1056
|
+
}).forEach(function (_ref4) {
|
|
1057
|
+
var _id = _ref4._id;
|
|
1058
|
+
|
|
1059
|
+
if (_id) taxonomy.push(_id);
|
|
1060
|
+
});
|
|
1061
|
+
}
|
|
1062
|
+
if (taxonomy.length > 0) {
|
|
1063
|
+
params = _extends$1._extends({}, params, { taxonomy: taxonomy });
|
|
1064
|
+
conditions = '&& taxonomyMapping[]._ref in $taxonomy';
|
|
1065
|
+
}
|
|
1073
1066
|
}
|
|
1074
1067
|
|
|
1075
1068
|
if (documentGroupMapping && documentGroupMapping.length > 0) {
|
|
@@ -1080,48 +1073,56 @@ var getRelatedContents = function () {
|
|
|
1080
1073
|
|
|
1081
1074
|
if (_id) documentGroup.push(_id);
|
|
1082
1075
|
});
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
if (issueGroup) {
|
|
1088
|
-
params = _extends$1._extends({}, params, { issueAssociation: issueGroup._ref });
|
|
1089
|
-
conditions = conditions.concat('&& issueGroup._ref == $issueAssociation ');
|
|
1076
|
+
if (params.taxonomy && documentGroup.length > 0) {
|
|
1077
|
+
params = _extends$1._extends({}, params, { documentGroup: documentGroup });
|
|
1078
|
+
conditions = '&& (taxonomyMapping[]._ref in $taxonomy || documentGroupMapping[]._ref in $documentGroup)';
|
|
1079
|
+
}
|
|
1090
1080
|
}
|
|
1091
1081
|
|
|
1092
|
-
if (
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
if (
|
|
1097
|
-
|
|
1098
|
-
conditions = '&&
|
|
1099
|
-
}
|
|
1082
|
+
if (issueGroup && issueGroup._ref) {
|
|
1083
|
+
if (params.taxonomy && params.documentGroup) {
|
|
1084
|
+
params = _extends$1._extends({}, params, { issueAssociation: issueGroup._ref });
|
|
1085
|
+
conditions = '&& (taxonomyMapping[]._ref in $taxonomy || documentGroupMapping[]._ref in $documentGroup || issueGroup._ref == $issueAssociation )';
|
|
1086
|
+
} else if (params.taxonomy) {
|
|
1087
|
+
params = _extends$1._extends({}, params, { issueAssociation: issueGroup._ref });
|
|
1088
|
+
conditions = '&& (taxonomyMapping[]._ref in $taxonomy || issueGroup._ref == $issueAssociation )';
|
|
1089
|
+
}
|
|
1100
1090
|
}
|
|
1101
1091
|
|
|
1102
1092
|
relatedContents = [];
|
|
1103
1093
|
|
|
1104
1094
|
if (!(params.taxonomy && params.taxonomy.length > 0)) {
|
|
1105
|
-
_context.next =
|
|
1095
|
+
_context.next = 21;
|
|
1106
1096
|
break;
|
|
1107
1097
|
}
|
|
1108
1098
|
|
|
1109
|
-
relatedContentQuery =
|
|
1099
|
+
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 }';
|
|
1100
|
+
_context.prev = 11;
|
|
1110
1101
|
_context.next = 14;
|
|
1111
1102
|
return client.fetch(relatedContentQuery, params);
|
|
1112
1103
|
|
|
1113
1104
|
case 14:
|
|
1114
1105
|
relatedContents = _context.sent;
|
|
1115
1106
|
|
|
1116
|
-
|
|
1107
|
+
debugger;
|
|
1108
|
+
_context.next = 21;
|
|
1109
|
+
break;
|
|
1110
|
+
|
|
1111
|
+
case 18:
|
|
1112
|
+
_context.prev = 18;
|
|
1113
|
+
_context.t0 = _context['catch'](11);
|
|
1114
|
+
|
|
1115
|
+
console.error(_context.t0);
|
|
1116
|
+
|
|
1117
|
+
case 21:
|
|
1117
1118
|
return _context.abrupt('return', relatedContents);
|
|
1118
1119
|
|
|
1119
|
-
case
|
|
1120
|
+
case 22:
|
|
1120
1121
|
case 'end':
|
|
1121
1122
|
return _context.stop();
|
|
1122
1123
|
}
|
|
1123
1124
|
}
|
|
1124
|
-
}, _callee, _this);
|
|
1125
|
+
}, _callee, _this, [[11, 18]]);
|
|
1125
1126
|
}));
|
|
1126
1127
|
|
|
1127
1128
|
return function getRelatedContents() {
|
|
@@ -1264,7 +1265,7 @@ var ArticleQueue = function ArticleQueue(props) {
|
|
|
1264
1265
|
startingIndex = queueData.length + 1;
|
|
1265
1266
|
endingIndex = startingIndex + 2;
|
|
1266
1267
|
_context.next = 5;
|
|
1267
|
-
return getRelatedArticle
|
|
1268
|
+
return getRelatedArticle(null, props.client, article, prevUrl, startingIndex + '..' + endingIndex);
|
|
1268
1269
|
|
|
1269
1270
|
case 5:
|
|
1270
1271
|
article.relatedArticle = _context.sent;
|
|
@@ -1649,7 +1650,7 @@ View.returnGetInitialProps = function () {
|
|
|
1649
1650
|
}
|
|
1650
1651
|
|
|
1651
1652
|
_context.next = 17;
|
|
1652
|
-
return getRelatedArticle
|
|
1653
|
+
return getRelatedArticle(context, client, article, prevUrl, '0..2');
|
|
1653
1654
|
|
|
1654
1655
|
case 17:
|
|
1655
1656
|
article.relatedArticle = _context.sent;
|