@mjhls/mjh-framework 1.0.939-segment-test-v9 → 1.0.939-segment-test-v11
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 +9 -33
- package/dist/esm/View.js +9 -33
- package/package.json +1 -1
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,
|
|
510
|
+
var anonymousId, response, data, addTaxonomyName, favoriteCategories, articlesQuery, videosQuery, podcastQuery, params, _ref2, _ref3, _articles, videos, podcasts;
|
|
511
511
|
|
|
512
512
|
return asyncToGenerator.regenerator.wrap(function _callee$(_context) {
|
|
513
513
|
while (1) {
|
|
@@ -528,11 +528,8 @@ var Recommended = function Recommended(props) {
|
|
|
528
528
|
case 6:
|
|
529
529
|
data = _context.sent;
|
|
530
530
|
|
|
531
|
-
|
|
532
|
-
console.log('persona result:', data);
|
|
533
|
-
|
|
534
531
|
if (!(data && data.traits && data.traits.favorite_article_category)) {
|
|
535
|
-
_context.next =
|
|
532
|
+
_context.next = 25;
|
|
536
533
|
break;
|
|
537
534
|
}
|
|
538
535
|
|
|
@@ -554,21 +551,6 @@ var Recommended = function Recommended(props) {
|
|
|
554
551
|
return query;
|
|
555
552
|
};
|
|
556
553
|
|
|
557
|
-
fetchWithTimeout = function fetchWithTimeout(timeout, fn) {
|
|
558
|
-
|
|
559
|
-
return new asyncToGenerator._Promise(function (resolve, reject) {
|
|
560
|
-
// start timeout
|
|
561
|
-
var timeoutID = setTimeout(function () {
|
|
562
|
-
return resolve([]);
|
|
563
|
-
}, timeout);
|
|
564
|
-
// start calculation
|
|
565
|
-
fn().then(function (result) {
|
|
566
|
-
clearTimeout(timeoutID);
|
|
567
|
-
resolve(result);
|
|
568
|
-
});
|
|
569
|
-
});
|
|
570
|
-
};
|
|
571
|
-
|
|
572
554
|
favoriteCategories = JSON.parse(data.traits.favorite_article_category);
|
|
573
555
|
// grab 3 articles from sanity different from the one currently being read
|
|
574
556
|
|
|
@@ -578,16 +560,10 @@ var Recommended = function Recommended(props) {
|
|
|
578
560
|
params = {
|
|
579
561
|
id: article._id
|
|
580
562
|
};
|
|
581
|
-
_context.next =
|
|
582
|
-
return asyncToGenerator._Promise.all([
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
return client.fetch(videosQuery, params);
|
|
586
|
-
}), fetchWithTimeout(800, function () {
|
|
587
|
-
return client.fetch(podcastQuery, params);
|
|
588
|
-
})]);
|
|
589
|
-
|
|
590
|
-
case 18:
|
|
563
|
+
_context.next = 16;
|
|
564
|
+
return asyncToGenerator._Promise.all([client.fetch(articlesQuery, params), client.fetch(videosQuery, params), client.fetch(podcastQuery, params)]);
|
|
565
|
+
|
|
566
|
+
case 16:
|
|
591
567
|
_ref2 = _context.sent;
|
|
592
568
|
_ref3 = slicedToArray._slicedToArray(_ref2, 3);
|
|
593
569
|
_articles = _ref3[0];
|
|
@@ -607,13 +583,13 @@ var Recommended = function Recommended(props) {
|
|
|
607
583
|
}
|
|
608
584
|
setArticles(_articles);
|
|
609
585
|
}
|
|
610
|
-
_context.next =
|
|
586
|
+
_context.next = 26;
|
|
611
587
|
break;
|
|
612
588
|
|
|
613
|
-
case
|
|
589
|
+
case 25:
|
|
614
590
|
setLoaded('failed');
|
|
615
591
|
|
|
616
|
-
case
|
|
592
|
+
case 26:
|
|
617
593
|
case 'end':
|
|
618
594
|
return _context.stop();
|
|
619
595
|
}
|
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,
|
|
499
|
+
var anonymousId, response, data, addTaxonomyName, favoriteCategories, articlesQuery, videosQuery, podcastQuery, params, _ref2, _ref3, _articles, videos, podcasts;
|
|
500
500
|
|
|
501
501
|
return regenerator.wrap(function _callee$(_context) {
|
|
502
502
|
while (1) {
|
|
@@ -517,11 +517,8 @@ var Recommended = function Recommended(props) {
|
|
|
517
517
|
case 6:
|
|
518
518
|
data = _context.sent;
|
|
519
519
|
|
|
520
|
-
|
|
521
|
-
console.log('persona result:', data);
|
|
522
|
-
|
|
523
520
|
if (!(data && data.traits && data.traits.favorite_article_category)) {
|
|
524
|
-
_context.next =
|
|
521
|
+
_context.next = 25;
|
|
525
522
|
break;
|
|
526
523
|
}
|
|
527
524
|
|
|
@@ -543,21 +540,6 @@ var Recommended = function Recommended(props) {
|
|
|
543
540
|
return query;
|
|
544
541
|
};
|
|
545
542
|
|
|
546
|
-
fetchWithTimeout = function fetchWithTimeout(timeout, fn) {
|
|
547
|
-
|
|
548
|
-
return new _Promise(function (resolve, reject) {
|
|
549
|
-
// start timeout
|
|
550
|
-
var timeoutID = setTimeout(function () {
|
|
551
|
-
return resolve([]);
|
|
552
|
-
}, timeout);
|
|
553
|
-
// start calculation
|
|
554
|
-
fn().then(function (result) {
|
|
555
|
-
clearTimeout(timeoutID);
|
|
556
|
-
resolve(result);
|
|
557
|
-
});
|
|
558
|
-
});
|
|
559
|
-
};
|
|
560
|
-
|
|
561
543
|
favoriteCategories = JSON.parse(data.traits.favorite_article_category);
|
|
562
544
|
// grab 3 articles from sanity different from the one currently being read
|
|
563
545
|
|
|
@@ -567,16 +549,10 @@ var Recommended = function Recommended(props) {
|
|
|
567
549
|
params = {
|
|
568
550
|
id: article._id
|
|
569
551
|
};
|
|
570
|
-
_context.next =
|
|
571
|
-
return _Promise.all([
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
return client.fetch(videosQuery, params);
|
|
575
|
-
}), fetchWithTimeout(800, function () {
|
|
576
|
-
return client.fetch(podcastQuery, params);
|
|
577
|
-
})]);
|
|
578
|
-
|
|
579
|
-
case 18:
|
|
552
|
+
_context.next = 16;
|
|
553
|
+
return _Promise.all([client.fetch(articlesQuery, params), client.fetch(videosQuery, params), client.fetch(podcastQuery, params)]);
|
|
554
|
+
|
|
555
|
+
case 16:
|
|
580
556
|
_ref2 = _context.sent;
|
|
581
557
|
_ref3 = _slicedToArray(_ref2, 3);
|
|
582
558
|
_articles = _ref3[0];
|
|
@@ -596,13 +572,13 @@ var Recommended = function Recommended(props) {
|
|
|
596
572
|
}
|
|
597
573
|
setArticles(_articles);
|
|
598
574
|
}
|
|
599
|
-
_context.next =
|
|
575
|
+
_context.next = 26;
|
|
600
576
|
break;
|
|
601
577
|
|
|
602
|
-
case
|
|
578
|
+
case 25:
|
|
603
579
|
setLoaded('failed');
|
|
604
580
|
|
|
605
|
-
case
|
|
581
|
+
case 26:
|
|
606
582
|
case 'end':
|
|
607
583
|
return _context.stop();
|
|
608
584
|
}
|