@mjhls/mjh-framework 1.0.974-test2 → 1.0.974-test3
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 +28 -27
- package/dist/esm/View.js +28 -27
- package/package.json +1 -1
package/dist/cjs/View.js
CHANGED
|
@@ -613,28 +613,29 @@ var Recommended = function Recommended(props) {
|
|
|
613
613
|
anonymousId = analytics.user().anonymousId();
|
|
614
614
|
|
|
615
615
|
console.log('anonymousId', anonymousId);
|
|
616
|
-
// Segment.createGroup('test_group_2', anonymousId, 'onclive_test2')
|
|
617
616
|
// Segment.createGroup('9e4fb278-daa9-448a-bf46-d168085d9126', anonymousId, 'onclive_test3')
|
|
618
|
-
|
|
617
|
+
_context3.next = 5;
|
|
618
|
+
return Segment.identifyWithGroup('9e4fb278-daa9-448a-bf46-d168085d9126', anonymousId);
|
|
619
619
|
|
|
620
|
-
|
|
620
|
+
case 5:
|
|
621
|
+
_context3.next = 7;
|
|
621
622
|
return fetch('/api/getTraits', {
|
|
622
623
|
method: 'POST',
|
|
623
624
|
body: stringify._JSON$stringify({ anonymousId: anonymousId })
|
|
624
625
|
});
|
|
625
626
|
|
|
626
|
-
case
|
|
627
|
+
case 7:
|
|
627
628
|
traits = _context3.sent;
|
|
628
|
-
_context3.next =
|
|
629
|
+
_context3.next = 10;
|
|
629
630
|
return traits.json();
|
|
630
631
|
|
|
631
|
-
case
|
|
632
|
+
case 10:
|
|
632
633
|
traitData = _context3.sent;
|
|
633
634
|
|
|
634
635
|
console.log('persona result:', traitData);
|
|
635
636
|
|
|
636
637
|
if (!(traitData.traits && traitData.traits.groupId)) {
|
|
637
|
-
_context3.next =
|
|
638
|
+
_context3.next = 16;
|
|
638
639
|
break;
|
|
639
640
|
}
|
|
640
641
|
|
|
@@ -643,26 +644,26 @@ var Recommended = function Recommended(props) {
|
|
|
643
644
|
} catch (e) {
|
|
644
645
|
if (e) console.log('Error: ' + e);
|
|
645
646
|
}
|
|
646
|
-
_context3.next =
|
|
647
|
+
_context3.next = 57;
|
|
647
648
|
break;
|
|
648
649
|
|
|
649
|
-
case
|
|
650
|
-
_context3.next =
|
|
650
|
+
case 16:
|
|
651
|
+
_context3.next = 18;
|
|
651
652
|
return fetch('/api/getSegmentProfile', {
|
|
652
653
|
method: 'POST',
|
|
653
654
|
body: stringify._JSON$stringify({ anonymousId: anonymousId })
|
|
654
655
|
});
|
|
655
656
|
|
|
656
|
-
case
|
|
657
|
+
case 18:
|
|
657
658
|
response = _context3.sent;
|
|
658
|
-
_context3.next =
|
|
659
|
+
_context3.next = 21;
|
|
659
660
|
return response.json();
|
|
660
661
|
|
|
661
|
-
case
|
|
662
|
+
case 21:
|
|
662
663
|
data = _context3.sent;
|
|
663
664
|
|
|
664
665
|
if (!(data && data.traits && data.traits.most_frequent_category)) {
|
|
665
|
-
_context3.next =
|
|
666
|
+
_context3.next = 56;
|
|
666
667
|
break;
|
|
667
668
|
}
|
|
668
669
|
|
|
@@ -688,25 +689,25 @@ var Recommended = function Recommended(props) {
|
|
|
688
689
|
|
|
689
690
|
// grab contentCategory ID
|
|
690
691
|
|
|
691
|
-
_context3.next =
|
|
692
|
+
_context3.next = 28;
|
|
692
693
|
return client.fetch("*[_type == 'contentCategory' && name == 'Articles'][0]{_id}");
|
|
693
694
|
|
|
694
|
-
case
|
|
695
|
+
case 28:
|
|
695
696
|
articlesCategory = _context3.sent;
|
|
696
|
-
_context3.next =
|
|
697
|
+
_context3.next = 31;
|
|
697
698
|
return client.fetch("*[_type == 'contentCategory' && name == 'Videos'][0]{_id}");
|
|
698
699
|
|
|
699
|
-
case
|
|
700
|
+
case 31:
|
|
700
701
|
videosCategory = _context3.sent;
|
|
701
|
-
_context3.next =
|
|
702
|
+
_context3.next = 34;
|
|
702
703
|
return client.fetch("*[_type == 'contentCategory' && name == 'Podcasts'][0]{_id}");
|
|
703
704
|
|
|
704
|
-
case
|
|
705
|
+
case 34:
|
|
705
706
|
podcastCategory = _context3.sent;
|
|
706
|
-
_context3.next =
|
|
707
|
+
_context3.next = 37;
|
|
707
708
|
return client.fetch('*[_type == \'taxonomy\' ' + addTaxonomyName(favoriteCategories) + ']');
|
|
708
709
|
|
|
709
|
-
case
|
|
710
|
+
case 37:
|
|
710
711
|
taxonomyCategories = _context3.sent;
|
|
711
712
|
taxonomies = '';
|
|
712
713
|
|
|
@@ -726,10 +727,10 @@ var Recommended = function Recommended(props) {
|
|
|
726
727
|
params = {
|
|
727
728
|
id: article._id
|
|
728
729
|
};
|
|
729
|
-
_context3.next =
|
|
730
|
+
_context3.next = 47;
|
|
730
731
|
return asyncToGenerator._Promise.all([client.fetch(articlesQuery, params), client.fetch(videosQuery, params), client.fetch(podcastQuery, params)]);
|
|
731
732
|
|
|
732
|
-
case
|
|
733
|
+
case 47:
|
|
733
734
|
_ref4 = _context3.sent;
|
|
734
735
|
_ref5 = slicedToArray._slicedToArray(_ref4, 3);
|
|
735
736
|
_articles = _ref5[0];
|
|
@@ -751,13 +752,13 @@ var Recommended = function Recommended(props) {
|
|
|
751
752
|
}
|
|
752
753
|
setArticles(_articles);
|
|
753
754
|
}
|
|
754
|
-
_context3.next =
|
|
755
|
+
_context3.next = 57;
|
|
755
756
|
break;
|
|
756
757
|
|
|
757
|
-
case
|
|
758
|
+
case 56:
|
|
758
759
|
setLoaded('failed');
|
|
759
760
|
|
|
760
|
-
case
|
|
761
|
+
case 57:
|
|
761
762
|
case 'end':
|
|
762
763
|
return _context3.stop();
|
|
763
764
|
}
|
package/dist/esm/View.js
CHANGED
|
@@ -603,28 +603,29 @@ var Recommended = function Recommended(props) {
|
|
|
603
603
|
anonymousId = analytics.user().anonymousId();
|
|
604
604
|
|
|
605
605
|
console.log('anonymousId', anonymousId);
|
|
606
|
-
// Segment.createGroup('test_group_2', anonymousId, 'onclive_test2')
|
|
607
606
|
// Segment.createGroup('9e4fb278-daa9-448a-bf46-d168085d9126', anonymousId, 'onclive_test3')
|
|
608
|
-
|
|
607
|
+
_context3.next = 5;
|
|
608
|
+
return Segment.identifyWithGroup('9e4fb278-daa9-448a-bf46-d168085d9126', anonymousId);
|
|
609
609
|
|
|
610
|
-
|
|
610
|
+
case 5:
|
|
611
|
+
_context3.next = 7;
|
|
611
612
|
return fetch('/api/getTraits', {
|
|
612
613
|
method: 'POST',
|
|
613
614
|
body: _JSON$stringify({ anonymousId: anonymousId })
|
|
614
615
|
});
|
|
615
616
|
|
|
616
|
-
case
|
|
617
|
+
case 7:
|
|
617
618
|
traits = _context3.sent;
|
|
618
|
-
_context3.next =
|
|
619
|
+
_context3.next = 10;
|
|
619
620
|
return traits.json();
|
|
620
621
|
|
|
621
|
-
case
|
|
622
|
+
case 10:
|
|
622
623
|
traitData = _context3.sent;
|
|
623
624
|
|
|
624
625
|
console.log('persona result:', traitData);
|
|
625
626
|
|
|
626
627
|
if (!(traitData.traits && traitData.traits.groupId)) {
|
|
627
|
-
_context3.next =
|
|
628
|
+
_context3.next = 16;
|
|
628
629
|
break;
|
|
629
630
|
}
|
|
630
631
|
|
|
@@ -633,26 +634,26 @@ var Recommended = function Recommended(props) {
|
|
|
633
634
|
} catch (e) {
|
|
634
635
|
if (e) console.log('Error: ' + e);
|
|
635
636
|
}
|
|
636
|
-
_context3.next =
|
|
637
|
+
_context3.next = 57;
|
|
637
638
|
break;
|
|
638
639
|
|
|
639
|
-
case
|
|
640
|
-
_context3.next =
|
|
640
|
+
case 16:
|
|
641
|
+
_context3.next = 18;
|
|
641
642
|
return fetch('/api/getSegmentProfile', {
|
|
642
643
|
method: 'POST',
|
|
643
644
|
body: _JSON$stringify({ anonymousId: anonymousId })
|
|
644
645
|
});
|
|
645
646
|
|
|
646
|
-
case
|
|
647
|
+
case 18:
|
|
647
648
|
response = _context3.sent;
|
|
648
|
-
_context3.next =
|
|
649
|
+
_context3.next = 21;
|
|
649
650
|
return response.json();
|
|
650
651
|
|
|
651
|
-
case
|
|
652
|
+
case 21:
|
|
652
653
|
data = _context3.sent;
|
|
653
654
|
|
|
654
655
|
if (!(data && data.traits && data.traits.most_frequent_category)) {
|
|
655
|
-
_context3.next =
|
|
656
|
+
_context3.next = 56;
|
|
656
657
|
break;
|
|
657
658
|
}
|
|
658
659
|
|
|
@@ -678,25 +679,25 @@ var Recommended = function Recommended(props) {
|
|
|
678
679
|
|
|
679
680
|
// grab contentCategory ID
|
|
680
681
|
|
|
681
|
-
_context3.next =
|
|
682
|
+
_context3.next = 28;
|
|
682
683
|
return client.fetch("*[_type == 'contentCategory' && name == 'Articles'][0]{_id}");
|
|
683
684
|
|
|
684
|
-
case
|
|
685
|
+
case 28:
|
|
685
686
|
articlesCategory = _context3.sent;
|
|
686
|
-
_context3.next =
|
|
687
|
+
_context3.next = 31;
|
|
687
688
|
return client.fetch("*[_type == 'contentCategory' && name == 'Videos'][0]{_id}");
|
|
688
689
|
|
|
689
|
-
case
|
|
690
|
+
case 31:
|
|
690
691
|
videosCategory = _context3.sent;
|
|
691
|
-
_context3.next =
|
|
692
|
+
_context3.next = 34;
|
|
692
693
|
return client.fetch("*[_type == 'contentCategory' && name == 'Podcasts'][0]{_id}");
|
|
693
694
|
|
|
694
|
-
case
|
|
695
|
+
case 34:
|
|
695
696
|
podcastCategory = _context3.sent;
|
|
696
|
-
_context3.next =
|
|
697
|
+
_context3.next = 37;
|
|
697
698
|
return client.fetch('*[_type == \'taxonomy\' ' + addTaxonomyName(favoriteCategories) + ']');
|
|
698
699
|
|
|
699
|
-
case
|
|
700
|
+
case 37:
|
|
700
701
|
taxonomyCategories = _context3.sent;
|
|
701
702
|
taxonomies = '';
|
|
702
703
|
|
|
@@ -716,10 +717,10 @@ var Recommended = function Recommended(props) {
|
|
|
716
717
|
params = {
|
|
717
718
|
id: article._id
|
|
718
719
|
};
|
|
719
|
-
_context3.next =
|
|
720
|
+
_context3.next = 47;
|
|
720
721
|
return _Promise.all([client.fetch(articlesQuery, params), client.fetch(videosQuery, params), client.fetch(podcastQuery, params)]);
|
|
721
722
|
|
|
722
|
-
case
|
|
723
|
+
case 47:
|
|
723
724
|
_ref4 = _context3.sent;
|
|
724
725
|
_ref5 = _slicedToArray(_ref4, 3);
|
|
725
726
|
_articles = _ref5[0];
|
|
@@ -741,13 +742,13 @@ var Recommended = function Recommended(props) {
|
|
|
741
742
|
}
|
|
742
743
|
setArticles(_articles);
|
|
743
744
|
}
|
|
744
|
-
_context3.next =
|
|
745
|
+
_context3.next = 57;
|
|
745
746
|
break;
|
|
746
747
|
|
|
747
|
-
case
|
|
748
|
+
case 56:
|
|
748
749
|
setLoaded('failed');
|
|
749
750
|
|
|
750
|
-
case
|
|
751
|
+
case 57:
|
|
751
752
|
case 'end':
|
|
752
753
|
return _context3.stop();
|
|
753
754
|
}
|