@mjhls/mjh-framework 1.0.939-segment-test-v11 → 1.0.939-segment-test-v12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cjs/View.js CHANGED
@@ -507,7 +507,7 @@ var Recommended = function Recommended(props) {
507
507
  // get users traits
508
508
  var getSegmentProfile = function () {
509
509
  var _ref = asyncToGenerator._asyncToGenerator( /*#__PURE__*/asyncToGenerator.regenerator.mark(function _callee() {
510
- var anonymousId, response, data, addTaxonomyName, favoriteCategories, articlesQuery, videosQuery, podcastQuery, params, _ref2, _ref3, _articles, videos, podcasts;
510
+ var anonymousId, response, data, addTaxonomyName, favoriteCategories, articlesCategory, videosCategory, podcastCategory, taxonomyCategories, taxonomies, articlesQuery, videosQuery, podcastQuery, params, _ref2, _ref3, _articles, videos, podcasts;
511
511
 
512
512
  return asyncToGenerator.regenerator.wrap(function _callee$(_context) {
513
513
  while (1) {
@@ -529,7 +529,7 @@ var Recommended = function Recommended(props) {
529
529
  data = _context.sent;
530
530
 
531
531
  if (!(data && data.traits && data.traits.favorite_article_category)) {
532
- _context.next = 25;
532
+ _context.next = 40;
533
533
  break;
534
534
  }
535
535
 
@@ -552,18 +552,51 @@ var Recommended = function Recommended(props) {
552
552
  };
553
553
 
554
554
  favoriteCategories = JSON.parse(data.traits.favorite_article_category);
555
- // grab 3 articles from sanity different from the one currently being read
556
555
 
557
- articlesQuery = '*[_type == \'article\'\n && !(_id in path("drafts.**"))\n && defined(title)\n && defined(url)\n && is_visible == true \n && passwordLock != true\n && references(*[_type == \'contentCategory\' && name == \'Articles\']._id)\n && references(*[_type == \'taxonomy\' ' + addTaxonomyName(favoriteCategories) + ']._id)\n && defined(published)\n && _id != $id\n && dateTime(published) <= dateTime(now())] | order(published desc) [' + starting + '...' + (starting + 5) + '] {\n ...,\n title,\n thumbnail,\n url,\n contentCategory->,\n published,\n }';
558
- videosQuery = '*[_type == \'article\'\n && !(_id in path("drafts.**"))\n && defined(title)\n && defined(url)\n && is_visible == true \n && passwordLock != true\n && references(*[_type == \'contentCategory\' && name == \'Videos\']._id)\n && references(*[_type == \'taxonomy\' ' + addTaxonomyName(favoriteCategories) + ' ]._id)\n && defined(published)\n && _id != $id\n && dateTime(published) <= dateTime(now())] | order(published desc) [' + starting + '...' + (starting + 1) + '] {\n ...,\n title,\n thumbnail,\n url,\n contentCategory->,\n published,\n }';
559
- podcastQuery = '*[_type == \'article\'\n && !(_id in path("drafts.**"))\n && defined(title)\n && defined(url)\n && is_visible == true \n && passwordLock != true\n && references(*[_type == \'contentCategory\' && name == \'Podcasts\']._id)\n && references(*[_type == \'taxonomy\' ' + addTaxonomyName(favoriteCategories) + ']._id)\n && defined(published)\n && _id != $id\n && dateTime(published) <= dateTime(now())] | order(published desc) [' + starting + '...' + (starting + 2) + '] {\n ...,\n title,\n thumbnail,\n url,\n contentCategory->,\n published,\n }';
556
+ //grab contentCategory ID
557
+
558
+ _context.next = 12;
559
+ return client.fetch("*[_type == 'contentCategory' && name == 'Articles'][0]{_id}");
560
+
561
+ case 12:
562
+ articlesCategory = _context.sent;
563
+ _context.next = 15;
564
+ return client.fetch("*[_type == 'contentCategory' && name == 'Videos'][0]{_id}");
565
+
566
+ case 15:
567
+ videosCategory = _context.sent;
568
+ _context.next = 18;
569
+ return client.fetch("*[_type == 'contentCategory' && name == 'Podcasts'][0]{_id}");
570
+
571
+ case 18:
572
+ podcastCategory = _context.sent;
573
+ _context.next = 21;
574
+ return client.fetch('*[_type == \'taxonomy\' ' + addTaxonomyName(favoriteCategories) + ']');
575
+
576
+ case 21:
577
+ taxonomyCategories = _context.sent;
578
+ taxonomies = '';
579
+
580
+ taxonomyCategories.forEach(function (taxonomy, index) {
581
+ if (index === 0) {
582
+ taxonomies = taxonomies + (' && ( references(\'' + taxonomy._id + '\')');
583
+ } else {
584
+ taxonomies = taxonomies + (' || references(\'' + taxonomy._id + '\')');
585
+ }
586
+ });
587
+ taxonomies = taxonomies + ' )';
588
+
589
+ // grab 3 articles from sanity different from the one currently being read
590
+ articlesQuery = '*[_type == \'article\'\n && !(_id in path("drafts.**"))\n && defined(title)\n && defined(url)\n && is_visible == true \n && passwordLock != true\n && references(\'' + articlesCategory._id + '\')\n ' + taxonomies + '\n && defined(published)\n && _id != $id\n && dateTime(published) <= dateTime(now())] | order(published desc) [' + starting + '...' + (starting + 5) + '] {\n ...,\n title,\n thumbnail,\n url,\n contentCategory->,\n published,\n }';
591
+ videosQuery = '*[_type == \'article\'\n && !(_id in path("drafts.**"))\n && defined(title)\n && defined(url)\n && is_visible == true \n && passwordLock != true\n && references(\'' + videosCategory._id + '\')\n ' + taxonomies + '\n && defined(published)\n && _id != $id\n && dateTime(published) <= dateTime(now())] | order(published desc) [' + starting + '...' + (starting + 1) + '] {\n ...,\n title,\n thumbnail,\n url,\n contentCategory->,\n published,\n }';
592
+ podcastQuery = '*[_type == \'article\'\n && !(_id in path("drafts.**"))\n && defined(title)\n && defined(url)\n && is_visible == true \n && passwordLock != true\n && references(\'' + podcastCategory._id + '\')\n ' + taxonomies + '\n && defined(published)\n && _id != $id\n && dateTime(published) <= dateTime(now())] | order(published desc) [' + starting + '...' + (starting + 2) + '] {\n ...,\n title,\n thumbnail,\n url,\n contentCategory->,\n published,\n }';
560
593
  params = {
561
594
  id: article._id
562
595
  };
563
- _context.next = 16;
596
+ _context.next = 31;
564
597
  return asyncToGenerator._Promise.all([client.fetch(articlesQuery, params), client.fetch(videosQuery, params), client.fetch(podcastQuery, params)]);
565
598
 
566
- case 16:
599
+ case 31:
567
600
  _ref2 = _context.sent;
568
601
  _ref3 = slicedToArray._slicedToArray(_ref2, 3);
569
602
  _articles = _ref3[0];
@@ -583,13 +616,13 @@ var Recommended = function Recommended(props) {
583
616
  }
584
617
  setArticles(_articles);
585
618
  }
586
- _context.next = 26;
619
+ _context.next = 41;
587
620
  break;
588
621
 
589
- case 25:
622
+ case 40:
590
623
  setLoaded('failed');
591
624
 
592
- case 26:
625
+ case 41:
593
626
  case 'end':
594
627
  return _context.stop();
595
628
  }
package/dist/esm/View.js CHANGED
@@ -496,7 +496,7 @@ var Recommended = function Recommended(props) {
496
496
  // get users traits
497
497
  var getSegmentProfile = function () {
498
498
  var _ref = _asyncToGenerator( /*#__PURE__*/regenerator.mark(function _callee() {
499
- var anonymousId, response, data, addTaxonomyName, favoriteCategories, articlesQuery, videosQuery, podcastQuery, params, _ref2, _ref3, _articles, videos, podcasts;
499
+ var anonymousId, response, data, addTaxonomyName, favoriteCategories, articlesCategory, videosCategory, podcastCategory, taxonomyCategories, taxonomies, articlesQuery, videosQuery, podcastQuery, params, _ref2, _ref3, _articles, videos, podcasts;
500
500
 
501
501
  return regenerator.wrap(function _callee$(_context) {
502
502
  while (1) {
@@ -518,7 +518,7 @@ var Recommended = function Recommended(props) {
518
518
  data = _context.sent;
519
519
 
520
520
  if (!(data && data.traits && data.traits.favorite_article_category)) {
521
- _context.next = 25;
521
+ _context.next = 40;
522
522
  break;
523
523
  }
524
524
 
@@ -541,18 +541,51 @@ var Recommended = function Recommended(props) {
541
541
  };
542
542
 
543
543
  favoriteCategories = JSON.parse(data.traits.favorite_article_category);
544
- // grab 3 articles from sanity different from the one currently being read
545
544
 
546
- articlesQuery = '*[_type == \'article\'\n && !(_id in path("drafts.**"))\n && defined(title)\n && defined(url)\n && is_visible == true \n && passwordLock != true\n && references(*[_type == \'contentCategory\' && name == \'Articles\']._id)\n && references(*[_type == \'taxonomy\' ' + addTaxonomyName(favoriteCategories) + ']._id)\n && defined(published)\n && _id != $id\n && dateTime(published) <= dateTime(now())] | order(published desc) [' + starting + '...' + (starting + 5) + '] {\n ...,\n title,\n thumbnail,\n url,\n contentCategory->,\n published,\n }';
547
- videosQuery = '*[_type == \'article\'\n && !(_id in path("drafts.**"))\n && defined(title)\n && defined(url)\n && is_visible == true \n && passwordLock != true\n && references(*[_type == \'contentCategory\' && name == \'Videos\']._id)\n && references(*[_type == \'taxonomy\' ' + addTaxonomyName(favoriteCategories) + ' ]._id)\n && defined(published)\n && _id != $id\n && dateTime(published) <= dateTime(now())] | order(published desc) [' + starting + '...' + (starting + 1) + '] {\n ...,\n title,\n thumbnail,\n url,\n contentCategory->,\n published,\n }';
548
- podcastQuery = '*[_type == \'article\'\n && !(_id in path("drafts.**"))\n && defined(title)\n && defined(url)\n && is_visible == true \n && passwordLock != true\n && references(*[_type == \'contentCategory\' && name == \'Podcasts\']._id)\n && references(*[_type == \'taxonomy\' ' + addTaxonomyName(favoriteCategories) + ']._id)\n && defined(published)\n && _id != $id\n && dateTime(published) <= dateTime(now())] | order(published desc) [' + starting + '...' + (starting + 2) + '] {\n ...,\n title,\n thumbnail,\n url,\n contentCategory->,\n published,\n }';
545
+ //grab contentCategory ID
546
+
547
+ _context.next = 12;
548
+ return client.fetch("*[_type == 'contentCategory' && name == 'Articles'][0]{_id}");
549
+
550
+ case 12:
551
+ articlesCategory = _context.sent;
552
+ _context.next = 15;
553
+ return client.fetch("*[_type == 'contentCategory' && name == 'Videos'][0]{_id}");
554
+
555
+ case 15:
556
+ videosCategory = _context.sent;
557
+ _context.next = 18;
558
+ return client.fetch("*[_type == 'contentCategory' && name == 'Podcasts'][0]{_id}");
559
+
560
+ case 18:
561
+ podcastCategory = _context.sent;
562
+ _context.next = 21;
563
+ return client.fetch('*[_type == \'taxonomy\' ' + addTaxonomyName(favoriteCategories) + ']');
564
+
565
+ case 21:
566
+ taxonomyCategories = _context.sent;
567
+ taxonomies = '';
568
+
569
+ taxonomyCategories.forEach(function (taxonomy, index) {
570
+ if (index === 0) {
571
+ taxonomies = taxonomies + (' && ( references(\'' + taxonomy._id + '\')');
572
+ } else {
573
+ taxonomies = taxonomies + (' || references(\'' + taxonomy._id + '\')');
574
+ }
575
+ });
576
+ taxonomies = taxonomies + ' )';
577
+
578
+ // grab 3 articles from sanity different from the one currently being read
579
+ articlesQuery = '*[_type == \'article\'\n && !(_id in path("drafts.**"))\n && defined(title)\n && defined(url)\n && is_visible == true \n && passwordLock != true\n && references(\'' + articlesCategory._id + '\')\n ' + taxonomies + '\n && defined(published)\n && _id != $id\n && dateTime(published) <= dateTime(now())] | order(published desc) [' + starting + '...' + (starting + 5) + '] {\n ...,\n title,\n thumbnail,\n url,\n contentCategory->,\n published,\n }';
580
+ videosQuery = '*[_type == \'article\'\n && !(_id in path("drafts.**"))\n && defined(title)\n && defined(url)\n && is_visible == true \n && passwordLock != true\n && references(\'' + videosCategory._id + '\')\n ' + taxonomies + '\n && defined(published)\n && _id != $id\n && dateTime(published) <= dateTime(now())] | order(published desc) [' + starting + '...' + (starting + 1) + '] {\n ...,\n title,\n thumbnail,\n url,\n contentCategory->,\n published,\n }';
581
+ podcastQuery = '*[_type == \'article\'\n && !(_id in path("drafts.**"))\n && defined(title)\n && defined(url)\n && is_visible == true \n && passwordLock != true\n && references(\'' + podcastCategory._id + '\')\n ' + taxonomies + '\n && defined(published)\n && _id != $id\n && dateTime(published) <= dateTime(now())] | order(published desc) [' + starting + '...' + (starting + 2) + '] {\n ...,\n title,\n thumbnail,\n url,\n contentCategory->,\n published,\n }';
549
582
  params = {
550
583
  id: article._id
551
584
  };
552
- _context.next = 16;
585
+ _context.next = 31;
553
586
  return _Promise.all([client.fetch(articlesQuery, params), client.fetch(videosQuery, params), client.fetch(podcastQuery, params)]);
554
587
 
555
- case 16:
588
+ case 31:
556
589
  _ref2 = _context.sent;
557
590
  _ref3 = _slicedToArray(_ref2, 3);
558
591
  _articles = _ref3[0];
@@ -572,13 +605,13 @@ var Recommended = function Recommended(props) {
572
605
  }
573
606
  setArticles(_articles);
574
607
  }
575
- _context.next = 26;
608
+ _context.next = 41;
576
609
  break;
577
610
 
578
- case 25:
611
+ case 40:
579
612
  setLoaded('failed');
580
613
 
581
- case 26:
614
+ case 41:
582
615
  case 'end':
583
616
  return _context.stop();
584
617
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mjhls/mjh-framework",
3
- "version": "1.0.939-segment-test-v11",
3
+ "version": "1.0.939-segment-test-v12",
4
4
  "description": "Foundation Framework",
5
5
  "author": "mjh-framework",
6
6
  "license": "MIT",