@mjhls/mjh-framework 1.0.901-media-series-itemsperpage-v2 → 1.0.901-ris-export-v1

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.
@@ -315,11 +315,7 @@ var CMEDeck = function CMEDeck(_ref) {
315
315
  return React__default['default'].createElement(
316
316
  'div',
317
317
  { className: 'd-flex justify-content-between' },
318
- currentPage && currentPage > 1 && React__default['default'].createElement(
319
- 'a',
320
- { href: '?page=' + (currentPage - 1) },
321
- '<< Previous'
322
- ),
318
+ currentPage > 1 ,
323
319
  React__default['default'].createElement(
324
320
  'a',
325
321
  { href: '?page=' + (currentPage + 1) },
@@ -398,7 +398,7 @@ var MediaSeriesLanding = function MediaSeriesLanding(props) {
398
398
  };
399
399
 
400
400
  MediaSeriesLanding.getInitialData = function () {
401
- var _ref5 = asyncToGenerator._asyncToGenerator( /*#__PURE__*/asyncToGenerator.regenerator.mark(function _callee2(ctx, client, cache, parameters) {
401
+ var _ref5 = asyncToGenerator._asyncToGenerator( /*#__PURE__*/asyncToGenerator.regenerator.mark(function _callee2(ctx, client, cache) {
402
402
  var urlQuery, pathname, identifier, itemsPerPage, currentPage, start, statusCode, params, docGroupID, seriesQueryFilters, seriesQuerySorts, seriesQueryProjection, seriesQuery, totalSeriesCountQuery, _ref6, _ref7, seriesData, totalSeriesCount, allSeries, buildUsedTopicsArray, usedTopics, taxonomyFilter;
403
403
 
404
404
  return asyncToGenerator.regenerator.wrap(function _callee2$(_context2) {
@@ -407,7 +407,7 @@ MediaSeriesLanding.getInitialData = function () {
407
407
  case 0:
408
408
  urlQuery = ctx.query, pathname = ctx.pathname;
409
409
  identifier = pathname.replace('/', '');
410
- itemsPerPage = parameters && parameters.itemsPerPage ? parameters.itemsPerPage : 30;
410
+ itemsPerPage = 30;
411
411
  currentPage = urlQuery.page ? parseInt(urlQuery.page) : 1;
412
412
  start = (currentPage - 1) * itemsPerPage;
413
413
  statusCode = 200;
@@ -516,7 +516,7 @@ MediaSeriesLanding.getInitialData = function () {
516
516
  }, _callee2, _this);
517
517
  }));
518
518
 
519
- return function (_x, _x2, _x3, _x4) {
519
+ return function (_x, _x2, _x3) {
520
520
  return _ref5.apply(this, arguments);
521
521
  };
522
522
  }();
package/dist/cjs/View.js CHANGED
@@ -29,13 +29,13 @@ var styleInject_es = require('./style-inject.es-dcee06b6.js');
29
29
  require('./index-eadd5035.js');
30
30
  var disqusReact = require('disqus-react');
31
31
  var Schema = require('./Schema.js');
32
+ var _commonjsHelpers = require('./_commonjsHelpers-06173234.js');
32
33
  var keys = require('./keys-e982b3fa.js');
33
34
  var index_es = require('./index.es-f3e47207.js');
34
35
  var index = require('./index-fc2f1ca2.js');
35
36
  var getRelatedArticle = require('./getRelatedArticle.js');
36
37
  var getQuery = require('./getQuery.js');
37
38
  var getSeriesDetail = require('./getSeriesDetail.js');
38
- require('./_commonjsHelpers-06173234.js');
39
39
  require('./core.get-iterator-method-5643aa10.js');
40
40
  require('./web.dom.iterable-d98303e0.js');
41
41
  require('./_library-dd23b178.js');
@@ -446,6 +446,12 @@ var getSocialShareDisableFlag = function getSocialShareDisableFlag(article) {
446
446
  return showSocialShare;
447
447
  };
448
448
 
449
+ var FileSaver_min = _commonjsHelpers.createCommonjsModule(function (module, exports) {
450
+ (function(a,b){b();})(_commonjsHelpers.commonjsGlobal,function(){function b(a,b){return "undefined"==typeof b?b={autoBom:!1}:"object"!=typeof b&&(console.warn("Deprecated: Expected third argument to be a object"),b={autoBom:!b}),b.autoBom&&/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(a.type)?new Blob(["\uFEFF",a],{type:a.type}):a}function c(a,b,c){var d=new XMLHttpRequest;d.open("GET",a),d.responseType="blob",d.onload=function(){g(d.response,b,c);},d.onerror=function(){console.error("could not download file");},d.send();}function d(a){var b=new XMLHttpRequest;b.open("HEAD",a,!1);try{b.send();}catch(a){}return 200<=b.status&&299>=b.status}function e(a){try{a.dispatchEvent(new MouseEvent("click"));}catch(c){var b=document.createEvent("MouseEvents");b.initMouseEvent("click",!0,!0,window,0,0,0,80,20,!1,!1,!1,!1,0,null),a.dispatchEvent(b);}}var f="object"==typeof window&&window.window===window?window:"object"==typeof self&&self.self===self?self:"object"==typeof _commonjsHelpers.commonjsGlobal&&_commonjsHelpers.commonjsGlobal.global===_commonjsHelpers.commonjsGlobal?_commonjsHelpers.commonjsGlobal:void 0,a=f.navigator&&/Macintosh/.test(navigator.userAgent)&&/AppleWebKit/.test(navigator.userAgent)&&!/Safari/.test(navigator.userAgent),g=f.saveAs||("object"!=typeof window||window!==f?function(){}:"download"in HTMLAnchorElement.prototype&&!a?function(b,g,h){var i=f.URL||f.webkitURL,j=document.createElement("a");g=g||b.name||"download",j.download=g,j.rel="noopener","string"==typeof b?(j.href=b,j.origin===location.origin?e(j):d(j.href)?c(b,g,h):e(j,j.target="_blank")):(j.href=i.createObjectURL(b),setTimeout(function(){i.revokeObjectURL(j.href);},4E4),setTimeout(function(){e(j);},0));}:"msSaveOrOpenBlob"in navigator?function(f,g,h){if(g=g||f.name||"download","string"!=typeof f)navigator.msSaveOrOpenBlob(b(f,h),g);else if(d(f))c(f,g,h);else {var i=document.createElement("a");i.href=f,i.target="_blank",setTimeout(function(){e(i);});}}:function(b,d,e,g){if(g=g||open("","_blank"),g&&(g.document.title=g.document.body.innerText="downloading..."),"string"==typeof b)return c(b,d,e);var h="application/octet-stream"===b.type,i=/constructor/i.test(f.HTMLElement)||f.safari,j=/CriOS\/[\d]+/.test(navigator.userAgent);if((j||h&&i||a)&&"undefined"!=typeof FileReader){var k=new FileReader;k.onloadend=function(){var a=k.result;a=j?a:a.replace(/^data:[^;]*;/,"data:attachment/file;"),g?g.location.href=a:location=a,g=null;},k.readAsDataURL(b);}else {var l=f.URL||f.webkitURL,m=l.createObjectURL(b);g?g.location=m:location.href=m,g=null,setTimeout(function(){l.revokeObjectURL(m);},4E4);}});f.saveAs=g.saveAs=g,(module.exports=g);});
451
+
452
+
453
+ });
454
+
449
455
  var Article = React.forwardRef(function (props, ref) {
450
456
  var onVote = function () {
451
457
  var _ref = asyncToGenerator._asyncToGenerator( /*#__PURE__*/asyncToGenerator.regenerator.mark(function _callee(nodeKey, selectedChoice) {
@@ -557,7 +563,9 @@ var Article = React.forwardRef(function (props, ref) {
557
563
  _props$refreshFlag = props.refreshFlag,
558
564
  refreshFlag = _props$refreshFlag === undefined ? false : _props$refreshFlag,
559
565
  disqusConfig = props.disqusConfig,
560
- showDisqus = props.showDisqus;
566
+ showDisqus = props.showDisqus,
567
+ _props$downloadCitati = props.downloadCitation,
568
+ downloadCitation = _props$downloadCitati === undefined ? false : _props$downloadCitati;
561
569
 
562
570
  var targeting = getTargeting.getTargeting(props);
563
571
 
@@ -652,6 +660,48 @@ var Article = React.forwardRef(function (props, ref) {
652
660
  }
653
661
  return null;
654
662
  };
663
+ var generateRIS = function generateRIS() {
664
+ var fileContent = 'TY - JOUR\n';
665
+ if (issue) {
666
+ if (article.title) {
667
+ fileContent += 'TI - ' + article.title + '\n'; //Title - TI
668
+ fileContent += 'T1 - ' + article.title + '\n'; //Title - T1
669
+ }
670
+ if (issue.publication && issue.publication.name) {
671
+ fileContent += 'T2 - ' + issue.publication.name + '\n'; //Secondary Title - T2
672
+ fileContent += 'JF - ' + issue.publication.name + '\n'; //Journal Name - JF
673
+ fileContent += 'JO - ' + issue.publication.name + '\n'; //Journal Name - JO
674
+ }
675
+ if (article.summary) fileContent += 'N2 - ' + article.summary + '\n'; //Abstract - N2
676
+ if (issue.issueNumber) fileContent += 'IS - ' + issue.issueNumber + '\n'; //Issue Number - IS
677
+ fileContent += 'PB - MJH Life Sciences\n'; //Publisher - PB
678
+ if (issue.year) fileContent += 'PY - ' + issue.year + '\n'; //Published Year - PY
679
+ if (issue.volume) fileContent += 'VL - ' + issue.volume + '\n'; //Volume - VL
680
+ if (issue.url) fileContent += 'L1 - ' + issue.url + '\n'; //Link to PDF - L1
681
+ if (shareOptions && shareOptions.shareBaseUrl) {
682
+ fileContent += 'L2 - ' + (shareOptions.shareBaseUrl + url) + '\n'; //Link to Full-text - L2
683
+ fileContent += 'UR - ' + (shareOptions.shareBaseUrl + url) + '\n'; //Doc URL - UR
684
+ }
685
+ if (props.Website) fileContent += 'LK - https://' + props.Website.liveDomain + '\n'; //Website Link - LK
686
+ if (pageNumber) {
687
+ if (pageNumber.includes('-')) {
688
+ fileContent += 'SP - ' + pageNumber.split('-')[0] + '\n'; //Start Page - SP
689
+ fileContent += 'EP - ' + pageNumber.split('-')[1] + '\n'; //End Page - EP
690
+ } else {
691
+ fileContent += 'SP - ' + pageNumber + '\n';
692
+ }
693
+ }
694
+ if (article.published) fileContent += 'Y1 - ' + moment.moment(published).format('DD-MMMM-YYYY') + '\n'; //Primary Date - Y1
695
+ fileContent += 'Y2 - ' + moment.moment().format('DD-MMMM-YYYY') + '\n'; //Access Date - Y2
696
+ }
697
+ fileContent += 'ER -\n'; //End of Record
698
+ return fileContent;
699
+ };
700
+ var downloadRIS = function downloadRIS() {
701
+ var fileContent = generateRIS();
702
+ var file = new File([fileContent], 'citation-' + url + '.ris', { type: 'application/x-research-info-systems;charset=utf-8' });
703
+ FileSaver_min.saveAs(file, 'citation-' + url + '.ris');
704
+ };
655
705
 
656
706
  var RelevantTopics = function RelevantTopics() {
657
707
  if (content_placement && content_placement.length > 0 || documentGroupMapping && documentGroupMapping.length > 0) {
@@ -698,7 +748,7 @@ var Article = React.forwardRef(function (props, ref) {
698
748
  React__default['default'].createElement(
699
749
  'style',
700
750
  { jsx: 'true' },
701
- '\n .related-link:not(:first-child):before {\n content: \' | \';\n }\n '
751
+ '\n .related-link:not(:first-child):before {\n content: \' | \';\n }\n '
702
752
  )
703
753
  );
704
754
  }
@@ -995,7 +1045,7 @@ var Article = React.forwardRef(function (props, ref) {
995
1045
  var shareTitle = article.title;
996
1046
  var shareSummary = article.summary;
997
1047
  var shareImage = thumbnail && thumbnail.asset ? urlFor({ client: props.client, source: thumbnail.asset }) : shareImageDefault;
998
- var siteName = props.website && props.website.title ? props.website.title : '';
1048
+ var siteName = props.Website && props.Website.title ? props.Website.title : '';
999
1049
  var shareKeywords = getKeywords(props.article).join(',');
1000
1050
 
1001
1051
  var meta = {
@@ -1242,12 +1292,23 @@ var Article = React.forwardRef(function (props, ref) {
1242
1292
  )
1243
1293
  )
1244
1294
  ),
1245
- issue && issue.url && React__default['default'].createElement(
1246
- 'a',
1247
- { rel: 'noopener', href: issue.url, target: '_blank', title: 'Download issue' },
1248
- React__default['default'].createElement('img', { style: { margin: '1rem', maxHeight: '40px', maxWidth: '40px' }, src: '/download.png', alt: 'download issue' }),
1249
- 'Download Issue : ',
1250
- issue.name
1295
+ React__default['default'].createElement(
1296
+ 'div',
1297
+ { className: 'downloads-container' },
1298
+ issue && downloadCitation && React__default['default'].createElement(
1299
+ Button__default['default'],
1300
+ { className: 'ris-download-button', onClick: function onClick() {
1301
+ return downloadRIS();
1302
+ } },
1303
+ 'Download RIS'
1304
+ ),
1305
+ issue && issue.url && React__default['default'].createElement(
1306
+ 'a',
1307
+ { rel: 'noopener', href: issue.url, target: '_blank', title: 'Download issue' },
1308
+ React__default['default'].createElement('img', { style: { margin: '1rem', maxHeight: '40px', maxWidth: '40px' }, src: '/download.png', alt: 'download issue' }),
1309
+ 'Download Issue : ',
1310
+ issue.name
1311
+ )
1251
1312
  )
1252
1313
  ),
1253
1314
  React__default['default'].createElement('div', { className: 'clearfix', style: { minHeight: '1px' } }),
@@ -12,7 +12,7 @@ var getQuery = function getQuery(type) {
12
12
  case 'related':
13
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, 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 },\n documentGroupMapping[]-> {\n _id,\n name,\n thumbnail,\n parent->{...,parent->},\n isShow,\n showSocialShare,\n \'path\': identifier.current,\n adTargetingURL\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 && is_visible != false\n && url.current == $url\n ' + conditions + '\n ][0]{\n ' + params + '\n title,\n published,\n summary,\n thumbnail,\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 showSocialShare,\n \'path\': identifier.current,\n adTargetingURL\n },\n documentGroupMapping[]-> {\n _id,\n name,\n thumbnail,\n parent->{...,parent->},\n isShow,\n showSocialShare,\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 }';
15
+ 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 ...,\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 showSocialShare,\n \'path\': identifier.current,\n adTargetingURL\n },\n documentGroupMapping[]-> {\n _id,\n name,\n thumbnail,\n parent->{...,parent->},\n isShow,\n showSocialShare,\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 year,\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 thumbnail{ ..., asset-> },\n taxonomyMapping[]->,\n pdf{asset->},\n } | order(year desc, month desc)\n }';
18
18
  case 'issue':
@@ -309,11 +309,7 @@ var CMEDeck = function CMEDeck(_ref) {
309
309
  return React__default.createElement(
310
310
  'div',
311
311
  { className: 'd-flex justify-content-between' },
312
- currentPage && currentPage > 1 && React__default.createElement(
313
- 'a',
314
- { href: '?page=' + (currentPage - 1) },
315
- '<< Previous'
316
- ),
312
+ currentPage > 1 ,
317
313
  React__default.createElement(
318
314
  'a',
319
315
  { href: '?page=' + (currentPage + 1) },
@@ -391,7 +391,7 @@ var MediaSeriesLanding = function MediaSeriesLanding(props) {
391
391
  };
392
392
 
393
393
  MediaSeriesLanding.getInitialData = function () {
394
- var _ref5 = _asyncToGenerator( /*#__PURE__*/regenerator.mark(function _callee2(ctx, client, cache, parameters) {
394
+ var _ref5 = _asyncToGenerator( /*#__PURE__*/regenerator.mark(function _callee2(ctx, client, cache) {
395
395
  var urlQuery, pathname, identifier, itemsPerPage, currentPage, start, statusCode, params, docGroupID, seriesQueryFilters, seriesQuerySorts, seriesQueryProjection, seriesQuery, totalSeriesCountQuery, _ref6, _ref7, seriesData, totalSeriesCount, allSeries, buildUsedTopicsArray, usedTopics, taxonomyFilter;
396
396
 
397
397
  return regenerator.wrap(function _callee2$(_context2) {
@@ -400,7 +400,7 @@ MediaSeriesLanding.getInitialData = function () {
400
400
  case 0:
401
401
  urlQuery = ctx.query, pathname = ctx.pathname;
402
402
  identifier = pathname.replace('/', '');
403
- itemsPerPage = parameters && parameters.itemsPerPage ? parameters.itemsPerPage : 30;
403
+ itemsPerPage = 30;
404
404
  currentPage = urlQuery.page ? parseInt(urlQuery.page) : 1;
405
405
  start = (currentPage - 1) * itemsPerPage;
406
406
  statusCode = 200;
@@ -509,7 +509,7 @@ MediaSeriesLanding.getInitialData = function () {
509
509
  }, _callee2, _this);
510
510
  }));
511
511
 
512
- return function (_x, _x2, _x3, _x4) {
512
+ return function (_x, _x2, _x3) {
513
513
  return _ref5.apply(this, arguments);
514
514
  };
515
515
  }();
package/dist/esm/View.js CHANGED
@@ -27,13 +27,13 @@ import { s as styleInject } from './style-inject.es-1f59c1d0.js';
27
27
  import './index-755f2cc2.js';
28
28
  import { DiscussionEmbed } from 'disqus-react';
29
29
  import Schema from './Schema.js';
30
+ import { c as createCommonjsModule, a as commonjsGlobal } from './_commonjsHelpers-0c4b6f40.js';
30
31
  import { _ as _Object$keys } from './keys-31dcdb31.js';
31
32
  import { I as InfiniteScroll } from './index.es-a6137319.js';
32
33
  import { l as lib_3 } from './index-f0fc23eb.js';
33
34
  import getRelatedArticle from './getRelatedArticle.js';
34
35
  import getQuery from './getQuery.js';
35
36
  import getSeriesDetail from './getSeriesDetail.js';
36
- import './_commonjsHelpers-0c4b6f40.js';
37
37
  import './core.get-iterator-method-ea258bb1.js';
38
38
  import './web.dom.iterable-ab4dea5c.js';
39
39
  import './_library-528f1934.js';
@@ -436,6 +436,12 @@ var getSocialShareDisableFlag = function getSocialShareDisableFlag(article) {
436
436
  return showSocialShare;
437
437
  };
438
438
 
439
+ var FileSaver_min = createCommonjsModule(function (module, exports) {
440
+ (function(a,b){b();})(commonjsGlobal,function(){function b(a,b){return "undefined"==typeof b?b={autoBom:!1}:"object"!=typeof b&&(console.warn("Deprecated: Expected third argument to be a object"),b={autoBom:!b}),b.autoBom&&/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(a.type)?new Blob(["\uFEFF",a],{type:a.type}):a}function c(a,b,c){var d=new XMLHttpRequest;d.open("GET",a),d.responseType="blob",d.onload=function(){g(d.response,b,c);},d.onerror=function(){console.error("could not download file");},d.send();}function d(a){var b=new XMLHttpRequest;b.open("HEAD",a,!1);try{b.send();}catch(a){}return 200<=b.status&&299>=b.status}function e(a){try{a.dispatchEvent(new MouseEvent("click"));}catch(c){var b=document.createEvent("MouseEvents");b.initMouseEvent("click",!0,!0,window,0,0,0,80,20,!1,!1,!1,!1,0,null),a.dispatchEvent(b);}}var f="object"==typeof window&&window.window===window?window:"object"==typeof self&&self.self===self?self:"object"==typeof commonjsGlobal&&commonjsGlobal.global===commonjsGlobal?commonjsGlobal:void 0,a=f.navigator&&/Macintosh/.test(navigator.userAgent)&&/AppleWebKit/.test(navigator.userAgent)&&!/Safari/.test(navigator.userAgent),g=f.saveAs||("object"!=typeof window||window!==f?function(){}:"download"in HTMLAnchorElement.prototype&&!a?function(b,g,h){var i=f.URL||f.webkitURL,j=document.createElement("a");g=g||b.name||"download",j.download=g,j.rel="noopener","string"==typeof b?(j.href=b,j.origin===location.origin?e(j):d(j.href)?c(b,g,h):e(j,j.target="_blank")):(j.href=i.createObjectURL(b),setTimeout(function(){i.revokeObjectURL(j.href);},4E4),setTimeout(function(){e(j);},0));}:"msSaveOrOpenBlob"in navigator?function(f,g,h){if(g=g||f.name||"download","string"!=typeof f)navigator.msSaveOrOpenBlob(b(f,h),g);else if(d(f))c(f,g,h);else {var i=document.createElement("a");i.href=f,i.target="_blank",setTimeout(function(){e(i);});}}:function(b,d,e,g){if(g=g||open("","_blank"),g&&(g.document.title=g.document.body.innerText="downloading..."),"string"==typeof b)return c(b,d,e);var h="application/octet-stream"===b.type,i=/constructor/i.test(f.HTMLElement)||f.safari,j=/CriOS\/[\d]+/.test(navigator.userAgent);if((j||h&&i||a)&&"undefined"!=typeof FileReader){var k=new FileReader;k.onloadend=function(){var a=k.result;a=j?a:a.replace(/^data:[^;]*;/,"data:attachment/file;"),g?g.location.href=a:location=a,g=null;},k.readAsDataURL(b);}else {var l=f.URL||f.webkitURL,m=l.createObjectURL(b);g?g.location=m:location.href=m,g=null,setTimeout(function(){l.revokeObjectURL(m);},4E4);}});f.saveAs=g.saveAs=g,(module.exports=g);});
441
+
442
+
443
+ });
444
+
439
445
  var Article = forwardRef(function (props, ref) {
440
446
  var onVote = function () {
441
447
  var _ref = _asyncToGenerator( /*#__PURE__*/regenerator.mark(function _callee(nodeKey, selectedChoice) {
@@ -547,7 +553,9 @@ var Article = forwardRef(function (props, ref) {
547
553
  _props$refreshFlag = props.refreshFlag,
548
554
  refreshFlag = _props$refreshFlag === undefined ? false : _props$refreshFlag,
549
555
  disqusConfig = props.disqusConfig,
550
- showDisqus = props.showDisqus;
556
+ showDisqus = props.showDisqus,
557
+ _props$downloadCitati = props.downloadCitation,
558
+ downloadCitation = _props$downloadCitati === undefined ? false : _props$downloadCitati;
551
559
 
552
560
  var targeting = getTargeting(props);
553
561
 
@@ -642,6 +650,48 @@ var Article = forwardRef(function (props, ref) {
642
650
  }
643
651
  return null;
644
652
  };
653
+ var generateRIS = function generateRIS() {
654
+ var fileContent = 'TY - JOUR\n';
655
+ if (issue) {
656
+ if (article.title) {
657
+ fileContent += 'TI - ' + article.title + '\n'; //Title - TI
658
+ fileContent += 'T1 - ' + article.title + '\n'; //Title - T1
659
+ }
660
+ if (issue.publication && issue.publication.name) {
661
+ fileContent += 'T2 - ' + issue.publication.name + '\n'; //Secondary Title - T2
662
+ fileContent += 'JF - ' + issue.publication.name + '\n'; //Journal Name - JF
663
+ fileContent += 'JO - ' + issue.publication.name + '\n'; //Journal Name - JO
664
+ }
665
+ if (article.summary) fileContent += 'N2 - ' + article.summary + '\n'; //Abstract - N2
666
+ if (issue.issueNumber) fileContent += 'IS - ' + issue.issueNumber + '\n'; //Issue Number - IS
667
+ fileContent += 'PB - MJH Life Sciences\n'; //Publisher - PB
668
+ if (issue.year) fileContent += 'PY - ' + issue.year + '\n'; //Published Year - PY
669
+ if (issue.volume) fileContent += 'VL - ' + issue.volume + '\n'; //Volume - VL
670
+ if (issue.url) fileContent += 'L1 - ' + issue.url + '\n'; //Link to PDF - L1
671
+ if (shareOptions && shareOptions.shareBaseUrl) {
672
+ fileContent += 'L2 - ' + (shareOptions.shareBaseUrl + url) + '\n'; //Link to Full-text - L2
673
+ fileContent += 'UR - ' + (shareOptions.shareBaseUrl + url) + '\n'; //Doc URL - UR
674
+ }
675
+ if (props.Website) fileContent += 'LK - https://' + props.Website.liveDomain + '\n'; //Website Link - LK
676
+ if (pageNumber) {
677
+ if (pageNumber.includes('-')) {
678
+ fileContent += 'SP - ' + pageNumber.split('-')[0] + '\n'; //Start Page - SP
679
+ fileContent += 'EP - ' + pageNumber.split('-')[1] + '\n'; //End Page - EP
680
+ } else {
681
+ fileContent += 'SP - ' + pageNumber + '\n';
682
+ }
683
+ }
684
+ if (article.published) fileContent += 'Y1 - ' + moment(published).format('DD-MMMM-YYYY') + '\n'; //Primary Date - Y1
685
+ fileContent += 'Y2 - ' + moment().format('DD-MMMM-YYYY') + '\n'; //Access Date - Y2
686
+ }
687
+ fileContent += 'ER -\n'; //End of Record
688
+ return fileContent;
689
+ };
690
+ var downloadRIS = function downloadRIS() {
691
+ var fileContent = generateRIS();
692
+ var file = new File([fileContent], 'citation-' + url + '.ris', { type: 'application/x-research-info-systems;charset=utf-8' });
693
+ FileSaver_min.saveAs(file, 'citation-' + url + '.ris');
694
+ };
645
695
 
646
696
  var RelevantTopics = function RelevantTopics() {
647
697
  if (content_placement && content_placement.length > 0 || documentGroupMapping && documentGroupMapping.length > 0) {
@@ -688,7 +738,7 @@ var Article = forwardRef(function (props, ref) {
688
738
  React__default.createElement(
689
739
  'style',
690
740
  { jsx: 'true' },
691
- '\n .related-link:not(:first-child):before {\n content: \' | \';\n }\n '
741
+ '\n .related-link:not(:first-child):before {\n content: \' | \';\n }\n '
692
742
  )
693
743
  );
694
744
  }
@@ -985,7 +1035,7 @@ var Article = forwardRef(function (props, ref) {
985
1035
  var shareTitle = article.title;
986
1036
  var shareSummary = article.summary;
987
1037
  var shareImage = thumbnail && thumbnail.asset ? urlFor({ client: props.client, source: thumbnail.asset }) : shareImageDefault;
988
- var siteName = props.website && props.website.title ? props.website.title : '';
1038
+ var siteName = props.Website && props.Website.title ? props.Website.title : '';
989
1039
  var shareKeywords = getKeywords(props.article).join(',');
990
1040
 
991
1041
  var meta = {
@@ -1232,12 +1282,23 @@ var Article = forwardRef(function (props, ref) {
1232
1282
  )
1233
1283
  )
1234
1284
  ),
1235
- issue && issue.url && React__default.createElement(
1236
- 'a',
1237
- { rel: 'noopener', href: issue.url, target: '_blank', title: 'Download issue' },
1238
- React__default.createElement('img', { style: { margin: '1rem', maxHeight: '40px', maxWidth: '40px' }, src: '/download.png', alt: 'download issue' }),
1239
- 'Download Issue : ',
1240
- issue.name
1285
+ React__default.createElement(
1286
+ 'div',
1287
+ { className: 'downloads-container' },
1288
+ issue && downloadCitation && React__default.createElement(
1289
+ Button,
1290
+ { className: 'ris-download-button', onClick: function onClick() {
1291
+ return downloadRIS();
1292
+ } },
1293
+ 'Download RIS'
1294
+ ),
1295
+ issue && issue.url && React__default.createElement(
1296
+ 'a',
1297
+ { rel: 'noopener', href: issue.url, target: '_blank', title: 'Download issue' },
1298
+ React__default.createElement('img', { style: { margin: '1rem', maxHeight: '40px', maxWidth: '40px' }, src: '/download.png', alt: 'download issue' }),
1299
+ 'Download Issue : ',
1300
+ issue.name
1301
+ )
1241
1302
  )
1242
1303
  ),
1243
1304
  React__default.createElement('div', { className: 'clearfix', style: { minHeight: '1px' } }),
@@ -10,7 +10,7 @@ var getQuery = function getQuery(type) {
10
10
  case 'related':
11
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, 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 },\n documentGroupMapping[]-> {\n _id,\n name,\n thumbnail,\n parent->{...,parent->},\n isShow,\n showSocialShare,\n \'path\': identifier.current,\n adTargetingURL\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 && is_visible != false\n && url.current == $url\n ' + conditions + '\n ][0]{\n ' + params + '\n title,\n published,\n summary,\n thumbnail,\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 showSocialShare,\n \'path\': identifier.current,\n adTargetingURL\n },\n documentGroupMapping[]-> {\n _id,\n name,\n thumbnail,\n parent->{...,parent->},\n isShow,\n showSocialShare,\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 }';
13
+ 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 ...,\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 showSocialShare,\n \'path\': identifier.current,\n adTargetingURL\n },\n documentGroupMapping[]-> {\n _id,\n name,\n thumbnail,\n parent->{...,parent->},\n isShow,\n showSocialShare,\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 year,\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 thumbnail{ ..., asset-> },\n taxonomyMapping[]->,\n pdf{asset->},\n } | order(year desc, month desc)\n }';
16
16
  case 'issue':
@@ -1,4 +1,4 @@
1
- import { c as createCommonjsModule, u as unwrapExports } from './_commonjsHelpers-0c4b6f40.js';
1
+ import { u as unwrapExports, c as createCommonjsModule } from './_commonjsHelpers-0c4b6f40.js';
2
2
  import { a as _core } from './core.get-iterator-method-ea258bb1.js';
3
3
 
4
4
  var $JSON = _core.JSON || (_core.JSON = { stringify: JSON.stringify });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mjhls/mjh-framework",
3
- "version": "1.0.901-media-series-itemsperpage-v2",
3
+ "version": "1.0.901-ris-export-v1",
4
4
  "description": "Foundation Framework",
5
5
  "author": "mjh-framework",
6
6
  "license": "MIT",
@@ -56,6 +56,7 @@
56
56
  "eslint-plugin-react": "^7.10.0",
57
57
  "eslint-plugin-react-hooks": "^2.3.0",
58
58
  "eslint-plugin-standard": "^3.1.0",
59
+ "file-saver": "^2.0.5",
59
60
  "get-youtube-id": "^1.0.1",
60
61
  "gh-pages": "^1.2.0",
61
62
  "lodash": "^4.17.15",