@mjhls/mjh-framework 1.0.695 → 1.0.696-1034-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/esm/View.js CHANGED
@@ -24,6 +24,7 @@ import './isSymbol-807e927e.js';
24
24
  import './debounce-1a993acf.js';
25
25
  import { I as InfiniteScroll } from './index.es-938a3a58.js';
26
26
  import 'react-dom';
27
+ import { V as VisibilitySensor } from './visibility-sensor-0baa4eea.js';
27
28
  import './index-51a80699.js';
28
29
  import './index-5f9f807a.js';
29
30
  import { m as main_39 } from './main-0465b2a0.js';
@@ -44,11 +45,12 @@ import './index.esm-29e48d38.js';
44
45
  import Button from 'react-bootstrap/Button';
45
46
  import { _ as _defineProperty } from './defineProperty-b798470d.js';
46
47
  import Form from 'react-bootstrap/Form';
47
- import { I as InscreenSensor, r as renderAuthor, g as getSerializers } from './index-754010eb.js';
48
+ import { r as renderAuthor, g as getSerializers } from './index-d3fdad5e.js';
48
49
  import './util-7700fc59.js';
49
50
  import './brightcove-react-player-loader.es-83f53e4e.js';
50
51
  import 'react-bootstrap/Pagination';
51
52
  import Head from 'next/head';
53
+ import 'react-bootstrap/Figure';
52
54
  import 'react-share';
53
55
  import SocialShare from './SocialShare.js';
54
56
  import FormControl from 'react-bootstrap/FormControl';
