@mjhls/mjh-framework 1.0.733-beta-0.1 → 1.0.733-beta-0.2

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
@@ -67,7 +67,7 @@ var getSeriesDetail = require('./getSeriesDetail.js');
67
67
  require('./index-bd6c9f56.js');
68
68
  var getRelatedArticle = require('./getRelatedArticle.js');
69
69
  var getQuery = require('./getQuery.js');
70
- var getTargeting = require('./getTargeting-f70c4a08.js');
70
+ var getTargeting = require('./getTargeting-0d9b6b99.js');
71
71
  var getKeywords = require('./getKeywords.js');
72
72
  var urlFor = require('./urlFor.js');
73
73
  var styleInject_es = require('./style-inject.es-dcee06b6.js');
@@ -1492,12 +1492,12 @@ var View = function View(props) {
1492
1492
  );
1493
1493
  };
1494
1494
 
1495
- //This should be called in /view/[url] getInitialProps to fetch the article data and related articles. This will also set the sponsoredFlag to true if any taxonomies have disabled ads.
1495
+ // This should be called in /view/[url] getInitialProps to fetch the article data and related articles. This will also set the sponsoredFlag to true if any taxonomies have disabled ads.
1496
1496
  View.returnGetInitialProps = function () {
1497
1497
  var _ref = asyncToGenerator._asyncToGenerator( /*#__PURE__*/asyncToGenerator.regenerator.mark(function _callee2(url, prevUrl, seriesVid, client, sao) {
1498
1498
  var context = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : null;
1499
1499
 
1500
- var article, rootDocumentGroup, getRootDoc, relatedArticleQuery, statusCode, _context$query$series, seriesArticle, sponsoredFlag;
1500
+ var article, getRootDoc, relatedArticleQuery, statusCode, _context$query$series, seriesArticle, sponsoredFlag;
1501
1501
 
1502
1502
  return asyncToGenerator.regenerator.wrap(function _callee2$(_context2) {
1503
1503
  while (1) {
@@ -1508,10 +1508,8 @@ View.returnGetInitialProps = function () {
1508
1508
 
1509
1509
  case 2:
1510
1510
  article = _context2.sent;
1511
- rootDocumentGroup = [];
1512
-
1513
- //Recursive Function to get root document group
1514
1511
 
1512
+ // Recursive Function to get root document group
1515
1513
  getRootDoc = function () {
1516
1514
  var _ref2 = asyncToGenerator._asyncToGenerator( /*#__PURE__*/asyncToGenerator.regenerator.mark(function _callee(id) {
1517
1515
  var query, rootDoc;
@@ -1526,24 +1524,22 @@ View.returnGetInitialProps = function () {
1526
1524
  case 3:
1527
1525
  rootDoc = _context.sent;
1528
1526
 
1529
- rootDocumentGroup.push(rootDoc);
1530
-
1531
1527
  if (!(rootDoc && rootDoc.parent)) {
1532
- _context.next = 10;
1528
+ _context.next = 9;
1533
1529
  break;
1534
1530
  }
1535
1531
 
1536
- _context.next = 8;
1532
+ _context.next = 7;
1537
1533
  return getRootDoc(rootDoc.parent._ref);
1538
1534
 
1539
- case 8:
1540
- _context.next = 11;
1535
+ case 7:
1536
+ _context.next = 10;
1541
1537
  break;
1542
1538
 
1543
- case 10:
1544
- return _context.abrupt('return', rootDocumentGroup);
1539
+ case 9:
1540
+ article.rootDocumentGroup = rootDoc;
1545
1541
 
1546
- case 11:
1542
+ case 10:
1547
1543
  case 'end':
1548
1544
  return _context.stop();
1549
1545
  }
@@ -1559,15 +1555,10 @@ View.returnGetInitialProps = function () {
1559
1555
  // Calling recursive function if parentDocumentGroup has id
1560
1556
 
1561
1557
 
1562
- if (!(article && article.parentDocumentGroup && article.parentDocumentGroup._id)) {
1563
- _context2.next = 8;
1564
- break;
1558
+ if (article && article.parentDocumentGroup && article.parentDocumentGroup._id) {
1559
+ getRootDoc(article.parentDocumentGroup._id);
1565
1560
  }
1566
1561
 
1567
- _context2.next = 8;
1568
- return getRootDoc(article.parentDocumentGroup._id);
1569
-
1570
- case 8:
1571
1562
  relatedArticleQuery = getQuery('related');
1572
1563
 
1573
1564
  article.seriesDetail = getSeriesDetail(article, seriesVid);
@@ -1624,27 +1615,27 @@ View.returnGetInitialProps = function () {
1624
1615
  }
1625
1616
 
1626
1617
  if (!article.disableRelatedContent) {
1627
- _context2.next = 21;
1618
+ _context2.next = 18;
1628
1619
  break;
1629
1620
  }
1630
1621
 
1631
1622
  article.relatedArticle = null;
1632
- _context2.next = 25;
1623
+ _context2.next = 22;
1633
1624
  break;
1634
1625
 
1635
- case 21:
1626
+ case 18:
1636
1627
  if (!article) {
1637
- _context2.next = 25;
1628
+ _context2.next = 22;
1638
1629
  break;
1639
1630
  }
1640
1631
 
1641
- _context2.next = 24;
1632
+ _context2.next = 21;
1642
1633
  return getRelatedArticle(context, client, article, prevUrl, '0..2');
1643
1634
 
1644
- case 24:
1635
+ case 21:
1645
1636
  article.relatedArticle = _context2.sent;
1646
1637
 
1647
- case 25:
1638
+ case 22:
1648
1639
  return _context2.abrupt('return', {
1649
1640
  url: url,
1650
1641
  sao: sao,
@@ -1652,11 +1643,10 @@ View.returnGetInitialProps = function () {
1652
1643
  prevUrl: prevUrl,
1653
1644
  relatedArticleQuery: relatedArticleQuery,
1654
1645
  article: article,
1655
- sponsoredFlag: sponsoredFlag,
1656
- rootDocumentGroup: rootDocumentGroup
1646
+ sponsoredFlag: sponsoredFlag
1657
1647
  });
1658
1648
 
1659
- case 26:
1649
+ case 23:
1660
1650
  case 'end':
1661
1651
  return _context2.stop();
1662
1652
  }
@@ -24,8 +24,7 @@ var getTargeting = function getTargeting(props) {
24
24
  position = props.position,
25
25
  prevUrl = props.prevUrl,
26
26
  _props$cpModification = props.cpModificationRequired,
27
- cpModificationRequired = _props$cpModification === undefined ? true : _props$cpModification,
28
- rootDocumentGroup = props.rootDocumentGroup;
27
+ cpModificationRequired = _props$cpModification === undefined ? true : _props$cpModification;
29
28
 
30
29
  if (positionOverride) {
31
30
  position = positionOverride;
@@ -49,7 +48,8 @@ var getTargeting = function getTargeting(props) {
49
48
  } : _article$documentGrou;
50
49
  var document_group = _article$documentGrou.path,
51
50
  document_groups = article.document_groups,
52
- content_placement = article.content_placement;
51
+ content_placement = article.content_placement,
52
+ rootDocumentGroup = article.rootDocumentGroup;
53
53
 
54
54
  var context = url;
55
55
  var localHistory = props.historyCookie ? JSON.parse(props.historyCookie) : [];
@@ -140,8 +140,8 @@ var getTargeting = function getTargeting(props) {
140
140
  }
141
141
 
142
142
  // returning AD Targeting Group
143
- if (rootDocumentGroup && rootDocumentGroup.length && rootDocumentGroup[rootDocumentGroup.length - 1].identifier) {
144
- targeting['rootDocumentGroup'] = rootDocumentGroup[rootDocumentGroup.length - 1].identifier.current;
143
+ if (rootDocumentGroup && rootDocumentGroup.identifier) {
144
+ targeting['rootDocumentGroup'] = rootDocumentGroup.identifier.current;
145
145
  }
146
146
  return targeting;
147
147
  };
@@ -8,7 +8,7 @@ require('./toConsumableArray-9a3476fe.js');
8
8
  require('./core.get-iterator-method-f62321d4.js');
9
9
  require('./_object-pie-68c5bcbc.js');
10
10
  require('./extends-60837c34.js');
11
- var getTargeting = require('./getTargeting-f70c4a08.js');
11
+ var getTargeting = require('./getTargeting-0d9b6b99.js');
12
12
 
13
13
 
14
14
 
package/dist/cjs/index.js CHANGED
@@ -177,7 +177,7 @@ var Auth = require('./Auth.js');
177
177
  require('swr');
178
178
  require('passport-local');
179
179
  require('mysql');
180
- var getTargeting = require('./getTargeting-f70c4a08.js');
180
+ var getTargeting = require('./getTargeting-0d9b6b99.js');
181
181
  var View = require('./View.js');
182
182
  var getKeywords = require('./getKeywords.js');
183
183
  var urlFor = require('./urlFor.js');
package/dist/esm/View.js CHANGED
@@ -61,7 +61,7 @@ import getSeriesDetail from './getSeriesDetail.js';
61
61
  import './index-db3bb315.js';
62
62
  import getRelatedArticle from './getRelatedArticle.js';
63
63
  import getQuery from './getQuery.js';
64
- import { g as getTargeting, a as getContentPlacementUrl } from './getTargeting-2e5b6d44.js';
64
+ import { g as getTargeting, a as getContentPlacementUrl } from './getTargeting-a1ebbed5.js';
65
65
  import getKeywords from './getKeywords.js';
66
66
  import urlFor from './urlFor.js';
67
67
  import { s as styleInject } from './style-inject.es-1f59c1d0.js';
@@ -1486,12 +1486,12 @@ var View = function View(props) {
1486
1486
  );
1487
1487
  };
1488
1488
 
1489
- //This should be called in /view/[url] getInitialProps to fetch the article data and related articles. This will also set the sponsoredFlag to true if any taxonomies have disabled ads.
1489
+ // This should be called in /view/[url] getInitialProps to fetch the article data and related articles. This will also set the sponsoredFlag to true if any taxonomies have disabled ads.
1490
1490
  View.returnGetInitialProps = function () {
1491
1491
  var _ref = _asyncToGenerator( /*#__PURE__*/regenerator.mark(function _callee2(url, prevUrl, seriesVid, client, sao) {
1492
1492
  var context = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : null;
1493
1493
 
1494
- var article, rootDocumentGroup, getRootDoc, relatedArticleQuery, statusCode, _context$query$series, seriesArticle, sponsoredFlag;
1494
+ var article, getRootDoc, relatedArticleQuery, statusCode, _context$query$series, seriesArticle, sponsoredFlag;
1495
1495
 
1496
1496
  return regenerator.wrap(function _callee2$(_context2) {
1497
1497
  while (1) {
@@ -1502,10 +1502,8 @@ View.returnGetInitialProps = function () {
1502
1502
 
1503
1503
  case 2:
1504
1504
  article = _context2.sent;
1505
- rootDocumentGroup = [];
1506
-
1507
- //Recursive Function to get root document group
1508
1505
 
1506
+ // Recursive Function to get root document group
1509
1507
  getRootDoc = function () {
1510
1508
  var _ref2 = _asyncToGenerator( /*#__PURE__*/regenerator.mark(function _callee(id) {
1511
1509
  var query, rootDoc;
@@ -1520,24 +1518,22 @@ View.returnGetInitialProps = function () {
1520
1518
  case 3:
1521
1519
  rootDoc = _context.sent;
1522
1520
 
1523
- rootDocumentGroup.push(rootDoc);
1524
-
1525
1521
  if (!(rootDoc && rootDoc.parent)) {
1526
- _context.next = 10;
1522
+ _context.next = 9;
1527
1523
  break;
1528
1524
  }
1529
1525
 
1530
- _context.next = 8;
1526
+ _context.next = 7;
1531
1527
  return getRootDoc(rootDoc.parent._ref);
1532
1528
 
1533
- case 8:
1534
- _context.next = 11;
1529
+ case 7:
1530
+ _context.next = 10;
1535
1531
  break;
1536
1532
 
1537
- case 10:
1538
- return _context.abrupt('return', rootDocumentGroup);
1533
+ case 9:
1534
+ article.rootDocumentGroup = rootDoc;
1539
1535
 
1540
- case 11:
1536
+ case 10:
1541
1537
  case 'end':
1542
1538
  return _context.stop();
1543
1539
  }
@@ -1553,15 +1549,10 @@ View.returnGetInitialProps = function () {
1553
1549
  // Calling recursive function if parentDocumentGroup has id
1554
1550
 
1555
1551
 
1556
- if (!(article && article.parentDocumentGroup && article.parentDocumentGroup._id)) {
1557
- _context2.next = 8;
1558
- break;
1552
+ if (article && article.parentDocumentGroup && article.parentDocumentGroup._id) {
1553
+ getRootDoc(article.parentDocumentGroup._id);
1559
1554
  }
1560
1555
 
1561
- _context2.next = 8;
1562
- return getRootDoc(article.parentDocumentGroup._id);
1563
-
1564
- case 8:
1565
1556
  relatedArticleQuery = getQuery('related');
1566
1557
 
1567
1558
  article.seriesDetail = getSeriesDetail(article, seriesVid);
@@ -1618,27 +1609,27 @@ View.returnGetInitialProps = function () {
1618
1609
  }
1619
1610
 
1620
1611
  if (!article.disableRelatedContent) {
1621
- _context2.next = 21;
1612
+ _context2.next = 18;
1622
1613
  break;
1623
1614
  }
1624
1615
 
1625
1616
  article.relatedArticle = null;
1626
- _context2.next = 25;
1617
+ _context2.next = 22;
1627
1618
  break;
1628
1619
 
1629
- case 21:
1620
+ case 18:
1630
1621
  if (!article) {
1631
- _context2.next = 25;
1622
+ _context2.next = 22;
1632
1623
  break;
1633
1624
  }
1634
1625
 
1635
- _context2.next = 24;
1626
+ _context2.next = 21;
1636
1627
  return getRelatedArticle(context, client, article, prevUrl, '0..2');
1637
1628
 
1638
- case 24:
1629
+ case 21:
1639
1630
  article.relatedArticle = _context2.sent;
1640
1631
 
1641
- case 25:
1632
+ case 22:
1642
1633
  return _context2.abrupt('return', {
1643
1634
  url: url,
1644
1635
  sao: sao,
@@ -1646,11 +1637,10 @@ View.returnGetInitialProps = function () {
1646
1637
  prevUrl: prevUrl,
1647
1638
  relatedArticleQuery: relatedArticleQuery,
1648
1639
  article: article,
1649
- sponsoredFlag: sponsoredFlag,
1650
- rootDocumentGroup: rootDocumentGroup
1640
+ sponsoredFlag: sponsoredFlag
1651
1641
  });
1652
1642
 
1653
- case 26:
1643
+ case 23:
1654
1644
  case 'end':
1655
1645
  return _context2.stop();
1656
1646
  }
@@ -22,8 +22,7 @@ var getTargeting = function getTargeting(props) {
22
22
  position = props.position,
23
23
  prevUrl = props.prevUrl,
24
24
  _props$cpModification = props.cpModificationRequired,
25
- cpModificationRequired = _props$cpModification === undefined ? true : _props$cpModification,
26
- rootDocumentGroup = props.rootDocumentGroup;
25
+ cpModificationRequired = _props$cpModification === undefined ? true : _props$cpModification;
27
26
 
28
27
  if (positionOverride) {
29
28
  position = positionOverride;
@@ -47,7 +46,8 @@ var getTargeting = function getTargeting(props) {
47
46
  } : _article$documentGrou;
48
47
  var document_group = _article$documentGrou.path,
49
48
  document_groups = article.document_groups,
50
- content_placement = article.content_placement;
49
+ content_placement = article.content_placement,
50
+ rootDocumentGroup = article.rootDocumentGroup;
51
51
 
52
52
  var context = url;
53
53
  var localHistory = props.historyCookie ? JSON.parse(props.historyCookie) : [];
@@ -138,8 +138,8 @@ var getTargeting = function getTargeting(props) {
138
138
  }
139
139
 
140
140
  // returning AD Targeting Group
141
- if (rootDocumentGroup && rootDocumentGroup.length && rootDocumentGroup[rootDocumentGroup.length - 1].identifier) {
142
- targeting['rootDocumentGroup'] = rootDocumentGroup[rootDocumentGroup.length - 1].identifier.current;
141
+ if (rootDocumentGroup && rootDocumentGroup.identifier) {
142
+ targeting['rootDocumentGroup'] = rootDocumentGroup.identifier.current;
143
143
  }
144
144
  return targeting;
145
145
  };
@@ -6,4 +6,4 @@ import './toConsumableArray-43aa614d.js';
6
6
  import './core.get-iterator-method-e1de7503.js';
7
7
  import './_object-pie-33c40e79.js';
8
8
  import './extends-eb69e8ac.js';
9
- export { g as default } from './getTargeting-2e5b6d44.js';
9
+ export { g as default } from './getTargeting-a1ebbed5.js';
package/dist/esm/index.js CHANGED
@@ -170,7 +170,7 @@ export { default as Auth } from './Auth.js';
170
170
  import 'swr';
171
171
  import 'passport-local';
172
172
  import 'mysql';
173
- export { g as getTargeting } from './getTargeting-2e5b6d44.js';
173
+ export { g as getTargeting } from './getTargeting-a1ebbed5.js';
174
174
  export { default as View } from './View.js';
175
175
  export { default as getKeywords } from './getKeywords.js';
176
176
  export { default as urlFor } from './urlFor.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mjhls/mjh-framework",
3
- "version": "1.0.733-beta-0.1",
3
+ "version": "1.0.733-beta-0.2",
4
4
  "description": "Foundation Framework",
5
5
  "author": "mjh-framework",
6
6
  "license": "MIT",