@mjhls/mjh-framework 1.0.435 → 1.0.437

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.
@@ -23,6 +23,8 @@ import { _ as _slicedToArray } from './slicedToArray-04e02710.js';
23
23
  import './AdSlot-78e48a2c.js';
24
24
  import './promise-2592a80a.js';
25
25
  import { A as ADInfeed } from './ADInfeed-e5cefea5.js';
26
+ import { l as lodash } from './lodash-17fdfebb.js';
27
+ import { A as ADlgInfeed } from './ADlgInfeed-51a2801a.js';
26
28
  import { A as AuthorComponent } from './AuthorComponent-c9e46673.js';
27
29
  import { Container, Media } from 'react-bootstrap';
28
30
 
@@ -137,13 +139,40 @@ var checkExternalUrl = function checkExternalUrl(url) {
137
139
  return new RegExp(['http', 'https'].join('|')).test(url);
138
140
  };
139
141
 
140
- var cardLoader = function cardLoader(data, builder, mapping, values, seoPaginate, pageview, router, currentPage, setCurrentPage, showPublished, defaultImage, showAuthor, showCategory, imageHeight, imageWidth, rightItems, brandInsightAd, showBI, itemsPerPage, heroContent) {
142
+ var cardLoader = function cardLoader(data, builder, mapping, values, seoPaginate, pageview, router, currentPage, setCurrentPage, showPublished, defaultImage, showAuthor, showCategory, imageHeight, imageWidth, rightItems, brandInsightAd, showBI, itemsPerPage, heroContent, dektopView) {
141
143
  var numberOfItemsBeforeAd = 6;
142
144
 
143
145
  var insertBrandInsightAd = function insertBrandInsightAd(arr, index, newElement) {
144
146
  return [].concat(_toConsumableArray(arr.slice(0, index)), [newElement], _toConsumableArray(arr.slice(index)));
145
147
  };
148
+
149
+ if (dektopView && brandInsightAd) {
150
+ var lgInfeedAd = {
151
+ _type: 'lg-infeed',
152
+ adUnit: brandInsightAd.adUnit,
153
+ className: 'lg-infeed',
154
+ networkID: brandInsightAd.networkID,
155
+ sizes: [728, 90],
156
+ targeting: {
157
+ content_placement: brandInsightAd.targeting.content_placement,
158
+ document_url: brandInsightAd.targeting.document_url
159
+ }
160
+ };
161
+
162
+ var chunks = lodash.chunk(data, 6).map(function (chunk) {
163
+ var set = lodash.chunk(chunk, 2);
164
+ for (var i = 0; i < set.length; i++) {
165
+ if (i !== set.length - 1) {
166
+ set[i].push(lgInfeedAd);
167
+ }
168
+ }
169
+ return lodash.flattenDeep(set);
170
+ });
171
+ data = lodash.flatten(chunks);
172
+ }
173
+
146
174
  if (showBI && brandInsightAd) {
175
+ if (dektopView) brandInsightAd.interval = 8;
147
176
  var pos = 0;
148
177
  for (var i = 1; pos < data.length; i++) {
149
178
  var inFeedAd = {
@@ -164,6 +193,13 @@ var cardLoader = function cardLoader(data, builder, mapping, values, seoPaginate
164
193
  pos += brandInsightAd.interval + 1;
165
194
  }
166
195
  }
196
+ data = data.map(function (ele, i) {
197
+ if (ele._type === 'lg-infeed') {
198
+ return _extends({}, ele, { slotId: 'lg-infeed_' + i, targeting: _extends({}, ele.targeting, { pos: 'lg-infeed_' + i }) });
199
+ } else {
200
+ return ele;
201
+ }
202
+ });
167
203
 
168
204
  var featureCount = 0;
169
205
 
@@ -369,6 +405,8 @@ var cardLoader = function cardLoader(data, builder, mapping, values, seoPaginate
369
405
  )
370
406
  );
371
407
  }
408
+ } else if (article._type === 'lg-infeed' && article.adUnit) {
409
+ return React__default.createElement(ADlgInfeed, _extends({ index: index }, article));
372
410
  } else if (article._type === 'brandInsightAd' && article.adUnit) {
373
411
  return React__default.createElement(ADInfeed, { index: index, infeedAd: article });
374
412
  }
@@ -376,7 +414,7 @@ var cardLoader = function cardLoader(data, builder, mapping, values, seoPaginate
376
414
  return renderMobileAd(index, numberOfItemsBeforeAd, rightItems);
377
415
  }
378
416
 
379
- if (brandInsightAd ? index > heroContent + featureCount : index + 1 > heroContent + featureCount) {
417
+ if ((brandInsightAd ? index > heroContent + featureCount : index + 1 > heroContent + featureCount) && article._type && !['lg-infeed', 'brandInsightAd'].includes(article._type)) {
380
418
  return React__default.createElement(
381
419
  VisibilitySensor,
382
420
  {
@@ -552,7 +590,9 @@ var QueueDeckExpanded = function QueueDeckExpanded(props) {
552
590
  _props$showBI = props.showBI,
553
591
  showBI = _props$showBI === undefined ? false : _props$showBI,
554
592
  _props$heroContent = props.heroContent,
555
- heroContent = _props$heroContent === undefined ? 0 : _props$heroContent;
593
+ heroContent = _props$heroContent === undefined ? 0 : _props$heroContent,
594
+ _props$lgInfeedAd = props.lgInfeedAd,
595
+ lgInfeedAd = _props$lgInfeedAd === undefined ? false : _props$lgInfeedAd;
556
596
  var initialCurrentPage = props.currentPage,
557
597
  showPublished = props.showPublished;
558
598
 
@@ -586,11 +626,18 @@ var QueueDeckExpanded = function QueueDeckExpanded(props) {
586
626
  values = _useState10[0],
587
627
  setValues = _useState10[1];
588
628
 
629
+ var _useState11 = useState(false),
630
+ _useState12 = _slicedToArray(_useState11, 2),
631
+ dektopView = _useState12[0],
632
+ setDesktopView = _useState12[1];
633
+
589
634
  var itemsPerPage = params && params.itemsPerPage ? params.itemsPerPage : 10;
590
635
 
591
636
  var prevValues = usePrevious(values);
592
-
593
637
  useEffect(function () {
638
+ if (lgInfeedAd && window && window.innerWidth >= 1200) {
639
+ setDesktopView(true);
640
+ }
594
641
  if (prevValues) {
595
642
  if (values.page !== prevValues.page && values.from !== prevValues.from && values.to !== prevValues.from) {
596
643
  loadData(values, query, client, params, setData, setScrolling, pointer, pointerArray);
@@ -627,7 +674,7 @@ var QueueDeckExpanded = function QueueDeckExpanded(props) {
627
674
  React__default.createElement(
628
675
  Container,
629
676
  null,
630
- cardLoader(data, builder, mapping, values, seoPaginate, pageview, router, currentPage, setCurrentPage, showPublished, defaultImage, showAuthor, showCategory, imageHeight, imageWidth, rightItems, brandInsightAd, showBI, itemsPerPage, heroContent)
677
+ cardLoader(data, builder, mapping, values, seoPaginate, pageview, router, currentPage, setCurrentPage, showPublished, defaultImage, showAuthor, showCategory, imageHeight, imageWidth, rightItems, brandInsightAd, showBI, itemsPerPage, heroContent, dektopView)
631
678
  )
632
679
  ),
633
680
  React__default.createElement(
@@ -641,7 +688,7 @@ var QueueDeckExpanded = function QueueDeckExpanded(props) {
641
688
  React__default.createElement(
642
689
  Container,
643
690
  null,
644
- cardLoader(data, builder, mapping, values, seoPaginate, pageview, router, currentPage, setCurrentPage, showPublished, defaultImage, showAuthor, showCategory, rightItems, brandInsightAd, showBI, itemsPerPage, heroContent)
691
+ cardLoader(data, builder, mapping, values, seoPaginate, pageview, router, currentPage, setCurrentPage, showPublished, defaultImage, showAuthor, showCategory, rightItems, brandInsightAd, showBI, itemsPerPage, heroContent, dektopView)
645
692
  ),
646
693
  React__default.createElement(
647
694
  'div',
@@ -19,7 +19,7 @@ import './react-social-icons-a7d5c5c7.js';
19
19
  import 'react-bootstrap';
20
20
  import './index.esm-536609db.js';
21
21
  import 'react-bootstrap/Button';
22
- export { T as default } from './Normal-0095df68.js';
22
+ export { T as default } from './Normal-6eba8168.js';
23
23
  import 'react-bootstrap/ListGroup';
24
24
  import 'next/head';
25
25
  import 'react-bootstrap/Nav';
package/dist/esm/index.js CHANGED
@@ -30,8 +30,10 @@ export { D as AdSlot, B as Beam } from './AdSlot-78e48a2c.js';
30
30
  import { _ as _anInstance, a as _forOf, b as _redefineAll, c as _setSpecies } from './promise-2592a80a.js';
31
31
  import './ADInfeed-e5cefea5.js';
32
32
  export { default as DeckContent } from './DeckContent.js';
33
+ import './lodash-17fdfebb.js';
34
+ import './ADlgInfeed-51a2801a.js';
33
35
  import { i as isFunction_1, a as isArray_1, _ as _arrayMap } from './get-53653403.js';
34
- export { A as AD, G as GridContent } from './GridContent-e3224519.js';
36
+ export { A as AD, G as GridContent } from './GridContent-90c0f8b5.js';
35
37
  import { A as AuthorComponent } from './AuthorComponent-c9e46673.js';
36
38
  export { default as DeckQueue } from './DeckQueue.js';
37
39
  import 'react-bootstrap/Media';
@@ -55,8 +57,8 @@ export { default as IssueDeck } from './IssueDeck.js';
55
57
  import 'react-bootstrap/Badge';
56
58
  export { default as IssueContentDeck } from './IssueContentDeck.js';
57
59
  import Spinner from 'react-bootstrap/Spinner';
58
- import { M as MdPictureAsPdf } from './Normal-0095df68.js';
59
- export { A as AD728x90, g as ADSponsoredResources, C as Column1, a as Column2, b as Column3, f as HamMagazine, H as Header, L as LeftNav, e as NavDvm, c as NavMagazine, N as NavNative, d as NavNormal, P as PageFilter, S as Search, h as SideFooter, T as TemplateNormal } from './Normal-0095df68.js';
60
+ import { M as MdPictureAsPdf } from './Normal-6eba8168.js';
61
+ export { A as AD728x90, g as ADSponsoredResources, C as Column1, a as Column2, b as Column3, f as HamMagazine, H as Header, L as LeftNav, e as NavDvm, c as NavMagazine, N as NavNative, d as NavNormal, P as PageFilter, S as Search, h as SideFooter, T as TemplateNormal } from './Normal-6eba8168.js';
60
62
  import 'react-bootstrap/ListGroup';
61
63
  import Head from 'next/head';
62
64
  import Accordion from 'react-bootstrap/Accordion';
@@ -17777,30 +17779,30 @@ var ArticleQueue = function ArticleQueue(props) {
17777
17779
  if (visibility === 'top') {
17778
17780
  // router.push('/view/[url]', newPath, { shallow: true })
17779
17781
  window.history.pushState({ page: path }, meta.shareTitle, newPath);
17782
+ changeMeta(meta);
17780
17783
  if (props.pageview) {
17781
17784
  props.pageview(newPath);
17782
17785
  }
17783
17786
  refreshAD(path);
17784
- changeMeta(meta);
17785
17787
  }
17786
17788
  } else {
17787
17789
  if (visibility === 'bottom') {
17788
17790
  // router.push('/view/[url]', newPath, { shallow: true })
17789
17791
  window.history.pushState({ page: path }, meta.shareTitle, newPath);
17792
+ changeMeta(meta);
17790
17793
  if (props.pageview) {
17791
17794
  props.pageview(newPath);
17792
17795
  }
17793
17796
  refreshAD(path);
17794
- changeMeta(meta);
17795
17797
  }
17796
17798
  }
17797
17799
  if (visibility === 'small-top') {
17798
17800
  window.history.pushState({ page: path }, meta.shareTitle, newPath);
17801
+ changeMeta(meta);
17799
17802
  if (props.pageview) {
17800
17803
  props.pageview(newPath);
17801
17804
  }
17802
17805
  refreshAD(path);
17803
- changeMeta(meta);
17804
17806
  }
17805
17807
  }
17806
17808
  };
@@ -22861,30 +22863,30 @@ var ArticleQueue$1 = function ArticleQueue(props) {
22861
22863
  if (visibility === 'top') {
22862
22864
  // router.push('/view/[url]', newPath, { shallow: true })
22863
22865
  window.history.pushState({ page: path }, meta.shareTitle, newPath);
22866
+ changeMeta(meta);
22864
22867
  if (props.pageview) {
22865
22868
  props.pageview(newPath);
22866
22869
  }
22867
22870
  refreshAD(path);
22868
- changeMeta(meta);
22869
22871
  }
22870
22872
  } else {
22871
22873
  if (visibility === 'bottom') {
22872
22874
  // router.push('/view/[url]', newPath, { shallow: true })
22873
22875
  window.history.pushState({ page: path }, meta.shareTitle, newPath);
22876
+ changeMeta(meta);
22874
22877
  if (props.pageview) {
22875
22878
  props.pageview(newPath);
22876
22879
  }
22877
22880
  refreshAD(path);
22878
- changeMeta(meta);
22879
22881
  }
22880
22882
  }
22881
22883
  if (visibility === 'small-top') {
22882
22884
  window.history.pushState({ page: path }, meta.shareTitle, newPath);
22885
+ changeMeta(meta);
22883
22886
  if (props.pageview) {
22884
22887
  props.pageview(newPath);
22885
22888
  }
22886
22889
  refreshAD(path);
22887
- changeMeta(meta);
22888
22890
  }
22889
22891
  }
22890
22892
  };