@@ -390,7 +392,10 @@ var Article = function Article(props) {
390
392
  _props$sponsoredFlag = props.sponsoredFlag,
391
393
  sponsoredFlag = _props$sponsoredFlag === undefined ? false : _props$sponsoredFlag,
392
394
  _props$authorImgHeigh = props.authorImgHeight,
393
- authorImgHeight = _props$authorImgHeigh === undefined ? 270 : _props$authorImgHeigh;
395
+ authorImgHeight = _props$authorImgHeigh === undefined ? 270 : _props$authorImgHeigh,
396
+ active = props.active,
397
+ containerHeight = props.containerHeight;
398
+
394
399
 
395
400
  var targeting = getTargeting(props);
396
401
  var onChangeArticle = props.onChangeArticle;
@@ -804,16 +809,16 @@ var Article = function Article(props) {
804
809
  React__default.Fragment,
805
810
  null,
806
811
  React__default.createElement(
807
- InscreenSensor,
812
+ VisibilitySensor,
808
813
  {
809
- offSetTop: 120,
810
- className: 'inscreen-wrapper',
811
- id: 'article-' + title,
812
- onChange: function onChange(visible) {
813
- if (visible === 'top' || visible === 'bottom' || visible === 'small-top') {
814
- onChangeArticle(url, visible, meta);
815
- // Setting 'visibleFlag' to know that the article is visible.
816
- setVisibleFlag(true);
814
+ partialVisibility: true,
815
+ offset: { bottom: 100, top: containerHeight - 100 },
816
+ onChange: function onChange(isVisible) {
817
+ if (isVisible && queueData.length > 1) {
818
+ onChangeArticle(url, meta);
819
+ setVisibleFlag(function () {
820
+ return true;
821
+ });
817
822
  }
818
823
  } },
819
824
  React__default.createElement(
@@ -1017,16 +1022,16 @@ var Article = function Article(props) {
1017
1022
  )
1018
1023
  ),
1019
1024
  renderIsiContent(props.article)
1020
- ),
1021
- showIsi && Array.isArray(isi) && isi.length > 0 && React__default.createElement(
1022
- ISI,
1023
- null,
1024
- React__default.createElement(BlockContent, {
1025
- serializers: getSerializers(client, pageview, videoAccountIDs, onVote, true, drupalLeadSettings, currentPage, false, false, null, props.article.Ads, targeting),
1026
- blocks: isi
1027
- })
1028
1025
  )
1029
1026
  ),
1027
+ showIsi && Array.isArray(isi) && isi.length > 0 && React__default.createElement(
1028
+ ISI,
1029
+ null,
1030
+ React__default.createElement(BlockContent, {
1031
+ serializers: getSerializers(client, pageview, videoAccountIDs, onVote, true, drupalLeadSettings, currentPage, false, false, null, props.article.Ads, targeting),
1032
+ blocks: isi
1033
+ })
1034
+ ),
1030
1035
  main_39 && !sponsoredFlag && props.article.Ads && props.article.Ads.length > 0 && props.article.Ads.map(function (ad, index) {
1031
1036
  if (index > 0) {
1032
1037
  return React__default.createElement(
@@ -1081,7 +1086,25 @@ var ArticleQueue = function ArticleQueue(props) {
1081
1086
  showRelatedArticles = props.showRelatedArticles,
1082
1087
  canonicalTag = props.canonicalTag;
1083
1088
 
1089
+ var _useState = useState(0),
1090
+ _useState2 = _slicedToArray(_useState, 2),
1091
+ containerHeight = _useState2[0],
1092
+ setContainerHeight = _useState2[1];
1084
1093
 
1094
+ useEffect(function () {
1095
+ setContainerHeight(function () {
1096
+ return window.innerHeight;
1097
+ });
1098
+ var handleResize = function handleResize() {
1099
+ return setContainerHeight(function () {
1100
+ return window.innerHeight;
1101
+ });
1102
+ };
1103
+ window.addEventListener('resize', handleResize);
1104
+ return function () {
1105
+ return window.removeEventListener('resize', handleResize);
1106
+ };
1107
+ }, []);
1085
1108
  var firstArticle = function firstArticle() {
1086
1109
  var article = _Object$assign({}, props.article);
1087
1110
  var targeting = getTargeting(props);
@@ -1089,10 +1112,15 @@ var ArticleQueue = function ArticleQueue(props) {
1089
1112
  return article;
1090
1113
  };
1091
1114
 
1092
- var _useState = useState([firstArticle()]),
1093
- _useState2 = _slicedToArray(_useState, 2),
1094
- queueData = _useState2[0],
1095
- setQueueData = _useState2[1];
1115
+ var _useState3 = useState([firstArticle()]),
1116
+ _useState4 = _slicedToArray(_useState3, 2),
1117
+ queueData = _useState4[0],
1118
+ setQueueData = _useState4[1];
1119
+
1120
+ var _useState5 = useState(queueData[0]._id),
1121
+ _useState6 = _slicedToArray(_useState5, 2),
1122
+ active = _useState6[0],
1123
+ setActive = _useState6[1];
1096
1124
 
1097
1125
  var refreshAD = function refreshAD(path) {
1098
1126
  var activeArticle = queueData.find(function (item) {
@@ -1142,16 +1170,11 @@ var ArticleQueue = function ArticleQueue(props) {
1142
1170
  };
1143
1171
 
1144
1172
  var preVscroll = 0;
1145
- var isScrollDown = true;
1146
1173
 
1147
1174
  var scrollDirectionDetect = function scrollDirectionDetect(e) {
1148
1175
  var window = e.currentTarget;
1149
1176
 
1150
- if (preVscroll > window.scrollY) {
1151
- isScrollDown = false;
1152
- } else if (preVscroll < window.scrollY) {
1153
- isScrollDown = true;
1154
- }
1177
+ if (preVscroll > window.scrollY) ; else if (preVscroll < window.scrollY) ;
1155
1178
  preVscroll = window.scrollY;
1156
1179
  };
1157
1180
 
@@ -1241,38 +1264,23 @@ var ArticleQueue = function ArticleQueue(props) {
1241
1264
  }
1242
1265
  };
1243
1266
 
1244
- var onChangeArticle = function onChangeArticle(path, visibility, meta) {
1267
+ var onChangeArticle = function onChangeArticle(path, meta) {
1245
1268
  var currentPath = window && window.location && window.location.pathname ? window.location.pathname.replace('/view/', '') : '';
1246
1269
  var newPath = '/view/' + path;
1247
-
1270
+ var activeArticle = queueData.find(function (item) {
1271
+ return item.url.current === path;
1272
+ });
1273
+ setActive(function () {
1274
+ return activeArticle._id;
1275
+ });
1248
1276
  // Change URL and do other changes
1249
- var doChanges = function doChanges() {
1250
- window.history.pushState({ page: path }, meta.shareTitle, newPath);
1251
- changeMeta(meta);
1252
- if (props.setCustomDimensions) {
1253
- var activeArticle = queueData.find(function (item) {
1254
- return item.url.current === path;
1255
- });
1256
- props.setCustomDimensions(activeArticle, '200', prevUrl);
1257
- }
1258
- if (props.pageview) props.pageview(newPath);
1259
- refreshAD(path);
1260
- };
1261
-
1262
- if (currentPath !== path) {
1263
- if (isScrollDown) {
1264
- if (visibility === 'top') {
1265
- doChanges();
1266
- }
1267
- } else {
1268
- if (visibility === 'bottom') {
1269
- doChanges();
1270
- }
1271
- }
1272
- if (visibility === 'small-top') {
1273
- doChanges();
1274
- }
1277
+ window.history.pushState({ page: path }, meta.shareTitle, newPath);
1278
+ changeMeta(meta);
1279
+ if (props.setCustomDimensions) {
1280
+ props.setCustomDimensions(activeArticle, '200', prevUrl);
1275
1281
  }
1282
+ if (props.pageview) props.pageview(newPath);
1283
+ refreshAD(path);
1276
1284
  };
1277
1285
 
1278
1286
  return React__default.createElement(
@@ -1282,10 +1290,12 @@ var ArticleQueue = function ArticleQueue(props) {
1282
1290
  return React__default.createElement(Article, _extends({
1283
1291
  key: index
1284
1292
  }, props, {
1293
+ containerHeight: containerHeight,
1285
1294
  onChangeArticle: onChangeArticle,
1286
1295
  authorPrfix: authorPrefix,
1287
1296
  article: article,
1288
- cpModificationRequired: cpModificationRequired
1297
+ cpModificationRequired: cpModificationRequired,
1298
+ active: active === article._id
1289
1299
  // Passing queueData to check for single article
1290
1300
  , queueData: queueData,
1291
1301
  showRelatedArticles: showRelatedArticles
@@ -69,7 +69,7 @@ var YoutubeGroup = function YoutubeGroup(props) {
69
69
  var tileHeight = tileArray.current.map(function (tile) {
70
70
  return tile.scrollHeight;
71
71
  });
72
- console.log(tileArray.current);
72
+
73
73
  for (var ele in tileArray.current) {
74
74
  var eleHeight = tileHeight[ele] < 185 ? 185 : tileHeight[ele];
75
75
  tileArray.current[ele].style.height = eleHeight + 'px';
@@ -41,8 +41,9 @@ import 'react-bootstrap';
41
41
  import './iconBase-602d52fe.js';
42
42
  import './index.esm-29e48d38.js';
43
43
  import 'react-bootstrap/Button';
44
- export { g as default } from './index-754010eb.js';
44
+ export { g as default } from './index-d3fdad5e.js';
45
45
  import './util-7700fc59.js';
46
46
  import './brightcove-react-player-loader.es-83f53e4e.js';
47
47
  import 'react-bootstrap/Pagination';
48
48
  import 'next/head';
49
+ import 'react-bootstrap/Figure';