@mjhls/mjh-framework 1.0.691-beta.0 → 1.0.691-beta.2
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/AdSlotsProvider.js +18 -0
- package/dist/cjs/View.js +63 -260
- package/dist/cjs/getQuery.js +2 -2
- package/dist/esm/AdSlotsProvider.js +20 -2
- package/dist/esm/View.js +63 -260
- package/dist/esm/getQuery.js +2 -2
- package/package.json +1 -1
|
@@ -16,6 +16,24 @@ var AdSlotsProvider = function AdSlotsProvider(_ref) {
|
|
|
16
16
|
_ref$singleRequest = _ref.singleRequest,
|
|
17
17
|
singleRequest = _ref$singleRequest === undefined ? true : _ref$singleRequest;
|
|
18
18
|
|
|
19
|
+
React.useEffect(function () {
|
|
20
|
+
// Refresh ADs after every one minute of user not scrolled
|
|
21
|
+
var isScrolling = void 0;
|
|
22
|
+
var refreshADsAfterInterval = function refreshADsAfterInterval() {
|
|
23
|
+
isScrolling = setInterval(function () {
|
|
24
|
+
index.lib_3.refresh();
|
|
25
|
+
}, 30000);
|
|
26
|
+
};
|
|
27
|
+
refreshADsAfterInterval();
|
|
28
|
+
window.addEventListener('scroll', function () {
|
|
29
|
+
clearInterval(isScrolling);
|
|
30
|
+
refreshADsAfterInterval();
|
|
31
|
+
}, false);
|
|
32
|
+
return function () {
|
|
33
|
+
clearInterval(isScrolling);
|
|
34
|
+
};
|
|
35
|
+
}, []);
|
|
36
|
+
|
|
19
37
|
return React__default.createElement(
|
|
20
38
|
index.lib_1,
|
|
21
39
|
{
|
package/dist/cjs/View.js
CHANGED
|
@@ -253,7 +253,7 @@ var ISI = function ISI(props) {
|
|
|
253
253
|
);
|
|
254
254
|
};
|
|
255
255
|
|
|
256
|
-
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 padding-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-
|
|
256
|
+
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 padding-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 }\r\n .RelatedArticles-module_imgWrapper__5Jx_4 img {\r\n width: 100%;\r\n height: auto;\r\n\r\n max-height: 175px;\r\n object-fit: contain;\r\n margin-bottom: 1rem;\r\n }\r\n}\r\n";
|
|
257
257
|
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" };
|
|
258
258
|
styleInject_es.styleInject(css);
|
|
259
259
|
|
|
@@ -349,7 +349,6 @@ var Article = function Article(props) {
|
|
|
349
349
|
};
|
|
350
350
|
}();
|
|
351
351
|
|
|
352
|
-
console.log(props);
|
|
353
352
|
var article = props.article,
|
|
354
353
|
Ads = props.Ads,
|
|
355
354
|
showRelatedArticles = props.showRelatedArticles,
|
|
@@ -490,47 +489,61 @@ var Article = function Article(props) {
|
|
|
490
489
|
};
|
|
491
490
|
|
|
492
491
|
var RelevantTopics = function RelevantTopics() {
|
|
493
|
-
if (content_placement && content_placement.length > 0 || documentGroupMapping
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
492
|
+
if (content_placement && content_placement.length > 0 || documentGroupMapping) {
|
|
493
|
+
return React__default.createElement(
|
|
494
|
+
'div',
|
|
495
|
+
{ style: { color: '#262626' } },
|
|
496
|
+
React__default.createElement(
|
|
497
|
+
'p',
|
|
498
|
+
{ className: 'mb-0' },
|
|
499
|
+
React__default.createElement(
|
|
500
|
+
'b',
|
|
501
|
+
null,
|
|
502
|
+
'Related Content:'
|
|
503
|
+
)
|
|
504
|
+
),
|
|
505
|
+
documentGroupMapping && documentGroupMapping.map(function (documentGroup) {
|
|
506
|
+
if (!documentGroup.parent) {
|
|
507
|
+
return null;
|
|
499
508
|
}
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
509
|
+
|
|
510
|
+
return React__default.createElement(
|
|
511
|
+
React__default.Fragment,
|
|
512
|
+
null,
|
|
513
|
+
React__default.createElement(
|
|
514
|
+
'span',
|
|
515
|
+
{ className: '' },
|
|
516
|
+
React__default.createElement(
|
|
517
|
+
'a',
|
|
518
|
+
{
|
|
519
|
+
className: 'related-links',
|
|
520
|
+
style: { color: 'blue' },
|
|
521
|
+
href: cpModificationRequired ? '/' + documentGroup.parent.identifier.current + '/' + documentGroup.path : '/' + documentGroup.path },
|
|
522
|
+
documentGroup.name
|
|
523
|
+
)
|
|
524
|
+
),
|
|
525
|
+
content_placement && content_placement.length ? ' | ' : null
|
|
526
|
+
);
|
|
527
|
+
}),
|
|
528
|
+
content_placement && content_placement.length > 0 ? content_placement.map(function (cp, index) {
|
|
506
529
|
var cp_url = cpModificationRequired ? getTargeting.getContentPlacementUrl(cp) : cp.path;
|
|
507
530
|
var href = '/' + cp_url;
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
return React__default.createElement(
|
|
513
|
-
'div',
|
|
514
|
-
null,
|
|
515
|
-
relatedLinks.map(function (relatedLink, index) {
|
|
516
|
-
return React__default.createElement(
|
|
531
|
+
return React__default.createElement(
|
|
532
|
+
React__default.Fragment,
|
|
533
|
+
{ key: index },
|
|
534
|
+
React__default.createElement(
|
|
517
535
|
'span',
|
|
518
|
-
|
|
536
|
+
null,
|
|
519
537
|
React__default.createElement(
|
|
520
538
|
'a',
|
|
521
|
-
{ className: 'related-links', style: { color: 'blue' }
|
|
522
|
-
|
|
523
|
-
),
|
|
524
|
-
React__default.createElement(
|
|
525
|
-
'style',
|
|
526
|
-
{ jsx: 'true' },
|
|
527
|
-
'\n .related-link:not(:first-child):before {\n content: \' | \';\n }\n '
|
|
539
|
+
{ className: 'related-links', key: index, href: href, style: { color: 'blue' } },
|
|
540
|
+
cp.name
|
|
528
541
|
)
|
|
529
|
-
)
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
542
|
+
),
|
|
543
|
+
content_placement.length > index + 1 ? ' | ' : null
|
|
544
|
+
);
|
|
545
|
+
}) : null
|
|
546
|
+
);
|
|
534
547
|
}
|
|
535
548
|
return null;
|
|
536
549
|
};
|
|
@@ -994,22 +1007,17 @@ var Article = function Article(props) {
|
|
|
994
1007
|
),
|
|
995
1008
|
React__default.createElement('div', { className: 'clearfix', style: { minHeight: '1px' } }),
|
|
996
1009
|
showRelatedArticles && !showIsi && React__default.createElement(
|
|
997
|
-
|
|
1010
|
+
React__default.Fragment,
|
|
998
1011
|
null,
|
|
999
1012
|
React__default.createElement(
|
|
1000
|
-
'
|
|
1001
|
-
|
|
1002
|
-
React__default.createElement(
|
|
1003
|
-
'b',
|
|
1004
|
-
null,
|
|
1005
|
-
'Related Content:'
|
|
1006
|
-
)
|
|
1013
|
+
'div',
|
|
1014
|
+
null,
|
|
1015
|
+
React__default.createElement(RelevantTopics, null)
|
|
1007
1016
|
),
|
|
1008
|
-
React__default.createElement(RelevantTopics, null),
|
|
1009
1017
|
React__default.createElement(
|
|
1010
1018
|
'div',
|
|
1011
1019
|
{ className: 'pt-2' },
|
|
1012
|
-
React__default.createElement(RelatedArticle, { articles: article.
|
|
1020
|
+
React__default.createElement(RelatedArticle, { articles: article.relatedArticle, client: client })
|
|
1013
1021
|
)
|
|
1014
1022
|
)
|
|
1015
1023
|
),
|
|
@@ -1064,201 +1072,6 @@ var Article = function Article(props) {
|
|
|
1064
1072
|
|
|
1065
1073
|
var _this = undefined;
|
|
1066
1074
|
|
|
1067
|
-
var getRelatedContentArticles = function () {
|
|
1068
|
-
var _ref = asyncToGenerator._asyncToGenerator( /*#__PURE__*/asyncToGenerator.regenerator.mark(function _callee() {
|
|
1069
|
-
var client = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
|
|
1070
|
-
var article = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
1071
|
-
var prevUrl = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : '/';
|
|
1072
|
-
var articleCount = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 0;
|
|
1073
|
-
|
|
1074
|
-
var _article$url, url, content_placement, documentGroupMapping, issueGroup, references, params, articles, relatedContentQuery;
|
|
1075
|
-
|
|
1076
|
-
return asyncToGenerator.regenerator.wrap(function _callee$(_context) {
|
|
1077
|
-
while (1) {
|
|
1078
|
-
switch (_context.prev = _context.next) {
|
|
1079
|
-
case 0:
|
|
1080
|
-
_article$url = article.url;
|
|
1081
|
-
_article$url = _article$url === undefined ? {
|
|
1082
|
-
current: null
|
|
1083
|
-
} : _article$url;
|
|
1084
|
-
url = _article$url.current, content_placement = article.content_placement, documentGroupMapping = article.documentGroupMapping, issueGroup = article.issueGroup;
|
|
1085
|
-
references = [];
|
|
1086
|
-
|
|
1087
|
-
if (content_placement && content_placement.length > 0) {
|
|
1088
|
-
content_placement.forEach(function (_ref2) {
|
|
1089
|
-
var path = _ref2.path,
|
|
1090
|
-
_id = _ref2._id;
|
|
1091
|
-
|
|
1092
|
-
if (!_id || typeof _id == 'undefined') {
|
|
1093
|
-
return null;
|
|
1094
|
-
}
|
|
1095
|
-
var prev_url_to_check = prevUrl;
|
|
1096
|
-
if (prev_url_to_check.includes('?')) {
|
|
1097
|
-
prev_url_to_check = prev_url_to_check.split('?')[0];
|
|
1098
|
-
}
|
|
1099
|
-
if (prev_url_to_check.endsWith(path) && _id) references.push(_id);
|
|
1100
|
-
});
|
|
1101
|
-
if (references.length === 0) {
|
|
1102
|
-
content_placement.filter(function (_ref3) {
|
|
1103
|
-
var identifier = _ref3.identifier;
|
|
1104
|
-
return identifier !== 'news';
|
|
1105
|
-
}).forEach(function (_ref4) {
|
|
1106
|
-
var _id = _ref4._id;
|
|
1107
|
-
|
|
1108
|
-
if (_id) references.push(_id);
|
|
1109
|
-
});
|
|
1110
|
-
}
|
|
1111
|
-
}
|
|
1112
|
-
|
|
1113
|
-
if (documentGroupMapping && documentGroupMapping.length > 0) {
|
|
1114
|
-
documentGroupMapping.forEach(function (_ref5) {
|
|
1115
|
-
var _id = _ref5._id;
|
|
1116
|
-
|
|
1117
|
-
if (_id) references.push(_id);
|
|
1118
|
-
});
|
|
1119
|
-
}
|
|
1120
|
-
|
|
1121
|
-
if (issueGroup && issueGroup._ref) {
|
|
1122
|
-
references.push(issueGroup._ref);
|
|
1123
|
-
}
|
|
1124
|
-
|
|
1125
|
-
params = { url: url, references: references };
|
|
1126
|
-
articles = [];
|
|
1127
|
-
|
|
1128
|
-
if (!(params.references && params.references.length > 0)) {
|
|
1129
|
-
_context.next = 20;
|
|
1130
|
-
break;
|
|
1131
|
-
}
|
|
1132
|
-
|
|
1133
|
-
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 && contentCategory.disableAds != \'true\'\n && ExcludeFromInfiniteScroll != true\n && url.current != $url\n && !defined(body[].videos)\n && dateTime(published) <= dateTime(now())\n && references($references)\n ]| order(published desc)[' + articleCount + ']\n {\n title,\n url,\n thumbnail\n }';
|
|
1134
|
-
_context.prev = 11;
|
|
1135
|
-
_context.next = 14;
|
|
1136
|
-
return client.fetch(relatedContentQuery, params);
|
|
1137
|
-
|
|
1138
|
-
case 14:
|
|
1139
|
-
articles = _context.sent;
|
|
1140
|
-
_context.next = 20;
|
|
1141
|
-
break;
|
|
1142
|
-
|
|
1143
|
-
case 17:
|
|
1144
|
-
_context.prev = 17;
|
|
1145
|
-
_context.t0 = _context['catch'](11);
|
|
1146
|
-
|
|
1147
|
-
console.error(_context.t0);
|
|
1148
|
-
|
|
1149
|
-
case 20:
|
|
1150
|
-
return _context.abrupt('return', articles);
|
|
1151
|
-
|
|
1152
|
-
case 21:
|
|
1153
|
-
case 'end':
|
|
1154
|
-
return _context.stop();
|
|
1155
|
-
}
|
|
1156
|
-
}
|
|
1157
|
-
}, _callee, _this, [[11, 17]]);
|
|
1158
|
-
}));
|
|
1159
|
-
|
|
1160
|
-
return function getRelatedContentArticles() {
|
|
1161
|
-
return _ref.apply(this, arguments);
|
|
1162
|
-
};
|
|
1163
|
-
}();
|
|
1164
|
-
|
|
1165
|
-
// const getRelatedContents = async (ctx = null, client = null, article = {}, prevUrl = '/', articleCount = 0) => {
|
|
1166
|
-
// const {
|
|
1167
|
-
// url: { current: url } = {
|
|
1168
|
-
// current: null
|
|
1169
|
-
// },
|
|
1170
|
-
// content_placement,
|
|
1171
|
-
// documentGroupMapping,
|
|
1172
|
-
// issueGroup
|
|
1173
|
-
// } = article
|
|
1174
|
-
// let params = { url }
|
|
1175
|
-
// let conditions = ''
|
|
1176
|
-
|
|
1177
|
-
// if (content_placement && content_placement.length > 0) {
|
|
1178
|
-
// let taxonomy = []
|
|
1179
|
-
// content_placement.forEach(({ path, _id }) => {
|
|
1180
|
-
// if (!_id || typeof _id == 'undefined') {
|
|
1181
|
-
// return null
|
|
1182
|
-
// }
|
|
1183
|
-
// let prev_url_to_check = prevUrl
|
|
1184
|
-
// if (prev_url_to_check.includes('?')) {
|
|
1185
|
-
// prev_url_to_check = prev_url_to_check.split('?')[0]
|
|
1186
|
-
// }
|
|
1187
|
-
// if (prev_url_to_check.endsWith(path) && _id) taxonomy.push(_id)
|
|
1188
|
-
// })
|
|
1189
|
-
// if (taxonomy.length === 0) {
|
|
1190
|
-
// content_placement
|
|
1191
|
-
// .filter(({ identifier }) => identifier !== 'news')
|
|
1192
|
-
// .forEach(({ _id }) => {
|
|
1193
|
-
// if (_id) taxonomy.push(_id)
|
|
1194
|
-
// })
|
|
1195
|
-
// }
|
|
1196
|
-
// if (taxonomy.length > 0) {
|
|
1197
|
-
// params = { ...params, taxonomy }
|
|
1198
|
-
// conditions = `&& taxonomyMapping[]._ref in $taxonomy`
|
|
1199
|
-
// }
|
|
1200
|
-
// }
|
|
1201
|
-
|
|
1202
|
-
// if (documentGroupMapping && documentGroupMapping.length > 0) {
|
|
1203
|
-
// let documentGroup = []
|
|
1204
|
-
// documentGroupMapping.forEach(({ _id }) => {
|
|
1205
|
-
// if (_id) documentGroup.push(_id)
|
|
1206
|
-
// })
|
|
1207
|
-
// if (params.taxonomy && documentGroup.length > 0) {
|
|
1208
|
-
// params = { ...params, documentGroup }
|
|
1209
|
-
// conditions = `&& (taxonomyMapping[]._ref in $taxonomy || documentGroupMapping[]._ref in $documentGroup)`
|
|
1210
|
-
// }
|
|
1211
|
-
// }
|
|
1212
|
-
|
|
1213
|
-
// if (issueGroup && issueGroup._ref) {
|
|
1214
|
-
// if (params.taxonomy && params.documentGroup) {
|
|
1215
|
-
// params = { ...params, issueAssociation: issueGroup._ref }
|
|
1216
|
-
// conditions = `&& (taxonomyMapping[]._ref in $taxonomy || documentGroupMapping[]._ref in $documentGroup || issueGroup._ref == $issueAssociation )`
|
|
1217
|
-
// } else if (params.taxonomy) {
|
|
1218
|
-
// params = { ...params, issueAssociation: issueGroup._ref }
|
|
1219
|
-
// conditions = `&& (taxonomyMapping[]._ref in $taxonomy || issueGroup._ref == $issueAssociation )`
|
|
1220
|
-
// }
|
|
1221
|
-
// }
|
|
1222
|
-
|
|
1223
|
-
// let articles = []
|
|
1224
|
-
// if (params.taxonomy && params.taxonomy.length > 0) {
|
|
1225
|
-
// const relatedContentQuery = `*[
|
|
1226
|
-
// _type == "article"
|
|
1227
|
-
// && defined(title)
|
|
1228
|
-
// && defined(url)
|
|
1229
|
-
// && !(_id in path("drafts.**"))
|
|
1230
|
-
// && is_visible == true
|
|
1231
|
-
// && passwordLock != true
|
|
1232
|
-
// && taxonomyMapping[].disableAds != 'true'
|
|
1233
|
-
// && contentCategory.name != 'Poll'
|
|
1234
|
-
// && contentCategory.name != 'Slideshows'
|
|
1235
|
-
// && contentCategory.disableAds != 'true'
|
|
1236
|
-
// && ExcludeFromInfiniteScroll != true
|
|
1237
|
-
// && url.current != $url
|
|
1238
|
-
// && !defined(body[].videos)
|
|
1239
|
-
// && published <= '${new Date().toISOString()}'
|
|
1240
|
-
// ${conditions}
|
|
1241
|
-
// ]| order(published desc)[${articleCount}]
|
|
1242
|
-
// {
|
|
1243
|
-
// title,
|
|
1244
|
-
// url,
|
|
1245
|
-
// thumbnail
|
|
1246
|
-
// }`
|
|
1247
|
-
|
|
1248
|
-
// try {
|
|
1249
|
-
// articles = await client.fetch(relatedContentQuery, params)
|
|
1250
|
-
// } catch (error) {
|
|
1251
|
-
// console.error(error)
|
|
1252
|
-
// }
|
|
1253
|
-
// }
|
|
1254
|
-
|
|
1255
|
-
// return articles
|
|
1256
|
-
// }
|
|
1257
|
-
|
|
1258
|
-
// export default getRelatedContents
|
|
1259
|
-
|
|
1260
|
-
var _this$1 = undefined;
|
|
1261
|
-
|
|
1262
1075
|
var ArticleQueue = function ArticleQueue(props) {
|
|
1263
1076
|
var _props$prevUrl = props.prevUrl,
|
|
1264
1077
|
prevUrl = _props$prevUrl === undefined ? '/' : _props$prevUrl,
|
|
@@ -1384,7 +1197,7 @@ var ArticleQueue = function ArticleQueue(props) {
|
|
|
1384
1197
|
switch (_context.prev = _context.next) {
|
|
1385
1198
|
case 0:
|
|
1386
1199
|
if (!(article && article._id)) {
|
|
1387
|
-
_context.next =
|
|
1200
|
+
_context.next = 9;
|
|
1388
1201
|
break;
|
|
1389
1202
|
}
|
|
1390
1203
|
|
|
@@ -1396,22 +1209,17 @@ var ArticleQueue = function ArticleQueue(props) {
|
|
|
1396
1209
|
|
|
1397
1210
|
case 5:
|
|
1398
1211
|
article.relatedArticle = _context.sent;
|
|
1399
|
-
_context.next = 8;
|
|
1400
|
-
return getRelatedContentArticles(null, props.client, article, prevUrl, startingIndex + '..' + endingIndex);
|
|
1401
|
-
|
|
1402
|
-
case 8:
|
|
1403
|
-
article.relatedContentArticles = _context.sent;
|
|
1404
1212
|
targeting = getTargeting.getTargeting({ article: article, cpModificationRequired: cpModificationRequired, prevUrl: prevUrl });
|
|
1405
1213
|
|
|
1406
1214
|
article.Ads = Ads.getRightItems(targeting);
|
|
1407
1215
|
setQueueData([].concat(toConsumableArray._toConsumableArray(queueData), [article]));
|
|
1408
1216
|
|
|
1409
|
-
case
|
|
1217
|
+
case 9:
|
|
1410
1218
|
case 'end':
|
|
1411
1219
|
return _context.stop();
|
|
1412
1220
|
}
|
|
1413
1221
|
}
|
|
1414
|
-
}, _callee, _this
|
|
1222
|
+
}, _callee, _this);
|
|
1415
1223
|
}));
|
|
1416
1224
|
|
|
1417
1225
|
return function (_x) {
|
|
@@ -1559,7 +1367,7 @@ var Articles = function Articles(props) {
|
|
|
1559
1367
|
}, defineProperty$1._defineProperty(_extends2, 'pageview', pageview), defineProperty$1._defineProperty(_extends2, 'onVote', function onVote() {}), defineProperty$1._defineProperty(_extends2, 'ISIContent', ISIContent), defineProperty$1._defineProperty(_extends2, 'videoAccountIDs', videoAccountIDs), defineProperty$1._defineProperty(_extends2, 'sponsoredTaxonomies', []), defineProperty$1._defineProperty(_extends2, 'cpModificationRequired', cpModificationRequired), defineProperty$1._defineProperty(_extends2, 'Settings', Settings), defineProperty$1._defineProperty(_extends2, 'canonicalTag', canonicalTag), _extends2), props));
|
|
1560
1368
|
};
|
|
1561
1369
|
|
|
1562
|
-
var _this$
|
|
1370
|
+
var _this$1 = undefined;
|
|
1563
1371
|
|
|
1564
1372
|
var View = function View(props) {
|
|
1565
1373
|
var router = Router.useRouter();
|
|
@@ -1818,12 +1626,12 @@ View.returnGetInitialProps = function () {
|
|
|
1818
1626
|
}
|
|
1819
1627
|
|
|
1820
1628
|
article.relatedArticle = null;
|
|
1821
|
-
_context.next =
|
|
1629
|
+
_context.next = 20;
|
|
1822
1630
|
break;
|
|
1823
1631
|
|
|
1824
1632
|
case 16:
|
|
1825
1633
|
if (!article) {
|
|
1826
|
-
_context.next =
|
|
1634
|
+
_context.next = 20;
|
|
1827
1635
|
break;
|
|
1828
1636
|
}
|
|
1829
1637
|
|
|
@@ -1832,13 +1640,8 @@ View.returnGetInitialProps = function () {
|
|
|
1832
1640
|
|
|
1833
1641
|
case 19:
|
|
1834
1642
|
article.relatedArticle = _context.sent;
|
|
1835
|
-
_context.next = 22;
|
|
1836
|
-
return getRelatedContentArticles(context, client, article, prevUrl, '0..2');
|
|
1837
|
-
|
|
1838
|
-
case 22:
|
|
1839
|
-
article.relatedContentArticles = _context.sent;
|
|
1840
1643
|
|
|
1841
|
-
case
|
|
1644
|
+
case 20:
|
|
1842
1645
|
return _context.abrupt('return', {
|
|
1843
1646
|
url: url,
|
|
1844
1647
|
sao: sao,
|
|
@@ -1849,12 +1652,12 @@ View.returnGetInitialProps = function () {
|
|
|
1849
1652
|
sponsoredFlag: sponsoredFlag
|
|
1850
1653
|
});
|
|
1851
1654
|
|
|
1852
|
-
case
|
|
1655
|
+
case 21:
|
|
1853
1656
|
case 'end':
|
|
1854
1657
|
return _context.stop();
|
|
1855
1658
|
}
|
|
1856
1659
|
}
|
|
1857
|
-
}, _callee, _this$
|
|
1660
|
+
}, _callee, _this$1);
|
|
1858
1661
|
}));
|
|
1859
1662
|
|
|
1860
1663
|
return function (_x, _x2, _x3, _x4, _x5) {
|
package/dist/cjs/getQuery.js
CHANGED
|
@@ -10,9 +10,9 @@ var getQuery = function getQuery(type) {
|
|
|
10
10
|
|
|
11
11
|
switch (type) {
|
|
12
12
|
case 'related':
|
|
13
|
-
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 ...,\n passwordLock,\n password,\n "authorDetails": authorMapping[]->{ displayName, url, profileImage, biography },\n body[] {\n ...,\n upload_doc {\n _type,\n asset->\n },\n uploadAudio {\n _type,\n asset->\n }\n },\n \'content_placement\': taxonomyMapping[]-> {\n
|
|
13
|
+
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 ...,\n passwordLock,\n password,\n "authorDetails": authorMapping[]->{ displayName, url, profileImage, biography },\n body[] {\n ...,\n upload_doc {\n _type,\n asset->\n },\n uploadAudio {\n _type,\n asset->\n }\n },\n \'content_placement\': taxonomyMapping[]-> {\n \'ancestor\': parent->parent->identifier,\n \'parent\': parent->identifier,\n \'name\': name,\n \'path\': identifier,\n disableAds\n },\n documentGroup-> {\n name,\n thumbnail,\n parent->{...,parent->},\n \'path\': identifier.current\n },\n documentGroupMapping[]-> {\n name,\n thumbnail,\n parent->{...,parent->},\n \'path\': identifier.current\n },\n \'issue\' : *[_type == \'publication\' && !(_id in path("drafts.**")) && is_visible == true && _id == ^.issueGroup._ref][0] {\n name,\n \'path\': identifier.current,\n \'publication\' : *[_type == \'publication\' && !(_id in path("drafts.**")) && is_visible == true && _id == ^.parent._ref][0] {\n name,\n \'path\': identifier.current\n },\n \'url\' : pdf.asset-> url\n }\n }';
|
|
14
14
|
case 'article':
|
|
15
|
-
return '*[\n _type == "article"\n && !(_id in path("drafts.**"))\n && defined(title)\n && defined(url)\n && url.current == $url\n ' + conditions + '\n ][0]{\n ' + params + '\n title,\n published,\n summary,\n thumbnail,\n ...,\n passwordLock,\n password,\n "authorDetails": authorMapping[]->{ displayName, url, profileImage, biography },\n body[] {\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 },\n articles[]{\n ...,\n "authorDetails": authorMapping[]->{ displayName, url, profileImage, biography },\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 },\n documentGroup-> {\n name,\n thumbnail,\n parent->{...,parent->},\n \'path\': identifier.current\n },\n documentGroupMapping[]-> {\n
|
|
15
|
+
return '*[\n _type == "article"\n && !(_id in path("drafts.**"))\n && defined(title)\n && defined(url)\n && url.current == $url\n ' + conditions + '\n ][0]{\n ' + params + '\n title,\n published,\n summary,\n thumbnail,\n ...,\n passwordLock,\n password,\n "authorDetails": authorMapping[]->{ displayName, url, profileImage, biography },\n body[] {\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 },\n articles[]{\n ...,\n "authorDetails": authorMapping[]->{ displayName, url, profileImage, biography },\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 },\n documentGroup-> {\n name,\n thumbnail,\n parent->{...,parent->},\n \'path\': identifier.current\n },\n documentGroupMapping[]-> {\n name,\n thumbnail,\n parent->{...,parent->},\n \'path\': identifier.current\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 \'issueNumber\': number,\n \'articleSource\': source,\n \'path\': identifier.current,\n \'publication\' : *[_type == \'publication\' && !(_id in path("drafts.**")) && is_visible == true && _id == ^.parent._ref][0] {\n name,\n \'path\': identifier.current\n },\n \'url\' : pdf.asset-> url\n }\n\n }';
|
|
16
16
|
case 'publication':
|
|
17
17
|
return '*[_type == \'publication\'\n && identifier.current == $publication\n ' + conditions + '][0] {\n ' + params + '\n ...,\n \'issues\': *[_type == \'publication\'\n && is_visible\n && references(^._id)\n && defined(identifier)] {\n ...,\n pdf{asset->}\n } | order(year desc, month desc)\n }';
|
|
18
18
|
case 'issue':
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import './_commonjsHelpers-0c4b6f40.js';
|
|
2
|
-
import React__default from 'react';
|
|
3
|
-
import { b as lib_1 } from './index-0e45a0b2.js';
|
|
2
|
+
import React__default, { useEffect } from 'react';
|
|
3
|
+
import { b as lib_1, l as lib_3 } from './index-0e45a0b2.js';
|
|
4
4
|
import 'prop-types';
|
|
5
5
|
|
|
6
6
|
var AdSlotsProvider = function AdSlotsProvider(_ref) {
|
|
@@ -11,6 +11,24 @@ var AdSlotsProvider = function AdSlotsProvider(_ref) {
|
|
|
11
11
|
_ref$singleRequest = _ref.singleRequest,
|
|
12
12
|
singleRequest = _ref$singleRequest === undefined ? true : _ref$singleRequest;
|
|
13
13
|
|
|
14
|
+
useEffect(function () {
|
|
15
|
+
// Refresh ADs after every one minute of user not scrolled
|
|
16
|
+
var isScrolling = void 0;
|
|
17
|
+
var refreshADsAfterInterval = function refreshADsAfterInterval() {
|
|
18
|
+
isScrolling = setInterval(function () {
|
|
19
|
+
lib_3.refresh();
|
|
20
|
+
}, 30000);
|
|
21
|
+
};
|
|
22
|
+
refreshADsAfterInterval();
|
|
23
|
+
window.addEventListener('scroll', function () {
|
|
24
|
+
clearInterval(isScrolling);
|
|
25
|
+
refreshADsAfterInterval();
|
|
26
|
+
}, false);
|
|
27
|
+
return function () {
|
|
28
|
+
clearInterval(isScrolling);
|
|
29
|
+
};
|
|
30
|
+
}, []);
|
|
31
|
+
|
|
14
32
|
return React__default.createElement(
|
|
15
33
|
lib_1,
|
|
16
34
|
{
|
package/dist/esm/View.js
CHANGED
|
@@ -247,7 +247,7 @@ var ISI = function ISI(props) {
|
|
|
247
247
|
);
|
|
248
248
|
};
|
|
249
249
|
|
|
250
|
-
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 padding-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-
|
|
250
|
+
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 padding-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 }\r\n .RelatedArticles-module_imgWrapper__5Jx_4 img {\r\n width: 100%;\r\n height: auto;\r\n\r\n max-height: 175px;\r\n object-fit: contain;\r\n margin-bottom: 1rem;\r\n }\r\n}\r\n";
|
|
251
251
|
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" };
|
|
252
252
|
styleInject(css);
|
|
253
253
|
|
|
@@ -343,7 +343,6 @@ var Article = function Article(props) {
|
|
|
343
343
|
};
|
|
344
344
|
}();
|
|
345
345
|
|
|
346
|
-
console.log(props);
|
|
347
346
|
var article = props.article,
|
|
348
347
|
Ads = props.Ads,
|
|
349
348
|
showRelatedArticles = props.showRelatedArticles,
|
|
@@ -484,47 +483,61 @@ var Article = function Article(props) {
|
|
|
484
483
|
};
|
|
485
484
|
|
|
486
485
|
var RelevantTopics = function RelevantTopics() {
|
|
487
|
-
if (content_placement && content_placement.length > 0 || documentGroupMapping
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
486
|
+
if (content_placement && content_placement.length > 0 || documentGroupMapping) {
|
|
487
|
+
return React__default.createElement(
|
|
488
|
+
'div',
|
|
489
|
+
{ style: { color: '#262626' } },
|
|
490
|
+
React__default.createElement(
|
|
491
|
+
'p',
|
|
492
|
+
{ className: 'mb-0' },
|
|
493
|
+
React__default.createElement(
|
|
494
|
+
'b',
|
|
495
|
+
null,
|
|
496
|
+
'Related Content:'
|
|
497
|
+
)
|
|
498
|
+
),
|
|
499
|
+
documentGroupMapping && documentGroupMapping.map(function (documentGroup) {
|
|
500
|
+
if (!documentGroup.parent) {
|
|
501
|
+
return null;
|
|
493
502
|
}
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
503
|
+
|
|
504
|
+
return React__default.createElement(
|
|
505
|
+
React__default.Fragment,
|
|
506
|
+
null,
|
|
507
|
+
React__default.createElement(
|
|
508
|
+
'span',
|
|
509
|
+
{ className: '' },
|
|
510
|
+
React__default.createElement(
|
|
511
|
+
'a',
|
|
512
|
+
{
|
|
513
|
+
className: 'related-links',
|
|
514
|
+
style: { color: 'blue' },
|
|
515
|
+
href: cpModificationRequired ? '/' + documentGroup.parent.identifier.current + '/' + documentGroup.path : '/' + documentGroup.path },
|
|
516
|
+
documentGroup.name
|
|
517
|
+
)
|
|
518
|
+
),
|
|
519
|
+
content_placement && content_placement.length ? ' | ' : null
|
|
520
|
+
);
|
|
521
|
+
}),
|
|
522
|
+
content_placement && content_placement.length > 0 ? content_placement.map(function (cp, index) {
|
|
500
523
|
var cp_url = cpModificationRequired ? getContentPlacementUrl(cp) : cp.path;
|
|
501
524
|
var href = '/' + cp_url;
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
return React__default.createElement(
|
|
507
|
-
'div',
|
|
508
|
-
null,
|
|
509
|
-
relatedLinks.map(function (relatedLink, index) {
|
|
510
|
-
return React__default.createElement(
|
|
525
|
+
return React__default.createElement(
|
|
526
|
+
React__default.Fragment,
|
|
527
|
+
{ key: index },
|
|
528
|
+
React__default.createElement(
|
|
511
529
|
'span',
|
|
512
|
-
|
|
530
|
+
null,
|
|
513
531
|
React__default.createElement(
|
|
514
532
|
'a',
|
|
515
|
-
{ className: 'related-links', style: { color: 'blue' }
|
|
516
|
-
|
|
517
|
-
),
|
|
518
|
-
React__default.createElement(
|
|
519
|
-
'style',
|
|
520
|
-
{ jsx: 'true' },
|
|
521
|
-
'\n .related-link:not(:first-child):before {\n content: \' | \';\n }\n '
|
|
533
|
+
{ className: 'related-links', key: index, href: href, style: { color: 'blue' } },
|
|
534
|
+
cp.name
|
|
522
535
|
)
|
|
523
|
-
)
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
536
|
+
),
|
|
537
|
+
content_placement.length > index + 1 ? ' | ' : null
|
|
538
|
+
);
|
|
539
|
+
}) : null
|
|
540
|
+
);
|
|
528
541
|
}
|
|
529
542
|
return null;
|
|
530
543
|
};
|
|
@@ -988,22 +1001,17 @@ var Article = function Article(props) {
|
|
|
988
1001
|
),
|
|
989
1002
|
React__default.createElement('div', { className: 'clearfix', style: { minHeight: '1px' } }),
|
|
990
1003
|
showRelatedArticles && !showIsi && React__default.createElement(
|
|
991
|
-
|
|
1004
|
+
React__default.Fragment,
|
|
992
1005
|
null,
|
|
993
1006
|
React__default.createElement(
|
|
994
|
-
'
|
|
995
|
-
|
|
996
|
-
React__default.createElement(
|
|
997
|
-
'b',
|
|
998
|
-
null,
|
|
999
|
-
'Related Content:'
|
|
1000
|
-
)
|
|
1007
|
+
'div',
|
|
1008
|
+
null,
|
|
1009
|
+
React__default.createElement(RelevantTopics, null)
|
|
1001
1010
|
),
|
|
1002
|
-
React__default.createElement(RelevantTopics, null),
|
|
1003
1011
|
React__default.createElement(
|
|
1004
1012
|
'div',
|
|
1005
1013
|
{ className: 'pt-2' },
|
|
1006
|
-
React__default.createElement(RelatedArticle, { articles: article.
|
|
1014
|
+
React__default.createElement(RelatedArticle, { articles: article.relatedArticle, client: client })
|
|
1007
1015
|
)
|
|
1008
1016
|
)
|
|
1009
1017
|
),
|
|
@@ -1058,201 +1066,6 @@ var Article = function Article(props) {
|
|
|
1058
1066
|
|
|
1059
1067
|
var _this = undefined;
|
|
1060
1068
|
|
|
1061
|
-
var getRelatedContentArticles = function () {
|
|
1062
|
-
var _ref = _asyncToGenerator( /*#__PURE__*/regenerator.mark(function _callee() {
|
|
1063
|
-
var client = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
|
|
1064
|
-
var article = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
1065
|
-
var prevUrl = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : '/';
|
|
1066
|
-
var articleCount = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 0;
|
|
1067
|
-
|
|
1068
|
-
var _article$url, url, content_placement, documentGroupMapping, issueGroup, references, params, articles, relatedContentQuery;
|
|
1069
|
-
|
|
1070
|
-
return regenerator.wrap(function _callee$(_context) {
|
|
1071
|
-
while (1) {
|
|
1072
|
-
switch (_context.prev = _context.next) {
|
|
1073
|
-
case 0:
|
|
1074
|
-
_article$url = article.url;
|
|
1075
|
-
_article$url = _article$url === undefined ? {
|
|
1076
|
-
current: null
|
|
1077
|
-
} : _article$url;
|
|
1078
|
-
url = _article$url.current, content_placement = article.content_placement, documentGroupMapping = article.documentGroupMapping, issueGroup = article.issueGroup;
|
|
1079
|
-
references = [];
|
|
1080
|
-
|
|
1081
|
-
if (content_placement && content_placement.length > 0) {
|
|
1082
|
-
content_placement.forEach(function (_ref2) {
|
|
1083
|
-
var path = _ref2.path,
|
|
1084
|
-
_id = _ref2._id;
|
|
1085
|
-
|
|
1086
|
-
if (!_id || typeof _id == 'undefined') {
|
|
1087
|
-
return null;
|
|
1088
|
-
}
|
|
1089
|
-
var prev_url_to_check = prevUrl;
|
|
1090
|
-
if (prev_url_to_check.includes('?')) {
|
|
1091
|
-
prev_url_to_check = prev_url_to_check.split('?')[0];
|
|
1092
|
-
}
|
|
1093
|
-
if (prev_url_to_check.endsWith(path) && _id) references.push(_id);
|
|
1094
|
-
});
|
|
1095
|
-
if (references.length === 0) {
|
|
1096
|
-
content_placement.filter(function (_ref3) {
|
|
1097
|
-
var identifier = _ref3.identifier;
|
|
1098
|
-
return identifier !== 'news';
|
|
1099
|
-
}).forEach(function (_ref4) {
|
|
1100
|
-
var _id = _ref4._id;
|
|
1101
|
-
|
|
1102
|
-
if (_id) references.push(_id);
|
|
1103
|
-
});
|
|
1104
|
-
}
|
|
1105
|
-
}
|
|
1106
|
-
|
|
1107
|
-
if (documentGroupMapping && documentGroupMapping.length > 0) {
|
|
1108
|
-
documentGroupMapping.forEach(function (_ref5) {
|
|
1109
|
-
var _id = _ref5._id;
|
|
1110
|
-
|
|
1111
|
-
if (_id) references.push(_id);
|
|
1112
|
-
});
|
|
1113
|
-
}
|
|
1114
|
-
|
|
1115
|
-
if (issueGroup && issueGroup._ref) {
|
|
1116
|
-
references.push(issueGroup._ref);
|
|
1117
|
-
}
|
|
1118
|
-
|
|
1119
|
-
params = { url: url, references: references };
|
|
1120
|
-
articles = [];
|
|
1121
|
-
|
|
1122
|
-
if (!(params.references && params.references.length > 0)) {
|
|
1123
|
-
_context.next = 20;
|
|
1124
|
-
break;
|
|
1125
|
-
}
|
|
1126
|
-
|
|
1127
|
-
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 && contentCategory.disableAds != \'true\'\n && ExcludeFromInfiniteScroll != true\n && url.current != $url\n && !defined(body[].videos)\n && dateTime(published) <= dateTime(now())\n && references($references)\n ]| order(published desc)[' + articleCount + ']\n {\n title,\n url,\n thumbnail\n }';
|
|
1128
|
-
_context.prev = 11;
|
|
1129
|
-
_context.next = 14;
|
|
1130
|
-
return client.fetch(relatedContentQuery, params);
|
|
1131
|
-
|
|
1132
|
-
case 14:
|
|
1133
|
-
articles = _context.sent;
|
|
1134
|
-
_context.next = 20;
|
|
1135
|
-
break;
|
|
1136
|
-
|
|
1137
|
-
case 17:
|
|
1138
|
-
_context.prev = 17;
|
|
1139
|
-
_context.t0 = _context['catch'](11);
|
|
1140
|
-
|
|
1141
|
-
console.error(_context.t0);
|
|
1142
|
-
|
|
1143
|
-
case 20:
|
|
1144
|
-
return _context.abrupt('return', articles);
|
|
1145
|
-
|
|
1146
|
-
case 21:
|
|
1147
|
-
case 'end':
|
|
1148
|
-
return _context.stop();
|
|
1149
|
-
}
|
|
1150
|
-
}
|
|
1151
|
-
}, _callee, _this, [[11, 17]]);
|
|
1152
|
-
}));
|
|
1153
|
-
|
|
1154
|
-
return function getRelatedContentArticles() {
|
|
1155
|
-
return _ref.apply(this, arguments);
|
|
1156
|
-
};
|
|
1157
|
-
}();
|
|
1158
|
-
|
|
1159
|
-
// const getRelatedContents = async (ctx = null, client = null, article = {}, prevUrl = '/', articleCount = 0) => {
|
|
1160
|
-
// const {
|
|
1161
|
-
// url: { current: url } = {
|
|
1162
|
-
// current: null
|
|
1163
|
-
// },
|
|
1164
|
-
// content_placement,
|
|
1165
|
-
// documentGroupMapping,
|
|
1166
|
-
// issueGroup
|
|
1167
|
-
// } = article
|
|
1168
|
-
// let params = { url }
|
|
1169
|
-
// let conditions = ''
|
|
1170
|
-
|
|
1171
|
-
// if (content_placement && content_placement.length > 0) {
|
|
1172
|
-
// let taxonomy = []
|
|
1173
|
-
// content_placement.forEach(({ path, _id }) => {
|
|
1174
|
-
// if (!_id || typeof _id == 'undefined') {
|
|
1175
|
-
// return null
|
|
1176
|
-
// }
|
|
1177
|
-
// let prev_url_to_check = prevUrl
|
|
1178
|
-
// if (prev_url_to_check.includes('?')) {
|
|
1179
|
-
// prev_url_to_check = prev_url_to_check.split('?')[0]
|
|
1180
|
-
// }
|
|
1181
|
-
// if (prev_url_to_check.endsWith(path) && _id) taxonomy.push(_id)
|
|
1182
|
-
// })
|
|
1183
|
-
// if (taxonomy.length === 0) {
|
|
1184
|
-
// content_placement
|
|
1185
|
-
// .filter(({ identifier }) => identifier !== 'news')
|
|
1186
|
-
// .forEach(({ _id }) => {
|
|
1187
|
-
// if (_id) taxonomy.push(_id)
|
|
1188
|
-
// })
|
|
1189
|
-
// }
|
|
1190
|
-
// if (taxonomy.length > 0) {
|
|
1191
|
-
// params = { ...params, taxonomy }
|
|
1192
|
-
// conditions = `&& taxonomyMapping[]._ref in $taxonomy`
|
|
1193
|
-
// }
|
|
1194
|
-
// }
|
|
1195
|
-
|
|
1196
|
-
// if (documentGroupMapping && documentGroupMapping.length > 0) {
|
|
1197
|
-
// let documentGroup = []
|
|
1198
|
-
// documentGroupMapping.forEach(({ _id }) => {
|
|
1199
|
-
// if (_id) documentGroup.push(_id)
|
|
1200
|
-
// })
|
|
1201
|
-
// if (params.taxonomy && documentGroup.length > 0) {
|
|
1202
|
-
// params = { ...params, documentGroup }
|
|
1203
|
-
// conditions = `&& (taxonomyMapping[]._ref in $taxonomy || documentGroupMapping[]._ref in $documentGroup)`
|
|
1204
|
-
// }
|
|
1205
|
-
// }
|
|
1206
|
-
|
|
1207
|
-
// if (issueGroup && issueGroup._ref) {
|
|
1208
|
-
// if (params.taxonomy && params.documentGroup) {
|
|
1209
|
-
// params = { ...params, issueAssociation: issueGroup._ref }
|
|
1210
|
-
// conditions = `&& (taxonomyMapping[]._ref in $taxonomy || documentGroupMapping[]._ref in $documentGroup || issueGroup._ref == $issueAssociation )`
|
|
1211
|
-
// } else if (params.taxonomy) {
|
|
1212
|
-
// params = { ...params, issueAssociation: issueGroup._ref }
|
|
1213
|
-
// conditions = `&& (taxonomyMapping[]._ref in $taxonomy || issueGroup._ref == $issueAssociation )`
|
|
1214
|
-
// }
|
|
1215
|
-
// }
|
|
1216
|
-
|
|
1217
|
-
// let articles = []
|
|
1218
|
-
// if (params.taxonomy && params.taxonomy.length > 0) {
|
|
1219
|
-
// const relatedContentQuery = `*[
|
|
1220
|
-
// _type == "article"
|
|
1221
|
-
// && defined(title)
|
|
1222
|
-
// && defined(url)
|
|
1223
|
-
// && !(_id in path("drafts.**"))
|
|
1224
|
-
// && is_visible == true
|
|
1225
|
-
// && passwordLock != true
|
|
1226
|
-
// && taxonomyMapping[].disableAds != 'true'
|
|
1227
|
-
// && contentCategory.name != 'Poll'
|
|
1228
|
-
// && contentCategory.name != 'Slideshows'
|
|
1229
|
-
// && contentCategory.disableAds != 'true'
|
|
1230
|
-
// && ExcludeFromInfiniteScroll != true
|
|
1231
|
-
// && url.current != $url
|
|
1232
|
-
// && !defined(body[].videos)
|
|
1233
|
-
// && published <= '${new Date().toISOString()}'
|
|
1234
|
-
// ${conditions}
|
|
1235
|
-
// ]| order(published desc)[${articleCount}]
|
|
1236
|
-
// {
|
|
1237
|
-
// title,
|
|
1238
|
-
// url,
|
|
1239
|
-
// thumbnail
|
|
1240
|
-
// }`
|
|
1241
|
-
|
|
1242
|
-
// try {
|
|
1243
|
-
// articles = await client.fetch(relatedContentQuery, params)
|
|
1244
|
-
// } catch (error) {
|
|
1245
|
-
// console.error(error)
|
|
1246
|
-
// }
|
|
1247
|
-
// }
|
|
1248
|
-
|
|
1249
|
-
// return articles
|
|
1250
|
-
// }
|
|
1251
|
-
|
|
1252
|
-
// export default getRelatedContents
|
|
1253
|
-
|
|
1254
|
-
var _this$1 = undefined;
|
|
1255
|
-
|
|
1256
1069
|
var ArticleQueue = function ArticleQueue(props) {
|
|
1257
1070
|
var _props$prevUrl = props.prevUrl,
|
|
1258
1071
|
prevUrl = _props$prevUrl === undefined ? '/' : _props$prevUrl,
|
|
@@ -1378,7 +1191,7 @@ var ArticleQueue = function ArticleQueue(props) {
|
|
|
1378
1191
|
switch (_context.prev = _context.next) {
|
|
1379
1192
|
case 0:
|
|
1380
1193
|
if (!(article && article._id)) {
|
|
1381
|
-
_context.next =
|
|
1194
|
+
_context.next = 9;
|
|
1382
1195
|
break;
|
|
1383
1196
|
}
|
|
1384
1197
|
|
|
@@ -1390,22 +1203,17 @@ var ArticleQueue = function ArticleQueue(props) {
|
|
|
1390
1203
|
|
|
1391
1204
|
case 5:
|
|
1392
1205
|
article.relatedArticle = _context.sent;
|
|
1393
|
-
_context.next = 8;
|
|
1394
|
-
return getRelatedContentArticles(null, props.client, article, prevUrl, startingIndex + '..' + endingIndex);
|
|
1395
|
-
|
|
1396
|
-
case 8:
|
|
1397
|
-
article.relatedContentArticles = _context.sent;
|
|
1398
1206
|
targeting = getTargeting({ article: article, cpModificationRequired: cpModificationRequired, prevUrl: prevUrl });
|
|
1399
1207
|
|
|
1400
1208
|
article.Ads = Ads.getRightItems(targeting);
|
|
1401
1209
|
setQueueData([].concat(_toConsumableArray(queueData), [article]));
|
|
1402
1210
|
|
|
1403
|
-
case
|
|
1211
|
+
case 9:
|
|
1404
1212
|
case 'end':
|
|
1405
1213
|
return _context.stop();
|
|
1406
1214
|
}
|
|
1407
1215
|
}
|
|
1408
|
-
}, _callee, _this
|
|
1216
|
+
}, _callee, _this);
|
|
1409
1217
|
}));
|
|
1410
1218
|
|
|
1411
1219
|
return function (_x) {
|
|
@@ -1553,7 +1361,7 @@ var Articles = function Articles(props) {
|
|
|
1553
1361
|
}, _defineProperty(_extends2, 'pageview', pageview), _defineProperty(_extends2, 'onVote', function onVote() {}), _defineProperty(_extends2, 'ISIContent', ISIContent), _defineProperty(_extends2, 'videoAccountIDs', videoAccountIDs), _defineProperty(_extends2, 'sponsoredTaxonomies', []), _defineProperty(_extends2, 'cpModificationRequired', cpModificationRequired), _defineProperty(_extends2, 'Settings', Settings), _defineProperty(_extends2, 'canonicalTag', canonicalTag), _extends2), props));
|
|
1554
1362
|
};
|
|
1555
1363
|
|
|
1556
|
-
var _this$
|
|
1364
|
+
var _this$1 = undefined;
|
|
1557
1365
|
|
|
1558
1366
|
var View = function View(props) {
|
|
1559
1367
|
var router = useRouter();
|
|
@@ -1812,12 +1620,12 @@ View.returnGetInitialProps = function () {
|
|
|
1812
1620
|
}
|
|
1813
1621
|
|
|
1814
1622
|
article.relatedArticle = null;
|
|
1815
|
-
_context.next =
|
|
1623
|
+
_context.next = 20;
|
|
1816
1624
|
break;
|
|
1817
1625
|
|
|
1818
1626
|
case 16:
|
|
1819
1627
|
if (!article) {
|
|
1820
|
-
_context.next =
|
|
1628
|
+
_context.next = 20;
|
|
1821
1629
|
break;
|
|
1822
1630
|
}
|
|
1823
1631
|
|
|
@@ -1826,13 +1634,8 @@ View.returnGetInitialProps = function () {
|
|
|
1826
1634
|
|
|
1827
1635
|
case 19:
|
|
1828
1636
|
article.relatedArticle = _context.sent;
|
|
1829
|
-
_context.next = 22;
|
|
1830
|
-
return getRelatedContentArticles(context, client, article, prevUrl, '0..2');
|
|
1831
|
-
|
|
1832
|
-
case 22:
|
|
1833
|
-
article.relatedContentArticles = _context.sent;
|
|
1834
1637
|
|
|
1835
|
-
case
|
|
1638
|
+
case 20:
|
|
1836
1639
|
return _context.abrupt('return', {
|
|
1837
1640
|
url: url,
|
|
1838
1641
|
sao: sao,
|
|
@@ -1843,12 +1646,12 @@ View.returnGetInitialProps = function () {
|
|
|
1843
1646
|
sponsoredFlag: sponsoredFlag
|
|
1844
1647
|
});
|
|
1845
1648
|
|
|
1846
|
-
case
|
|
1649
|
+
case 21:
|
|
1847
1650
|
case 'end':
|
|
1848
1651
|
return _context.stop();
|
|
1849
1652
|
}
|
|
1850
1653
|
}
|
|
1851
|
-
}, _callee, _this$
|
|
1654
|
+
}, _callee, _this$1);
|
|
1852
1655
|
}));
|
|
1853
1656
|
|
|
1854
1657
|
return function (_x, _x2, _x3, _x4, _x5) {
|
package/dist/esm/getQuery.js
CHANGED
|
@@ -8,9 +8,9 @@ var getQuery = function getQuery(type) {
|
|
|
8
8
|
|
|
9
9
|
switch (type) {
|
|
10
10
|
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 ...,\n passwordLock,\n password,\n "authorDetails": authorMapping[]->{ displayName, url, profileImage, biography },\n body[] {\n ...,\n upload_doc {\n _type,\n asset->\n },\n uploadAudio {\n _type,\n asset->\n }\n },\n \'content_placement\': taxonomyMapping[]-> {\n
|
|
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 ...,\n passwordLock,\n password,\n "authorDetails": authorMapping[]->{ displayName, url, profileImage, biography },\n body[] {\n ...,\n upload_doc {\n _type,\n asset->\n },\n uploadAudio {\n _type,\n asset->\n }\n },\n \'content_placement\': taxonomyMapping[]-> {\n \'ancestor\': parent->parent->identifier,\n \'parent\': parent->identifier,\n \'name\': name,\n \'path\': identifier,\n disableAds\n },\n documentGroup-> {\n name,\n thumbnail,\n parent->{...,parent->},\n \'path\': identifier.current\n },\n documentGroupMapping[]-> {\n name,\n thumbnail,\n parent->{...,parent->},\n \'path\': identifier.current\n },\n \'issue\' : *[_type == \'publication\' && !(_id in path("drafts.**")) && is_visible == true && _id == ^.issueGroup._ref][0] {\n name,\n \'path\': identifier.current,\n \'publication\' : *[_type == \'publication\' && !(_id in path("drafts.**")) && is_visible == true && _id == ^.parent._ref][0] {\n name,\n \'path\': identifier.current\n },\n \'url\' : pdf.asset-> url\n }\n }';
|
|
12
12
|
case 'article':
|
|
13
|
-
return '*[\n _type == "article"\n && !(_id in path("drafts.**"))\n && defined(title)\n && defined(url)\n && url.current == $url\n ' + conditions + '\n ][0]{\n ' + params + '\n title,\n published,\n summary,\n thumbnail,\n ...,\n passwordLock,\n password,\n "authorDetails": authorMapping[]->{ displayName, url, profileImage, biography },\n body[] {\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 },\n articles[]{\n ...,\n "authorDetails": authorMapping[]->{ displayName, url, profileImage, biography },\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 },\n documentGroup-> {\n name,\n thumbnail,\n parent->{...,parent->},\n \'path\': identifier.current\n },\n documentGroupMapping[]-> {\n
|
|
13
|
+
return '*[\n _type == "article"\n && !(_id in path("drafts.**"))\n && defined(title)\n && defined(url)\n && url.current == $url\n ' + conditions + '\n ][0]{\n ' + params + '\n title,\n published,\n summary,\n thumbnail,\n ...,\n passwordLock,\n password,\n "authorDetails": authorMapping[]->{ displayName, url, profileImage, biography },\n body[] {\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 },\n articles[]{\n ...,\n "authorDetails": authorMapping[]->{ displayName, url, profileImage, biography },\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 },\n documentGroup-> {\n name,\n thumbnail,\n parent->{...,parent->},\n \'path\': identifier.current\n },\n documentGroupMapping[]-> {\n name,\n thumbnail,\n parent->{...,parent->},\n \'path\': identifier.current\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 \'issueNumber\': number,\n \'articleSource\': source,\n \'path\': identifier.current,\n \'publication\' : *[_type == \'publication\' && !(_id in path("drafts.**")) && is_visible == true && _id == ^.parent._ref][0] {\n name,\n \'path\': identifier.current\n },\n \'url\' : pdf.asset-> url\n }\n\n }';
|
|
14
14
|
case 'publication':
|
|
15
15
|
return '*[_type == \'publication\'\n && identifier.current == $publication\n ' + conditions + '][0] {\n ' + params + '\n ...,\n \'issues\': *[_type == \'publication\'\n && is_visible\n && references(^._id)\n && defined(identifier)] {\n ...,\n pdf{asset->}\n } | order(year desc, month desc)\n }';
|
|
16
16
|
case 'issue':
|