@mjhls/mjh-framework 1.0.699 → 1.0.701

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.
@@ -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 \'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 }';
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 _id,\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 _id,\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 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 }';
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
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':
@@ -426,28 +426,33 @@ var dist_3 = dist.parseCookies;
426
426
  var _this = undefined;
427
427
 
428
428
  var getRelatedArticle = function () {
429
- var _ref2 = asyncToGenerator._asyncToGenerator( /*#__PURE__*/asyncToGenerator.regenerator.mark(function _callee() {
429
+ var _ref = asyncToGenerator._asyncToGenerator( /*#__PURE__*/asyncToGenerator.regenerator.mark(function _callee() {
430
430
  var ctx = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;
431
431
  var client = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
432
432
  var article = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
433
433
  var prevUrl = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : '/';
434
434
  var articleCount = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 0;
435
435
 
436
- var taxonomyMapping, _article$url, url, content_placement, taxonomy, params, conditions, cookies, prevSlugs, relatedArticleQuery, relatedArticle;
436
+ var _article$url, url, documentGroupMapping, issueGroup, content_placement, references, params, articles, filters, cookies, prevSlugs, query;
437
437
 
438
438
  return asyncToGenerator.regenerator.wrap(function _callee$(_context) {
439
439
  while (1) {
440
440
  switch (_context.prev = _context.next) {
441
441
  case 0:
442
- taxonomyMapping = article.taxonomyMapping, _article$url = article.url;
442
+ _article$url = article.url;
443
443
  _article$url = _article$url === undefined ? {
444
444
  current: null
445
445
  } : _article$url;
446
- url = _article$url.current, content_placement = article.content_placement;
447
- taxonomy = [];
448
- //404 articles were throwing server error
446
+ url = _article$url.current, documentGroupMapping = article.documentGroupMapping, issueGroup = article.issueGroup;
447
+ content_placement = article.content_placement;
448
+ references = [];
449
449
 
450
- if (content_placement) {
450
+
451
+ content_placement = content_placement && content_placement.length > 0 && content_placement.filter(function (_ref2) {
452
+ var identifier = _ref2.identifier;
453
+ return identifier !== 'news';
454
+ });
455
+ if (content_placement && content_placement.length > 0) {
451
456
  content_placement.forEach(function (_ref3) {
452
457
  var path = _ref3.path,
453
458
  _id = _ref3._id;
@@ -459,27 +464,39 @@ var getRelatedArticle = function () {
459
464
  if (prev_url_to_check.includes('?')) {
460
465
  prev_url_to_check = prev_url_to_check.split('?')[0];
461
466
  }
462
- if (prev_url_to_check.endsWith(path) && _id) taxonomy.push(_id);
467
+ if (prev_url_to_check.endsWith(path) && _id) references.push(_id);
463
468
  });
469
+ if (references.length === 0) {
470
+ content_placement.forEach(function (_ref4) {
471
+ var _id = _ref4._id;
472
+
473
+ if (_id) references.push(_id);
474
+ });
475
+ }
464
476
  }
465
477
 
466
- //404 articles were throwing server error
467
- if (taxonomy.length === 0 && taxonomyMapping) {
468
- taxonomyMapping.forEach(function (_ref4) {
469
- var _ref = _ref4._ref;
478
+ if (documentGroupMapping && documentGroupMapping.length > 0) {
479
+ documentGroupMapping.forEach(function (_ref5) {
480
+ var _id = _ref5._id;
470
481
 
471
- if (_ref) {
472
- taxonomy.push(_ref);
473
- }
482
+ if (_id) references.push(_id);
474
483
  });
475
484
  }
476
485
 
477
- params = {
478
- url: url,
479
- taxonomy: taxonomy,
480
- index: articleCount
481
- };
482
- conditions = '';
486
+ if (issueGroup && issueGroup._id) {
487
+ references.push(issueGroup._id);
488
+ }
489
+
490
+ params = { url: url, index: articleCount };
491
+ articles = null;
492
+
493
+ if (!(references && references.length > 0)) {
494
+ _context.next = 24;
495
+ break;
496
+ }
497
+
498
+ filters = '&& references("' + references.join('","') + '") ';
499
+
483
500
 
484
501
  if (ctx && url) {
485
502
  cookies = dist_3(ctx);
@@ -487,27 +504,39 @@ var getRelatedArticle = function () {
487
504
 
488
505
  if (!!prevSlugs) {
489
506
  dist_2(ctx, 'prevSlugs', prevSlugs + ',"' + url + '"', {});
490
- conditions = '&& !(url.current in [' + prevSlugs + '])';
507
+ filters = '&& !(url.current in [' + prevSlugs + '])';
491
508
  } else dist_2(ctx, 'prevSlugs', '"' + url + '"', {});
492
509
  }
493
- relatedArticleQuery = getQuery('related', conditions, '', articleCount);
494
- _context.next = 12;
495
- return client.fetch(relatedArticleQuery, params);
496
510
 
497
- case 12:
498
- relatedArticle = _context.sent;
499
- return _context.abrupt('return', relatedArticle);
511
+ query = getQuery('related', filters, '', articleCount).replace('&& taxonomyMapping[]._ref in $taxonomy', '');
512
+ _context.prev = 15;
513
+ _context.next = 18;
514
+ return client.fetch(query, params);
515
+
516
+ case 18:
517
+ articles = _context.sent;
518
+ _context.next = 24;
519
+ break;
520
+
521
+ case 21:
522
+ _context.prev = 21;
523
+ _context.t0 = _context['catch'](15);
524
+
525
+ console.error(_context.t0);
526
+
527
+ case 24:
528
+ return _context.abrupt('return', articles);
500
529
 
501
- case 14:
530
+ case 25:
502
531
  case 'end':
503
532
  return _context.stop();
504
533
  }
505
534
  }
506
- }, _callee, _this);
535
+ }, _callee, _this, [[15, 21]]);
507
536
  }));
508
537
 
509
538
  return function getRelatedArticle() {
510
- return _ref2.apply(this, arguments);
539
+ return _ref.apply(this, arguments);
511
540
  };
512
541
  }();
513
542
 
@@ -19,7 +19,9 @@ import YoutubeGroup from './YoutubeGroup.js';
19
19
 
20
20
  function ArticleCarousel(props) {
21
21
  //Passed in array of articles to pass into YoutubeGroup
22
- var articles = props.articles;
22
+ var articles = props.articles,
23
+ vidHolderWidth = props.vidHolderWidth,
24
+ numOfTiles = props.numOfTiles;
23
25
 
24
26
  //Setup article.link URL
25
27
 
@@ -31,7 +33,7 @@ function ArticleCarousel(props) {
31
33
  return React__default.createElement(
32
34
  React__default.Fragment,
33
35
  null,
34
- articles ? React__default.createElement(YoutubeGroup, _extends({ key: 'articleCarousel-0', dataset: data }, props)) : React__default.createElement(
36
+ articles ? React__default.createElement(YoutubeGroup, _extends({ key: 'articleCarousel-0', vidHolderWidth: vidHolderWidth, numOfTiles: numOfTiles, dataset: data }, props)) : React__default.createElement(
35
37
  'p',
36
38
  null,
37
39
  'No Article Found.'
@@ -16,6 +16,8 @@ import './index-5f9f807a.js';
16
16
  import './slicedToArray-7021e5df.js';
17
17
  import './smoothscroll-4b699764.js';
18
18
  import './YoutubeGroup.js';
19
+ import './iconBase-602d52fe.js';
20
+ import { I as IoIosArrowForward } from './index.esm-29e48d38.js';
19
21
  import ArticleCarousel from './ArticleCarousel.js';
20
22
 
21
23
  function BrowseVideosListing(_ref) {
@@ -24,7 +26,11 @@ function BrowseVideosListing(_ref) {
24
26
  _ref$client = _ref.client,
25
27
  client = _ref$client === undefined ? null : _ref$client,
26
28
  _ref$color = _ref.color,
27
- color = _ref$color === undefined ? '#FFFFFF' : _ref$color;
29
+ color = _ref$color === undefined ? '#FFFFFF' : _ref$color,
30
+ _ref$numOfTiles = _ref.numOfTiles,
31
+ numOfTiles = _ref$numOfTiles === undefined ? [3, 2, 1] : _ref$numOfTiles,
32
+ _ref$vidHolderWidth = _ref.vidHolderWidth,
33
+ vidHolderWidth = _ref$vidHolderWidth === undefined ? '805px' : _ref$vidHolderWidth;
28
34
 
29
35
  // Look at AJMC for query setup
30
36
  // Data format = Array of Objects based on Taxonomies with videos and latest videos
@@ -36,35 +42,73 @@ function BrowseVideosListing(_ref) {
36
42
  return React__default.createElement(
37
43
  'div',
38
44
  null,
39
- data && data.map(function (taxonomy, index) {
45
+ data.length > 0 ? data.map(function (taxonomy, index) {
40
46
  return React__default.createElement(
41
- 'div',
42
- { key: 'articleCarousel_' + taxonomy.identifier + '_' + index, className: 'mb-5' },
47
+ React__default.Fragment,
48
+ null,
43
49
  React__default.createElement(
44
50
  'div',
45
- { style: { borderBottom: '3px solid ' + color } },
51
+ { key: 'articleCarousel_' + taxonomy.identifier + '_' + index, className: 'mb-3 browse-videos' },
46
52
  React__default.createElement(
47
- 'h3',
48
- { style: { color: color, marginBottom: '.25rem' } },
49
- taxonomy.name
50
- ),
51
- taxonomy.identifier && React__default.createElement(
52
- 'p',
53
- { style: { width: 'fit-content', marginBottom: '.25rem' } },
53
+ 'div',
54
+ { className: 'browse-videos-header', style: { borderBottom: '2px solid ' + color } },
54
55
  React__default.createElement(
55
56
  'a',
56
57
  { href: '/' + taxonomy.identifier },
57
- 'View All >'
58
+ React__default.createElement(
59
+ 'h4',
60
+ { className: 'article-title-banner', style: { fontWeight: 'bold', color: 'var(--primary)', padding: '.25rem 0', margin: '0' } },
61
+ taxonomy.name
62
+ )
63
+ ),
64
+ taxonomy.identifier && React__default.createElement(
65
+ 'div',
66
+ { style: { width: 'fit-content', whiteSpace: 'nowrap' } },
67
+ React__default.createElement(
68
+ 'a',
69
+ { href: '/' + taxonomy.identifier },
70
+ 'View All ',
71
+ React__default.createElement(IoIosArrowForward, null)
72
+ )
73
+ )
74
+ ),
75
+ taxonomy.data.length > 0 ? React__default.createElement(
76
+ 'div',
77
+ { className: 'article-carousel' },
78
+ React__default.createElement(ArticleCarousel, { articles: taxonomy.data, client: client, numOfTiles: numOfTiles, vidHolderWidth: vidHolderWidth })
79
+ ) : React__default.createElement(
80
+ 'div',
81
+ null,
82
+ React__default.createElement(
83
+ 'h5',
84
+ { className: 'mt-2' },
85
+ React__default.createElement(
86
+ 'em',
87
+ { className: 'pl-3' },
88
+ 'New content coming soon, please check back later.'
89
+ )
58
90
  )
59
91
  )
60
92
  ),
61
- taxonomy.data && React__default.createElement(
62
- 'div',
63
- null,
64
- React__default.createElement(ArticleCarousel, { articles: taxonomy.data, client: client })
93
+ React__default.createElement(
94
+ 'style',
95
+ { jsx: 'true' },
96
+ '\n .article-carousel {\n display: flex;\n align-items: center;\n justify-content: center;\n }\n .browse-videos-header {\n display: flex;\n flex-wrap: no-wrap;\n align-items: center;\n justify-content: space-between;\n }\n '
65
97
  )
66
98
  );
67
- })
99
+ }) : React__default.createElement(
100
+ 'div',
101
+ null,
102
+ React__default.createElement(
103
+ 'h5',
104
+ null,
105
+ React__default.createElement(
106
+ 'em',
107
+ { className: 'pl-3' },
108
+ 'New content coming soon, please check back later.'
109
+ )
110
+ )
111
+ )
68
112
  );
69
113
  }
70
114