@mjhls/mjh-framework 1.0.974-test4 → 1.0.974-test5
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 +33 -41
- package/dist/esm/View.js +33 -41
- package/package.json +1 -1
package/dist/cjs/View.js
CHANGED
|
@@ -495,8 +495,8 @@ var Recommended = function Recommended(props) {
|
|
|
495
495
|
|
|
496
496
|
var _useState7 = React.useState(''),
|
|
497
497
|
_useState8 = slicedToArray._slicedToArray(_useState7, 2),
|
|
498
|
-
anonId = _useState8[0]
|
|
499
|
-
|
|
498
|
+
anonId = _useState8[0];
|
|
499
|
+
_useState8[1];
|
|
500
500
|
|
|
501
501
|
var starting = index * 5;
|
|
502
502
|
var contentMapping = {
|
|
@@ -509,10 +509,7 @@ var Recommended = function Recommended(props) {
|
|
|
509
509
|
}).map(function (cp) {
|
|
510
510
|
return cp.name;
|
|
511
511
|
}).sort();
|
|
512
|
-
|
|
513
|
-
var id = analytics.user().anonymousId();
|
|
514
|
-
setAnonId(id);
|
|
515
|
-
}, []);
|
|
512
|
+
|
|
516
513
|
React.useEffect(function () {
|
|
517
514
|
try {
|
|
518
515
|
if (!segmentLoaded) {
|
|
@@ -571,38 +568,35 @@ var Recommended = function Recommended(props) {
|
|
|
571
568
|
// get users traits
|
|
572
569
|
var getSegmentProfile = function () {
|
|
573
570
|
var _ref2 = asyncToGenerator._asyncToGenerator( /*#__PURE__*/asyncToGenerator.regenerator.mark(function _callee2() {
|
|
574
|
-
var storedUsers, traits, traitData, response, data, addTaxonomyName, favoriteCategories, articlesCategory, videosCategory, podcastCategory, taxonomyCategories, taxonomies, articlesQuery, videosQuery, podcastQuery, params, _ref3, _ref4, _articles, videos, podcasts;
|
|
571
|
+
var storedUsers, anonymousId, traits, traitData, response, data, addTaxonomyName, favoriteCategories, articlesCategory, videosCategory, podcastCategory, taxonomyCategories, taxonomies, articlesQuery, videosQuery, podcastQuery, params, _ref3, _ref4, _articles, videos, podcasts;
|
|
575
572
|
|
|
576
573
|
return asyncToGenerator.regenerator.wrap(function _callee2$(_context2) {
|
|
577
574
|
while (1) {
|
|
578
575
|
switch (_context2.prev = _context2.next) {
|
|
579
576
|
case 0:
|
|
580
577
|
storedUsers = false;
|
|
578
|
+
anonymousId = analytics.user().anonymousId();
|
|
581
579
|
|
|
582
|
-
|
|
583
|
-
// console.log('anonymousId', anonymousId)
|
|
584
|
-
|
|
585
|
-
console.log('anonId', anonId);
|
|
580
|
+
console.log('anonymousId', anonymousId);
|
|
586
581
|
|
|
587
|
-
_context2.next =
|
|
582
|
+
_context2.next = 5;
|
|
588
583
|
return fetch('/api/getTraits', {
|
|
589
584
|
method: 'POST',
|
|
590
|
-
|
|
591
|
-
body: stringify._JSON$stringify({ anonymousId: anonId })
|
|
585
|
+
body: stringify._JSON$stringify({ anonymousId: anonymousId })
|
|
592
586
|
});
|
|
593
587
|
|
|
594
|
-
case
|
|
588
|
+
case 5:
|
|
595
589
|
traits = _context2.sent;
|
|
596
|
-
_context2.next =
|
|
590
|
+
_context2.next = 8;
|
|
597
591
|
return traits.json();
|
|
598
592
|
|
|
599
|
-
case
|
|
593
|
+
case 8:
|
|
600
594
|
traitData = _context2.sent;
|
|
601
595
|
|
|
602
596
|
console.log('persona result:', traitData);
|
|
603
597
|
|
|
604
598
|
if (!(traitData.traits && traitData.traits.groupId)) {
|
|
605
|
-
_context2.next =
|
|
599
|
+
_context2.next = 14;
|
|
606
600
|
break;
|
|
607
601
|
}
|
|
608
602
|
|
|
@@ -611,28 +605,26 @@ var Recommended = function Recommended(props) {
|
|
|
611
605
|
} catch (e) {
|
|
612
606
|
if (e) console.log('Error: ' + e);
|
|
613
607
|
}
|
|
614
|
-
_context2.next =
|
|
608
|
+
_context2.next = 55;
|
|
615
609
|
break;
|
|
616
610
|
|
|
617
|
-
case
|
|
618
|
-
_context2.next =
|
|
611
|
+
case 14:
|
|
612
|
+
_context2.next = 16;
|
|
619
613
|
return fetch('/api/getSegmentProfile', {
|
|
620
614
|
method: 'POST',
|
|
621
|
-
|
|
622
|
-
body: stringify._JSON$stringify({ anonymousId: anonId })
|
|
623
|
-
|
|
615
|
+
body: stringify._JSON$stringify({ anonymousId: anonymousId })
|
|
624
616
|
});
|
|
625
617
|
|
|
626
|
-
case
|
|
618
|
+
case 16:
|
|
627
619
|
response = _context2.sent;
|
|
628
|
-
_context2.next =
|
|
620
|
+
_context2.next = 19;
|
|
629
621
|
return response.json();
|
|
630
622
|
|
|
631
|
-
case
|
|
623
|
+
case 19:
|
|
632
624
|
data = _context2.sent;
|
|
633
625
|
|
|
634
626
|
if (!(data && data.traits && data.traits.most_frequent_category)) {
|
|
635
|
-
_context2.next =
|
|
627
|
+
_context2.next = 54;
|
|
636
628
|
break;
|
|
637
629
|
}
|
|
638
630
|
|
|
@@ -658,25 +650,25 @@ var Recommended = function Recommended(props) {
|
|
|
658
650
|
|
|
659
651
|
// grab contentCategory ID
|
|
660
652
|
|
|
661
|
-
_context2.next =
|
|
653
|
+
_context2.next = 26;
|
|
662
654
|
return client.fetch("*[_type == 'contentCategory' && name == 'Articles'][0]{_id}");
|
|
663
655
|
|
|
664
|
-
case
|
|
656
|
+
case 26:
|
|
665
657
|
articlesCategory = _context2.sent;
|
|
666
|
-
_context2.next =
|
|
658
|
+
_context2.next = 29;
|
|
667
659
|
return client.fetch("*[_type == 'contentCategory' && name == 'Videos'][0]{_id}");
|
|
668
660
|
|
|
669
|
-
case
|
|
661
|
+
case 29:
|
|
670
662
|
videosCategory = _context2.sent;
|
|
671
|
-
_context2.next =
|
|
663
|
+
_context2.next = 32;
|
|
672
664
|
return client.fetch("*[_type == 'contentCategory' && name == 'Podcasts'][0]{_id}");
|
|
673
665
|
|
|
674
|
-
case
|
|
666
|
+
case 32:
|
|
675
667
|
podcastCategory = _context2.sent;
|
|
676
|
-
_context2.next =
|
|
668
|
+
_context2.next = 35;
|
|
677
669
|
return client.fetch('*[_type == \'taxonomy\' ' + addTaxonomyName(favoriteCategories) + ']');
|
|
678
670
|
|
|
679
|
-
case
|
|
671
|
+
case 35:
|
|
680
672
|
taxonomyCategories = _context2.sent;
|
|
681
673
|
taxonomies = '';
|
|
682
674
|
|
|
@@ -696,10 +688,10 @@ var Recommended = function Recommended(props) {
|
|
|
696
688
|
params = {
|
|
697
689
|
id: article._id
|
|
698
690
|
};
|
|
699
|
-
_context2.next =
|
|
691
|
+
_context2.next = 45;
|
|
700
692
|
return asyncToGenerator._Promise.all([client.fetch(articlesQuery, params), client.fetch(videosQuery, params), client.fetch(podcastQuery, params)]);
|
|
701
693
|
|
|
702
|
-
case
|
|
694
|
+
case 45:
|
|
703
695
|
_ref3 = _context2.sent;
|
|
704
696
|
_ref4 = slicedToArray._slicedToArray(_ref3, 3);
|
|
705
697
|
_articles = _ref4[0];
|
|
@@ -721,13 +713,13 @@ var Recommended = function Recommended(props) {
|
|
|
721
713
|
}
|
|
722
714
|
setArticles(_articles);
|
|
723
715
|
}
|
|
724
|
-
_context2.next =
|
|
716
|
+
_context2.next = 55;
|
|
725
717
|
break;
|
|
726
718
|
|
|
727
|
-
case
|
|
719
|
+
case 54:
|
|
728
720
|
setLoaded('failed');
|
|
729
721
|
|
|
730
|
-
case
|
|
722
|
+
case 55:
|
|
731
723
|
case 'end':
|
|
732
724
|
return _context2.stop();
|
|
733
725
|
}
|
package/dist/esm/View.js
CHANGED
|
@@ -485,8 +485,8 @@ var Recommended = function Recommended(props) {
|
|
|
485
485
|
|
|
486
486
|
var _useState7 = useState(''),
|
|
487
487
|
_useState8 = _slicedToArray(_useState7, 2),
|
|
488
|
-
anonId = _useState8[0]
|
|
489
|
-
|
|
488
|
+
anonId = _useState8[0];
|
|
489
|
+
_useState8[1];
|
|
490
490
|
|
|
491
491
|
var starting = index * 5;
|
|
492
492
|
var contentMapping = {
|
|
@@ -499,10 +499,7 @@ var Recommended = function Recommended(props) {
|
|
|
499
499
|
}).map(function (cp) {
|
|
500
500
|
return cp.name;
|
|
501
501
|
}).sort();
|
|
502
|
-
|
|
503
|
-
var id = analytics.user().anonymousId();
|
|
504
|
-
setAnonId(id);
|
|
505
|
-
}, []);
|
|
502
|
+
|
|
506
503
|
useEffect(function () {
|
|
507
504
|
try {
|
|
508
505
|
if (!segmentLoaded) {
|
|
@@ -561,38 +558,35 @@ var Recommended = function Recommended(props) {
|
|
|
561
558
|
// get users traits
|
|
562
559
|
var getSegmentProfile = function () {
|
|
563
560
|
var _ref2 = _asyncToGenerator( /*#__PURE__*/regenerator.mark(function _callee2() {
|
|
564
|
-
var storedUsers, traits, traitData, response, data, addTaxonomyName, favoriteCategories, articlesCategory, videosCategory, podcastCategory, taxonomyCategories, taxonomies, articlesQuery, videosQuery, podcastQuery, params, _ref3, _ref4, _articles, videos, podcasts;
|
|
561
|
+
var storedUsers, anonymousId, traits, traitData, response, data, addTaxonomyName, favoriteCategories, articlesCategory, videosCategory, podcastCategory, taxonomyCategories, taxonomies, articlesQuery, videosQuery, podcastQuery, params, _ref3, _ref4, _articles, videos, podcasts;
|
|
565
562
|
|
|
566
563
|
return regenerator.wrap(function _callee2$(_context2) {
|
|
567
564
|
while (1) {
|
|
568
565
|
switch (_context2.prev = _context2.next) {
|
|
569
566
|
case 0:
|
|
570
567
|
storedUsers = false;
|
|
568
|
+
anonymousId = analytics.user().anonymousId();
|
|
571
569
|
|
|
572
|
-
|
|
573
|
-
// console.log('anonymousId', anonymousId)
|
|
574
|
-
|
|
575
|
-
console.log('anonId', anonId);
|
|
570
|
+
console.log('anonymousId', anonymousId);
|
|
576
571
|
|
|
577
|
-
_context2.next =
|
|
572
|
+
_context2.next = 5;
|
|
578
573
|
return fetch('/api/getTraits', {
|
|
579
574
|
method: 'POST',
|
|
580
|
-
|
|
581
|
-
body: _JSON$stringify({ anonymousId: anonId })
|
|
575
|
+
body: _JSON$stringify({ anonymousId: anonymousId })
|
|
582
576
|
});
|
|
583
577
|
|
|
584
|
-
case
|
|
578
|
+
case 5:
|
|
585
579
|
traits = _context2.sent;
|
|
586
|
-
_context2.next =
|
|
580
|
+
_context2.next = 8;
|
|
587
581
|
return traits.json();
|
|
588
582
|
|
|
589
|
-
case
|
|
583
|
+
case 8:
|
|
590
584
|
traitData = _context2.sent;
|
|
591
585
|
|
|
592
586
|
console.log('persona result:', traitData);
|
|
593
587
|
|
|
594
588
|
if (!(traitData.traits && traitData.traits.groupId)) {
|
|
595
|
-
_context2.next =
|
|
589
|
+
_context2.next = 14;
|
|
596
590
|
break;
|
|
597
591
|
}
|
|
598
592
|
|
|
@@ -601,28 +595,26 @@ var Recommended = function Recommended(props) {
|
|
|
601
595
|
} catch (e) {
|
|
602
596
|
if (e) console.log('Error: ' + e);
|
|
603
597
|
}
|
|
604
|
-
_context2.next =
|
|
598
|
+
_context2.next = 55;
|
|
605
599
|
break;
|
|
606
600
|
|
|
607
|
-
case
|
|
608
|
-
_context2.next =
|
|
601
|
+
case 14:
|
|
602
|
+
_context2.next = 16;
|
|
609
603
|
return fetch('/api/getSegmentProfile', {
|
|
610
604
|
method: 'POST',
|
|
611
|
-
|
|
612
|
-
body: _JSON$stringify({ anonymousId: anonId })
|
|
613
|
-
|
|
605
|
+
body: _JSON$stringify({ anonymousId: anonymousId })
|
|
614
606
|
});
|
|
615
607
|
|
|
616
|
-
case
|
|
608
|
+
case 16:
|
|
617
609
|
response = _context2.sent;
|
|
618
|
-
_context2.next =
|
|
610
|
+
_context2.next = 19;
|
|
619
611
|
return response.json();
|
|
620
612
|
|
|
621
|
-
case
|
|
613
|
+
case 19:
|
|
622
614
|
data = _context2.sent;
|
|
623
615
|
|
|
624
616
|
if (!(data && data.traits && data.traits.most_frequent_category)) {
|
|
625
|
-
_context2.next =
|
|
617
|
+
_context2.next = 54;
|
|
626
618
|
break;
|
|
627
619
|
}
|
|
628
620
|
|
|
@@ -648,25 +640,25 @@ var Recommended = function Recommended(props) {
|
|
|
648
640
|
|
|
649
641
|
// grab contentCategory ID
|
|
650
642
|
|
|
651
|
-
_context2.next =
|
|
643
|
+
_context2.next = 26;
|
|
652
644
|
return client.fetch("*[_type == 'contentCategory' && name == 'Articles'][0]{_id}");
|
|
653
645
|
|
|
654
|
-
case
|
|
646
|
+
case 26:
|
|
655
647
|
articlesCategory = _context2.sent;
|
|
656
|
-
_context2.next =
|
|
648
|
+
_context2.next = 29;
|
|
657
649
|
return client.fetch("*[_type == 'contentCategory' && name == 'Videos'][0]{_id}");
|
|
658
650
|
|
|
659
|
-
case
|
|
651
|
+
case 29:
|
|
660
652
|
videosCategory = _context2.sent;
|
|
661
|
-
_context2.next =
|
|
653
|
+
_context2.next = 32;
|
|
662
654
|
return client.fetch("*[_type == 'contentCategory' && name == 'Podcasts'][0]{_id}");
|
|
663
655
|
|
|
664
|
-
case
|
|
656
|
+
case 32:
|
|
665
657
|
podcastCategory = _context2.sent;
|
|
666
|
-
_context2.next =
|
|
658
|
+
_context2.next = 35;
|
|
667
659
|
return client.fetch('*[_type == \'taxonomy\' ' + addTaxonomyName(favoriteCategories) + ']');
|
|
668
660
|
|
|
669
|
-
case
|
|
661
|
+
case 35:
|
|
670
662
|
taxonomyCategories = _context2.sent;
|
|
671
663
|
taxonomies = '';
|
|
672
664
|
|
|
@@ -686,10 +678,10 @@ var Recommended = function Recommended(props) {
|
|
|
686
678
|
params = {
|
|
687
679
|
id: article._id
|
|
688
680
|
};
|
|
689
|
-
_context2.next =
|
|
681
|
+
_context2.next = 45;
|
|
690
682
|
return _Promise.all([client.fetch(articlesQuery, params), client.fetch(videosQuery, params), client.fetch(podcastQuery, params)]);
|
|
691
683
|
|
|
692
|
-
case
|
|
684
|
+
case 45:
|
|
693
685
|
_ref3 = _context2.sent;
|
|
694
686
|
_ref4 = _slicedToArray(_ref3, 3);
|
|
695
687
|
_articles = _ref4[0];
|
|
@@ -711,13 +703,13 @@ var Recommended = function Recommended(props) {
|
|
|
711
703
|
}
|
|
712
704
|
setArticles(_articles);
|
|
713
705
|
}
|
|
714
|
-
_context2.next =
|
|
706
|
+
_context2.next = 55;
|
|
715
707
|
break;
|
|
716
708
|
|
|
717
|
-
case
|
|
709
|
+
case 54:
|
|
718
710
|
setLoaded('failed');
|
|
719
711
|
|
|
720
|
-
case
|
|
712
|
+
case 55:
|
|
721
713
|
case 'end':
|
|
722
714
|
return _context2.stop();
|
|
723
715
|
}
|