@mjhls/mjh-framework 1.0.704 → 1.0.706

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/README.md CHANGED
@@ -1,5 +1,5 @@
1
1
 
2
- # mjh-framework v. 1.0.703
2
+ # mjh-framework v. 1.0.706
3
3
 
4
4
  > Foundation Framework
5
5
 
@@ -26,7 +26,7 @@ var Header = function Header(props) {
26
26
  title
27
27
  ),
28
28
  keyword && React__default['default'].createElement('meta', { name: 'keywords', content: keyword }),
29
- description && React__default['default'].createElement('meta', { name: 'description', content: description }),
29
+ description && React__default['default'].createElement('meta', { name: 'description', content: description, key: 'description' }),
30
30
  !isLiveSite && React__default['default'].createElement('meta', { name: 'robots', content: 'noindex, nofollow' })
31
31
  );
32
32
  };
@@ -415,36 +415,86 @@ Publication.getInitialProps = async (ctx) => {
415
415
  export default Publication
416
416
  */
417
417
 
418
+ var generateContentPlacements = function generateContentPlacements(issues) {
419
+ var contentPlacements = [];
420
+ issues && issues.length > 0 && issues.forEach(function (issue) {
421
+ if (issue.taxonomyMapping && issue.taxonomyMapping.length > 0) {
422
+ issue.taxonomyMapping && issue.taxonomyMapping.forEach(function (tm) {
423
+ if (!contentPlacements.find(function (cp) {
424
+ return cp.identifier === tm.identifier;
425
+ })) {
426
+ contentPlacements.push({ _id: tm._id, name: tm.name, identifier: tm.identifier });
427
+ }
428
+ });
429
+ }
430
+ });
431
+ return contentPlacements;
432
+ };
433
+
418
434
  var PublicationLanding = function PublicationLanding(props) {
419
435
  var publication = props.publication,
420
- year = props.year,
436
+ _props$year = props.year,
437
+ year = _props$year === undefined ? '' : _props$year,
421
438
  href = props.href;
422
439
  props.pdf;
440
+ var _props$contentPlaceme = props.contentPlacement,
441
+ contentPlacement = _props$contentPlaceme === undefined ? '' : _props$contentPlaceme;
423
442
 
424
443
 
425
444
  var router = Router.useRouter();
426
445
  var years = [].concat(toConsumableArray._toConsumableArray(new _Set(publication.issues.map(function (issue) {
427
446
  return issue.year;
428
447
  })))).sort().reverse();
448
+ var contentPlacements = generateContentPlacements(publication.issues);
429
449
 
430
450
  var _useState = React.useState(publication.issues),
431
451
  _useState2 = slicedToArray._slicedToArray(_useState, 2),
432
452
  issueData = _useState2[0],
433
453
  setIssueData = _useState2[1];
434
454
 
435
- var _useState3 = React.useState(year ? year : years[0]),
455
+ var _useState3 = React.useState(year),
436
456
  _useState4 = slicedToArray._slicedToArray(_useState3, 2),
437
457
  activeYear = _useState4[0],
438
458
  setActiveYear = _useState4[1];
439
459
 
460
+ var _useState5 = React.useState(contentPlacement),
461
+ _useState6 = slicedToArray._slicedToArray(_useState5, 2),
462
+ activeContentPlacement = _useState6[0],
463
+ setActiveContentPlacement = _useState6[1];
464
+
440
465
  React.useEffect(function () {
441
- router.push(router.pathname, '/' + (href ? href : 'publications') + '/' + publication.identifier.current + '?year=' + activeYear, { shallow: true });
442
- setIssueData(function () {
443
- return publication.issues.filter(function (issue) {
444
- return issue.year === activeYear;
466
+ if (activeYear && activeContentPlacement) {
467
+ router.push(router.pathname, '/' + (href ? href : 'publications') + '/' + publication.identifier.current + '?year=' + activeYear + '&cp=' + activeContentPlacement, { shallow: true });
468
+ setIssueData(function () {
469
+ return publication.issues.filter(function (issue) {
470
+ return issue.year === activeYear;
471
+ }).filter(function (issue) {
472
+ return issue.taxonomyMapping && issue.taxonomyMapping.find(function (tm) {
473
+ return tm.identifier === activeContentPlacement;
474
+ });
475
+ });
445
476
  });
446
- });
447
- }, [activeYear]);
477
+ } else if (activeYear) {
478
+ router.push(router.pathname, '/' + (href ? href : 'publications') + '/' + publication.identifier.current + '?year=' + activeYear, { shallow: true });
479
+ setIssueData(function () {
480
+ return publication.issues.filter(function (issue) {
481
+ return issue.year === activeYear;
482
+ });
483
+ });
484
+ } else if (activeContentPlacement) {
485
+ router.push(router.pathname, '/' + (href ? href : 'publications') + '/' + publication.identifier.current + '?cp=' + activeContentPlacement, { shallow: true });
486
+ setIssueData(function () {
487
+ return publication.issues.filter(function (issue) {
488
+ return issue.taxonomyMapping && issue.taxonomyMapping.find(function (tm) {
489
+ return tm.identifier === activeContentPlacement;
490
+ });
491
+ });
492
+ });
493
+ } else {
494
+ router.push(router.pathname, '/' + (href ? href : 'publications') + '/' + publication.identifier.current, { shallow: true });
495
+ setIssueData(publication.issues);
496
+ }
497
+ }, [activeYear, activeContentPlacement]);
448
498
 
449
499
  return React__default['default'].createElement(
450
500
  'div',
@@ -452,25 +502,28 @@ var PublicationLanding = function PublicationLanding(props) {
452
502
  React__default['default'].createElement(
453
503
  'style',
454
504
  { jsx: true },
455
- '\n #pubYearFilter .dropdown-menu.show {\n max-height: 25vh;\n }\n '
505
+ '\n #pubYearFilter .dropdown-menu.show,\n #contentPlacementFilter .dropdown-menu.show {\n max-height: 25vh;\n overflow: auto;\n }\n '
456
506
  ),
457
507
  React__default['default'].createElement(
458
508
  Row__default['default'],
459
- { style: { marginBottom: '1rem' } },
509
+ null,
460
510
  React__default['default'].createElement(
461
511
  Col__default['default'],
462
- null,
512
+ { className: 'flex-grow-0 mb-3' },
463
513
  React__default['default'].createElement(
464
514
  Dropdown__default['default'],
465
515
  { id: 'pubYearFilter' },
466
516
  React__default['default'].createElement(
467
517
  Dropdown__default['default'].Toggle,
468
518
  null,
469
- activeYear
519
+ activeYear ? activeYear : 'Select Year'
470
520
  ),
471
521
  React__default['default'].createElement(
472
522
  Dropdown__default['default'].Menu,
473
523
  null,
524
+ React__default['default'].createElement(Dropdown__default['default'].Item, { style: { height: '2rem' }, onClick: function onClick() {
525
+ return setActiveYear('');
526
+ } }),
474
527
  years.map(function (yr, key) {
475
528
  return React__default['default'].createElement(
476
529
  Dropdown__default['default'].Item,
@@ -482,6 +535,35 @@ var PublicationLanding = function PublicationLanding(props) {
482
535
  })
483
536
  )
484
537
  )
538
+ ),
539
+ contentPlacements && contentPlacements.length > 0 && React__default['default'].createElement(
540
+ Col__default['default'],
541
+ { className: 'flex-grow-0 mb-3' },
542
+ React__default['default'].createElement(
543
+ Dropdown__default['default'],
544
+ { id: 'contentPlacementFilter' },
545
+ React__default['default'].createElement(
546
+ Dropdown__default['default'].Toggle,
547
+ null,
548
+ activeContentPlacement ? activeContentPlacement : 'Select Content Placement'
549
+ ),
550
+ React__default['default'].createElement(
551
+ Dropdown__default['default'].Menu,
552
+ null,
553
+ React__default['default'].createElement(Dropdown__default['default'].Item, { style: { height: '2rem' }, onClick: function onClick() {
554
+ return setActiveContentPlacement('');
555
+ } }),
556
+ contentPlacements.map(function (cp) {
557
+ return React__default['default'].createElement(
558
+ Dropdown__default['default'].Item,
559
+ { key: cp._id, onClick: function onClick() {
560
+ return setActiveContentPlacement(cp.identifier);
561
+ } },
562
+ cp.name
563
+ );
564
+ })
565
+ )
566
+ )
485
567
  )
486
568
  ),
487
569
  issueData && issueData.length > 0 ? issueData.map(function (issue, key) {
@@ -559,7 +641,7 @@ var PublicationLanding = function PublicationLanding(props) {
559
641
  React__default['default'].createElement(
560
642
  'style',
561
643
  { jsx: 'true' },
562
- '\n .issueCard.card:hover {\n cursor: default;\n }\n .content-category-label {\n margin: 0.5rem 0;\n display: block;\n }\n .sanityDisplayLabel {\n margin: 0.5rem 0;\n border: 1px solid black;\n display: inline;\n width: 100%;\n padding: 5px;\n color: #484848;\n border-radius: 2px;\n }\n '
644
+ '\n .issueCard.card:hover {\n cursor: default;\n }\n .content-category-label {\n margin: 0.5rem 0;\n display: block;\n }\n .sanityDisplayLabel {\n margin: 0.5rem 0;\n border: 1px solid black;\n display: inline;\n width: 100%;\n padding: 5px;\n color: #484848;\n border-radius: 2px;\n }\n .dropdown-toggle {\n min-width: 5rem;\n }\n .dropdown-toggle:empty:after {\n margin-left: 4rem;\n }\n '
563
645
  )
564
646
  );
565
647
  };
@@ -0,0 +1,157 @@
1
+ 'use strict';
2
+
3
+ var asyncToGenerator = require('./asyncToGenerator-2edcb6ad.js');
4
+ var _extends = require('./extends-1e24fc8d.js');
5
+ var React = require('react');
6
+ var Router = require('next/router');
7
+ var Head = require('next/head');
8
+ var BlockContent = require('./BlockContent-eca358e4.js');
9
+ var getSerializers = require('./index-4d37a34d.js');
10
+ require('./_commonjsHelpers-06173234.js');
11
+ require('./es6.string.iterator-20d42c53.js');
12
+ require('./_to-object-821a2927.js');
13
+ require('./web.dom.iterable-4480325a.js');
14
+ require('./_library-dd23b178.js');
15
+ require('./core.get-iterator-method-b4615fd3.js');
16
+ require('./_set-species-a8cfdb84.js');
17
+ require('./_iter-detect-2613ffa1.js');
18
+ require('./_object-pie-68c5bcbc.js');
19
+ require('prop-types');
20
+ require('./index-d48b231c.js');
21
+ require('./slicedToArray-db24842a.js');
22
+ require('react-bootstrap');
23
+ require('./index-5ad2b070.js');
24
+ require('./smoothscroll-1abb448e.js');
25
+ require('./util-6f784d85.js');
26
+ require('./Beam.js');
27
+ require('./stringify-01cf47f7.js');
28
+ require('./Segment.js');
29
+ require('./main-eeffe77b.js');
30
+ require('./index-80f57cff.js');
31
+ require('react-dom');
32
+ require('./typeof-97065d40.js');
33
+ require('./_is-array-63ae4740.js');
34
+ require('./brightcove-react-player-loader.es-a195642e.js');
35
+ require('./GroupDeck.js');
36
+ require('./moment-aca40de1.js');
37
+ require('./toConsumableArray-cf0865fc.js');
38
+ require('react-bootstrap/Pagination');
39
+ require('react-bootstrap/Button');
40
+ require('./entities-3f9d0f2f.js');
41
+ require('./AdSlot.js');
42
+ require('./debounce-eb287781.js');
43
+ require('./isSymbol-04666465.js');
44
+ require('react-bootstrap/Row');
45
+ require('react-bootstrap/Col');
46
+ require('./inherits-2eb23889.js');
47
+ require('./_object-sap-c5bd707d.js');
48
+ require('./define-property-aff11f8a.js');
49
+ require('./index.esm-974f47d9.js');
50
+ require('./iconBase-68959171.js');
51
+ require('react-bootstrap/Figure');
52
+
53
+ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
54
+
55
+ var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
56
+ var Head__default = /*#__PURE__*/_interopDefaultLegacy(Head);
57
+
58
+ var _this = undefined;
59
+
60
+ var blocksToText = function blocksToText(blocks) {
61
+ var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
62
+
63
+ var defaults = { nonTextBehavior: 'remove' };
64
+ var options = _extends._Object$assign({}, defaults, opts);
65
+ return blocks.map(function (block) {
66
+ if (block._type !== 'block' || !block.children) {
67
+ return options.nonTextBehavior === 'remove' ? '' : '[' + block._type + ' block]';
68
+ }
69
+ return block.children.map(function (child) {
70
+ return child.text;
71
+ }).join('');
72
+ }).join('\n\n');
73
+ };
74
+
75
+ var setMetaDescription = function setMetaDescription(data, router) {
76
+ var metaDescription = blocksToText(data);
77
+ if (router && router.asPath) {
78
+ var queryParms = router.asPath.split('?')[1];
79
+ if (queryParms) {
80
+ var pageNumber = queryParms.split('&').reduce(function (acc, item) {
81
+ if (item.startsWith('page=')) {
82
+ if (item.split('=')[1]) {
83
+ acc = item.split('=')[1];
84
+ return acc;
85
+ }
86
+ return acc;
87
+ }
88
+ return acc;
89
+ }, '');
90
+ if (pageNumber && pageNumber !== '') {
91
+ metaDescription = blocksToText(data) + '| Page ' + pageNumber;
92
+ }
93
+ }
94
+ }
95
+ return React__default['default'].createElement(
96
+ Head__default['default'],
97
+ null,
98
+ React__default['default'].createElement('meta', { name: 'description', content: metaDescription, key: 'description' })
99
+ );
100
+ };
101
+
102
+ var TaxonomyDescription = function TaxonomyDescription(_ref) {
103
+ var data = _ref.data,
104
+ client = _ref.client;
105
+
106
+ var router = Router.useRouter();
107
+ return data && data.length > 0 && React__default['default'].createElement(
108
+ 'section',
109
+ { className: 'taxonomy-description' },
110
+ setMetaDescription(data, router),
111
+ React__default['default'].createElement(BlockContent.BlockContent, _extends._extends({ serializers: getSerializers.getSerializers(client), blocks: data, imageOptions: { w: 320, h: 240, fit: 'max' } }, client.config()))
112
+ );
113
+ };
114
+
115
+ TaxonomyDescription.getDescription = function () {
116
+ var _ref2 = asyncToGenerator._asyncToGenerator( /*#__PURE__*/asyncToGenerator.regenerator.mark(function _callee() {
117
+ var url = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
118
+ var client = arguments[1];
119
+ var query, summary;
120
+ return asyncToGenerator.regenerator.wrap(function _callee$(_context) {
121
+ while (1) {
122
+ switch (_context.prev = _context.next) {
123
+ case 0:
124
+ query = '*[_type == \'taxonomy\' && identifier == \'' + url + '\'][0].summary';
125
+ summary = [];
126
+ _context.prev = 2;
127
+ _context.next = 5;
128
+ return client.fetch(query);
129
+
130
+ case 5:
131
+ summary = _context.sent;
132
+ _context.next = 11;
133
+ break;
134
+
135
+ case 8:
136
+ _context.prev = 8;
137
+ _context.t0 = _context['catch'](2);
138
+
139
+ console.error(_context.t0);
140
+
141
+ case 11:
142
+ return _context.abrupt('return', summary);
143
+
144
+ case 12:
145
+ case 'end':
146
+ return _context.stop();
147
+ }
148
+ }
149
+ }, _callee, _this, [[2, 8]]);
150
+ }));
151
+
152
+ return function () {
153
+ return _ref2.apply(this, arguments);
154
+ };
155
+ }();
156
+
157
+ module.exports = TaxonomyDescription;
@@ -14,7 +14,7 @@ var getQuery = function getQuery(type) {
14
14
  case 'article':
15
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 issueGroup-> { _id, name, identifier, parent-> },\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 _id,\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
- 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 }';
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 taxonomyMapping[]->,\n pdf{asset->}\n } | order(year desc, month desc)\n }';
18
18
  case 'issue':
19
19
  return '*[_type == \'publication\'\n && identifier.current == $publication\n ' + conditions + '][0] {\n ' + params + '\n ...,\n \'issue\': *[_type == \'publication\'\n && references(^._id)\n && identifier.current == $issue][0] {\n ...,\n \'articles\': *[_type == \'article\'\n && !(_id in path("drafts.**"))\n && defined(title)\n && is_visible\n && defined(url)\n && defined(published) \n && dateTime(published) <= dateTime(now())\n && passwordLock != true\n && references(^._id)] | order(published desc) {\n ...,\n authorMapping[0]->,\n contentCategory->,\n issueSection-> {\n name\n }\n }\n }\n }';
20
20
  case 'externalResources':
package/dist/cjs/index.js CHANGED
@@ -65,6 +65,7 @@ var PopUpModal = require('./PopUpModal.js');
65
65
  var RelatedContent = require('./RelatedContent.js');
66
66
  var SocialIcons = require('./SocialIcons.js');
67
67
  var ArticleCarousel = require('./ArticleCarousel.js');
68
+ var TaxonomyDescription = require('./TaxonomyDescription.js');
68
69
  var ForbesHero = require('./ForbesHero.js');
69
70
  var HorizontalHero = require('./HorizontalHero.js');
70
71
  var OncliveHero = require('./OncliveHero.js');
@@ -242,6 +243,7 @@ exports.PopUpModal = PopUpModal;
242
243
  exports.RelatedContent = RelatedContent;
243
244
  exports.SocialIcons = SocialIcons;
244
245
  exports.ArticleCarousel = ArticleCarousel;
246
+ exports.TaxonomyDescription = TaxonomyDescription;
245
247
  exports.ForbesHero = ForbesHero;
246
248
  exports.HorizontalHero = HorizontalHero;
247
249
  exports.OncliveHero = OncliveHero;
@@ -17,7 +17,7 @@ var Header = function Header(props) {
17
17
  title
18
18
  ),
19
19
  keyword && React.createElement('meta', { name: 'keywords', content: keyword }),
20
- description && React.createElement('meta', { name: 'description', content: description }),
20
+ description && React.createElement('meta', { name: 'description', content: description, key: 'description' }),
21
21
  !isLiveSite && React.createElement('meta', { name: 'robots', content: 'noindex, nofollow' })
22
22
  );
23
23
  };
@@ -405,36 +405,86 @@ Publication.getInitialProps = async (ctx) => {
405
405
  export default Publication
406
406
  */
407
407
 
408
+ var generateContentPlacements = function generateContentPlacements(issues) {
409
+ var contentPlacements = [];
410
+ issues && issues.length > 0 && issues.forEach(function (issue) {
411
+ if (issue.taxonomyMapping && issue.taxonomyMapping.length > 0) {
412
+ issue.taxonomyMapping && issue.taxonomyMapping.forEach(function (tm) {
413
+ if (!contentPlacements.find(function (cp) {
414
+ return cp.identifier === tm.identifier;
415
+ })) {
416
+ contentPlacements.push({ _id: tm._id, name: tm.name, identifier: tm.identifier });
417
+ }
418
+ });
419
+ }
420
+ });
421
+ return contentPlacements;
422
+ };
423
+
408
424
  var PublicationLanding = function PublicationLanding(props) {
409
425
  var publication = props.publication,
410
- year = props.year,
426
+ _props$year = props.year,
427
+ year = _props$year === undefined ? '' : _props$year,
411
428
  href = props.href;
412
429
  props.pdf;
430
+ var _props$contentPlaceme = props.contentPlacement,
431
+ contentPlacement = _props$contentPlaceme === undefined ? '' : _props$contentPlaceme;
413
432
 
414
433
 
415
434
  var router = useRouter();
416
435
  var years = [].concat(_toConsumableArray(new _Set(publication.issues.map(function (issue) {
417
436
  return issue.year;
418
437
  })))).sort().reverse();
438
+ var contentPlacements = generateContentPlacements(publication.issues);
419
439
 
420
440
  var _useState = useState(publication.issues),
421
441
  _useState2 = _slicedToArray(_useState, 2),
422
442
  issueData = _useState2[0],
423
443
  setIssueData = _useState2[1];
424
444
 
425
- var _useState3 = useState(year ? year : years[0]),
445
+ var _useState3 = useState(year),
426
446
  _useState4 = _slicedToArray(_useState3, 2),
427
447
  activeYear = _useState4[0],
428
448
  setActiveYear = _useState4[1];
429
449
 
450
+ var _useState5 = useState(contentPlacement),
451
+ _useState6 = _slicedToArray(_useState5, 2),
452
+ activeContentPlacement = _useState6[0],
453
+ setActiveContentPlacement = _useState6[1];
454
+
430
455
  useEffect(function () {
431
- router.push(router.pathname, '/' + (href ? href : 'publications') + '/' + publication.identifier.current + '?year=' + activeYear, { shallow: true });
432
- setIssueData(function () {
433
- return publication.issues.filter(function (issue) {
434
- return issue.year === activeYear;
456
+ if (activeYear && activeContentPlacement) {
457
+ router.push(router.pathname, '/' + (href ? href : 'publications') + '/' + publication.identifier.current + '?year=' + activeYear + '&cp=' + activeContentPlacement, { shallow: true });
458
+ setIssueData(function () {
459
+ return publication.issues.filter(function (issue) {
460
+ return issue.year === activeYear;
461
+ }).filter(function (issue) {
462
+ return issue.taxonomyMapping && issue.taxonomyMapping.find(function (tm) {
463
+ return tm.identifier === activeContentPlacement;
464
+ });
465
+ });
435
466
  });
436
- });
437
- }, [activeYear]);
467
+ } else if (activeYear) {
468
+ router.push(router.pathname, '/' + (href ? href : 'publications') + '/' + publication.identifier.current + '?year=' + activeYear, { shallow: true });
469
+ setIssueData(function () {
470
+ return publication.issues.filter(function (issue) {
471
+ return issue.year === activeYear;
472
+ });
473
+ });
474
+ } else if (activeContentPlacement) {
475
+ router.push(router.pathname, '/' + (href ? href : 'publications') + '/' + publication.identifier.current + '?cp=' + activeContentPlacement, { shallow: true });
476
+ setIssueData(function () {
477
+ return publication.issues.filter(function (issue) {
478
+ return issue.taxonomyMapping && issue.taxonomyMapping.find(function (tm) {
479
+ return tm.identifier === activeContentPlacement;
480
+ });
481
+ });
482
+ });
483
+ } else {
484
+ router.push(router.pathname, '/' + (href ? href : 'publications') + '/' + publication.identifier.current, { shallow: true });
485
+ setIssueData(publication.issues);
486
+ }
487
+ }, [activeYear, activeContentPlacement]);
438
488
 
439
489
  return React.createElement(
440
490
  'div',
@@ -442,25 +492,28 @@ var PublicationLanding = function PublicationLanding(props) {
442
492
  React.createElement(
443
493
  'style',
444
494
  { jsx: true },
445
- '\n #pubYearFilter .dropdown-menu.show {\n max-height: 25vh;\n }\n '
495
+ '\n #pubYearFilter .dropdown-menu.show,\n #contentPlacementFilter .dropdown-menu.show {\n max-height: 25vh;\n overflow: auto;\n }\n '
446
496
  ),
447
497
  React.createElement(
448
498
  Row,
449
- { style: { marginBottom: '1rem' } },
499
+ null,
450
500
  React.createElement(
451
501
  Col,
452
- null,
502
+ { className: 'flex-grow-0 mb-3' },
453
503
  React.createElement(
454
504
  Dropdown,
455
505
  { id: 'pubYearFilter' },
456
506
  React.createElement(
457
507
  Dropdown.Toggle,
458
508
  null,
459
- activeYear
509
+ activeYear ? activeYear : 'Select Year'
460
510
  ),
461
511
  React.createElement(
462
512
  Dropdown.Menu,
463
513
  null,
514
+ React.createElement(Dropdown.Item, { style: { height: '2rem' }, onClick: function onClick() {
515
+ return setActiveYear('');
516
+ } }),
464
517
  years.map(function (yr, key) {
465
518
  return React.createElement(
466
519
  Dropdown.Item,
@@ -472,6 +525,35 @@ var PublicationLanding = function PublicationLanding(props) {
472
525
  })
473
526
  )
474
527
  )
528
+ ),
529
+ contentPlacements && contentPlacements.length > 0 && React.createElement(
530
+ Col,
531
+ { className: 'flex-grow-0 mb-3' },
532
+ React.createElement(
533
+ Dropdown,
534
+ { id: 'contentPlacementFilter' },
535
+ React.createElement(
536
+ Dropdown.Toggle,
537
+ null,
538
+ activeContentPlacement ? activeContentPlacement : 'Select Content Placement'
539
+ ),
540
+ React.createElement(
541
+ Dropdown.Menu,
542
+ null,
543
+ React.createElement(Dropdown.Item, { style: { height: '2rem' }, onClick: function onClick() {
544
+ return setActiveContentPlacement('');
545
+ } }),
546
+ contentPlacements.map(function (cp) {
547
+ return React.createElement(
548
+ Dropdown.Item,
549
+ { key: cp._id, onClick: function onClick() {
550
+ return setActiveContentPlacement(cp.identifier);
551
+ } },
552
+ cp.name
553
+ );
554
+ })
555
+ )
556
+ )
475
557
  )
476
558
  ),
477
559
  issueData && issueData.length > 0 ? issueData.map(function (issue, key) {
@@ -549,7 +631,7 @@ var PublicationLanding = function PublicationLanding(props) {
549
631
  React.createElement(
550
632
  'style',
551
633
  { jsx: 'true' },
552
- '\n .issueCard.card:hover {\n cursor: default;\n }\n .content-category-label {\n margin: 0.5rem 0;\n display: block;\n }\n .sanityDisplayLabel {\n margin: 0.5rem 0;\n border: 1px solid black;\n display: inline;\n width: 100%;\n padding: 5px;\n color: #484848;\n border-radius: 2px;\n }\n '
634
+ '\n .issueCard.card:hover {\n cursor: default;\n }\n .content-category-label {\n margin: 0.5rem 0;\n display: block;\n }\n .sanityDisplayLabel {\n margin: 0.5rem 0;\n border: 1px solid black;\n display: inline;\n width: 100%;\n padding: 5px;\n color: #484848;\n border-radius: 2px;\n }\n .dropdown-toggle {\n min-width: 5rem;\n }\n .dropdown-toggle:empty:after {\n margin-left: 4rem;\n }\n '
553
635
  )
554
636
  );
555
637
  };
@@ -0,0 +1,150 @@
1
+ import { a as _asyncToGenerator, r as regenerator } from './asyncToGenerator-acd1cc47.js';
2
+ import { _ as _extends, a as _Object$assign } from './extends-c2b1c9d7.js';
3
+ import React from 'react';
4
+ import { useRouter } from 'next/router';
5
+ import Head from 'next/head';
6
+ import { B as BlockContent } from './BlockContent-d8cd739c.js';
7
+ import { g as getSerializers } from './index-b2d06f45.js';
8
+ import './_commonjsHelpers-0c4b6f40.js';
9
+ import './es6.string.iterator-b24a54f2.js';
10
+ import './_to-object-9bef3b62.js';
11
+ import './web.dom.iterable-ca37144a.js';
12
+ import './_library-528f1934.js';
13
+ import './core.get-iterator-method-1b116089.js';
14
+ import './_set-species-0b056cff.js';
15
+ import './_iter-detect-d4d262ee.js';
16
+ import './_object-pie-71ac75a4.js';
17
+ import 'prop-types';
18
+ import './index-3f5c03b2.js';
19
+ import './slicedToArray-34468155.js';
20
+ import 'react-bootstrap';
21
+ import './index-669ff425.js';
22
+ import './smoothscroll-ab6e0238.js';
23
+ import './util-3ab476bf.js';
24
+ import './Beam.js';
25
+ import './stringify-8a4f19f7.js';
26
+ import './Segment.js';
27
+ import './main-ad1ecb54.js';
28
+ import './index-752d1dae.js';
29
+ import 'react-dom';
30
+ import './typeof-64422756.js';
31
+ import './_is-array-9383b394.js';
32
+ import './brightcove-react-player-loader.es-b43c695a.js';
33
+ import './GroupDeck.js';
34
+ import './moment-bc12cb97.js';
35
+ import './toConsumableArray-5212fee7.js';
36
+ import 'react-bootstrap/Pagination';
37
+ import 'react-bootstrap/Button';
38
+ import './entities-932b50cf.js';
39
+ import './AdSlot.js';
40
+ import './debounce-1a993acf.js';
41
+ import './isSymbol-807e927e.js';
42
+ import 'react-bootstrap/Row';
43
+ import 'react-bootstrap/Col';
44
+ import './inherits-18d4a779.js';
45
+ import './_object-sap-6a003379.js';
46
+ import './define-property-9a008401.js';
47
+ import './index.esm-3fdda599.js';
48
+ import './iconBase-602d52fe.js';
49
+ import 'react-bootstrap/Figure';
50
+
51
+ var _this = undefined;
52
+
53
+ var blocksToText = function blocksToText(blocks) {
54
+ var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
55
+
56
+ var defaults = { nonTextBehavior: 'remove' };
57
+ var options = _Object$assign({}, defaults, opts);
58
+ return blocks.map(function (block) {
59
+ if (block._type !== 'block' || !block.children) {
60
+ return options.nonTextBehavior === 'remove' ? '' : '[' + block._type + ' block]';
61
+ }
62
+ return block.children.map(function (child) {
63
+ return child.text;
64
+ }).join('');
65
+ }).join('\n\n');
66
+ };
67
+
68
+ var setMetaDescription = function setMetaDescription(data, router) {
69
+ var metaDescription = blocksToText(data);
70
+ if (router && router.asPath) {
71
+ var queryParms = router.asPath.split('?')[1];
72
+ if (queryParms) {
73
+ var pageNumber = queryParms.split('&').reduce(function (acc, item) {
74
+ if (item.startsWith('page=')) {
75
+ if (item.split('=')[1]) {
76
+ acc = item.split('=')[1];
77
+ return acc;
78
+ }
79
+ return acc;
80
+ }
81
+ return acc;
82
+ }, '');
83
+ if (pageNumber && pageNumber !== '') {
84
+ metaDescription = blocksToText(data) + '| Page ' + pageNumber;
85
+ }
86
+ }
87
+ }
88
+ return React.createElement(
89
+ Head,
90
+ null,
91
+ React.createElement('meta', { name: 'description', content: metaDescription, key: 'description' })
92
+ );
93
+ };
94
+
95
+ var TaxonomyDescription = function TaxonomyDescription(_ref) {
96
+ var data = _ref.data,
97
+ client = _ref.client;
98
+
99
+ var router = useRouter();
100
+ return data && data.length > 0 && React.createElement(
101
+ 'section',
102
+ { className: 'taxonomy-description' },
103
+ setMetaDescription(data, router),
104
+ React.createElement(BlockContent, _extends({ serializers: getSerializers(client), blocks: data, imageOptions: { w: 320, h: 240, fit: 'max' } }, client.config()))
105
+ );
106
+ };
107
+
108
+ TaxonomyDescription.getDescription = function () {
109
+ var _ref2 = _asyncToGenerator( /*#__PURE__*/regenerator.mark(function _callee() {
110
+ var url = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
111
+ var client = arguments[1];
112
+ var query, summary;
113
+ return regenerator.wrap(function _callee$(_context) {
114
+ while (1) {
115
+ switch (_context.prev = _context.next) {
116
+ case 0:
117
+ query = '*[_type == \'taxonomy\' && identifier == \'' + url + '\'][0].summary';
118
+ summary = [];
119
+ _context.prev = 2;
120
+ _context.next = 5;
121
+ return client.fetch(query);
122
+
123
+ case 5:
124
+ summary = _context.sent;
125
+ _context.next = 11;
126
+ break;
127
+
128
+ case 8:
129
+ _context.prev = 8;
130
+ _context.t0 = _context['catch'](2);
131
+
132
+ console.error(_context.t0);
133
+
134
+ case 11:
135
+ return _context.abrupt('return', summary);
136
+
137
+ case 12:
138
+ case 'end':
139
+ return _context.stop();
140
+ }
141
+ }
142
+ }, _callee, _this, [[2, 8]]);
143
+ }));
144
+
145
+ return function () {
146
+ return _ref2.apply(this, arguments);
147
+ };
148
+ }();
149
+
150
+ export default TaxonomyDescription;
@@ -12,7 +12,7 @@ var getQuery = function getQuery(type) {
12
12
  case 'article':
13
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 issueGroup-> { _id, name, identifier, parent-> },\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 _id,\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
- 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 }';
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 taxonomyMapping[]->,\n pdf{asset->}\n } | order(year desc, month desc)\n }';
16
16
  case 'issue':
17
17
  return '*[_type == \'publication\'\n && identifier.current == $publication\n ' + conditions + '][0] {\n ' + params + '\n ...,\n \'issue\': *[_type == \'publication\'\n && references(^._id)\n && identifier.current == $issue][0] {\n ...,\n \'articles\': *[_type == \'article\'\n && !(_id in path("drafts.**"))\n && defined(title)\n && is_visible\n && defined(url)\n && defined(published) \n && dateTime(published) <= dateTime(now())\n && passwordLock != true\n && references(^._id)] | order(published desc) {\n ...,\n authorMapping[0]->,\n contentCategory->,\n issueSection-> {\n name\n }\n }\n }\n }';
18
18
  case 'externalResources':
package/dist/esm/index.js CHANGED
@@ -61,6 +61,7 @@ export { default as PopUpModal } from './PopUpModal.js';
61
61
  export { default as RelatedContent } from './RelatedContent.js';
62
62
  export { default as SocialIcons } from './SocialIcons.js';
63
63
  export { default as ArticleCarousel } from './ArticleCarousel.js';
64
+ export { default as TaxonomyDescription } from './TaxonomyDescription.js';
64
65
  export { default as ForbesHero } from './ForbesHero.js';
65
66
  export { default as HorizontalHero } from './HorizontalHero.js';
66
67
  export { default as OncliveHero } from './OncliveHero.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mjhls/mjh-framework",
3
- "version": "1.0.704",
3
+ "version": "1.0.706",
4
4
  "description": "Foundation Framework",
5
5
  "author": "mjh-framework",
6
6
  "license": "MIT",