@mjhls/mjh-framework 1.0.436 → 1.0.438

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.
@@ -0,0 +1,43 @@
1
+ import React__default from 'react';
2
+ import 'react-bootstrap/Card';
3
+ import { D as DFPAdSlot } from './AdSlot-78e48a2c.js';
4
+
5
+ var ADlgInfeed = function ADlgInfeed(props) {
6
+ var className = props.className,
7
+ slotId = props.slotId,
8
+ adUnit = props.adUnit,
9
+ _props$targeting = props.targeting,
10
+ targeting = _props$targeting === undefined ? {} : _props$targeting,
11
+ networkID = props.networkID,
12
+ sizes = props.sizes,
13
+ index = props.index;
14
+
15
+ var collapseAd = function collapseAd() {
16
+ var parent = document.getElementById('lg-infeed-wrapper-' + (index + 1));
17
+ parent.style.height = '0%';
18
+ parent.style.width = '0%';
19
+ parent.style.display = 'none';
20
+ };
21
+
22
+ var checkIsAdFound = function checkIsAdFound(isFound) {
23
+ if (isFound) {
24
+ var parent = document.getElementById('lg-infeed-wrapper-' + (index + 1));
25
+ parent.style.display = 'flex';
26
+ } else {
27
+ collapseAd();
28
+ }
29
+ };
30
+
31
+ return React__default.createElement(
32
+ 'div',
33
+ { id: 'lg-infeed-wrapper-' + (index + 1), className: 'lg-infeed-wrapper', style: { display: 'none', flex: '1 0 auto' } },
34
+ React__default.createElement(DFPAdSlot, { className: className, networkID: networkID, adUnit: adUnit, slotId: slotId, targeting: targeting, sizes: sizes, checkIsAdFound: checkIsAdFound, refreshFlag: false }),
35
+ React__default.createElement(
36
+ 'style',
37
+ { jsx: 'true' },
38
+ '\n .lg-infeed-wrapper {\n flex-direction: row;\n margin-bottom: 1.25rem;\n padding-bottom: 1.25rem;\n border-bottom: 1px solid rgb(221, 221, 221);\n }\n '
39
+ )
40
+ );
41
+ };
42
+
43
+ export { ADlgInfeed as A };
@@ -16,6 +16,8 @@ import { L as LazyLoad } from './index-5f9f807a.js';
16
16
  import { m as main_39 } from './main-7d1b3c98.js';
17
17
  import { c as clean_html_1 } from './entities-7cc3bf45.js';
18
18
  import { A as ADInfeed } from './ADInfeed-e5cefea5.js';
19
+ import { l as lodash } from './lodash-17fdfebb.js';
20
+ import { A as ADlgInfeed } from './ADlgInfeed-51a2801a.js';
19
21
  import { g as get_1 } from './get-53653403.js';
20
22
  import { A as AuthorComponent } from './AuthorComponent-c9e46673.js';
21
23
 
@@ -65,7 +67,9 @@ var GridContent = function (_React$Component) {
65
67
  total_pages: null,
66
68
  scrolling: true,
67
69
  query: _this.query,
68
- currentPage: _this.props.currentPage || 1
70
+ currentPage: _this.props.currentPage || 1,
71
+ lgInfeedAd: _this.props.lgInfeedAd ? _this.props.lgInfeedAd : false,
72
+ desktopView: false
69
73
  }, _this.loadMore = debounce_1(function () {
70
74
  _this.setState(function (state) {
71
75
  var page = state.page,
@@ -80,6 +84,13 @@ var GridContent = function (_React$Component) {
80
84
  };
81
85
  }, _this.loadData);
82
86
  }, 0), _this.componentDidMount = function () {
87
+ if (_this.state.lgInfeedAd && window && window.innerWidth >= 1200) {
88
+ _this.setState(function (state) {
89
+ return _extends({}, state, {
90
+ desktopView: true
91
+ });
92
+ });
93
+ }
83
94
  document.addEventListener('scroll', _this.trackScrolling);
84
95
  }, _this.componentWillUnmount = function () {
85
96
  document.removeEventListener('scroll', _this.trackScrolling);
@@ -240,7 +251,7 @@ var GridContent = function (_React$Component) {
240
251
 
241
252
  _createClass(GridContent, [{
242
253
  key: 'cardLoader',
243
- value: function cardLoader(page, columns, variant, showVideo, VideoPlayer, showBI, brandInsight) {
254
+ value: function cardLoader(page, columns, variant, showVideo, VideoPlayer, showBI, brandInsight, desktopView) {
244
255
  var _this2 = this;
245
256
 
246
257
  var lgVar = Math.floor(12 / columns);
@@ -330,32 +341,74 @@ var GridContent = function (_React$Component) {
330
341
  return [].concat(_toConsumableArray(arr.slice(0, index)), [newElement], _toConsumableArray(arr.slice(index)));
331
342
  };
332
343
  var posts = [];
333
- if (showBI) {
334
- var data = this.state.data;
335
- posts = data;
336
- var pos = 3;
337
- for (var i = 1; pos < posts.length; i++) {
338
- var inFeedAd = {
344
+ if (brandInsight && (desktopView || showBI)) {
345
+ var firstThree = this.state.data.slice(0, 3);
346
+ var data = this.state.data.slice(3);
347
+
348
+ if (desktopView) {
349
+ var lgInFeedAd = {
350
+ _type: 'lg-infeed',
339
351
  adUnit: brandInsight.adUnit,
340
- className: brandInsight.className,
352
+ className: 'lg-infeed',
341
353
  networkID: brandInsight.networkID,
342
- sizes: brandInsight.sizes,
343
- slotId: brandInsight.slotId + '_' + i,
354
+ sizes: [728, 90],
344
355
  targeting: {
345
- pos: 'article' + i,
346
356
  content_placement: brandInsight.targeting.content_placement,
347
357
  document_url: brandInsight.targeting.document_url
348
- },
349
- _type: 'BrandInsight'
358
+ }
350
359
  };
360
+ var chunks = lodash.chunk(data, 6).map(function (chunk) {
361
+ var set = lodash.chunk(chunk, 2);
362
+ for (var i = 0; i < set.length; i++) {
363
+ if (i !== set.length - 1) {
364
+ set[i].push(lgInFeedAd);
365
+ }
366
+ }
367
+ return lodash.flattenDeep(set);
368
+ });
351
369
 
352
- posts = insert(posts, pos, inFeedAd);
353
- pos += brandInsight.interval + 1;
370
+ posts = lodash.flatten(chunks);
354
371
  }
372
+
373
+ if (showBI) {
374
+ if (desktopView) {
375
+ brandInsight.interval = 8;
376
+ } else {
377
+ brandInsight.interval = 5;
378
+ posts = data;
379
+ }
380
+
381
+ var pos = 0;
382
+ for (var i = 1; pos < posts.length; i++) {
383
+ var inFeedAd = {
384
+ adUnit: brandInsight.adUnit,
385
+ className: brandInsight.className,
386
+ networkID: brandInsight.networkID,
387
+ sizes: brandInsight.sizes,
388
+ slotId: brandInsight.slotId + '_' + i,
389
+ targeting: {
390
+ pos: 'article' + i,
391
+ content_placement: brandInsight.targeting.content_placement,
392
+ document_url: brandInsight.targeting.document_url
393
+ },
394
+ _type: 'BrandInsight'
395
+ };
396
+
397
+ posts = insert(posts, pos, inFeedAd);
398
+ pos += brandInsight.interval + 1;
399
+ }
400
+ }
401
+ posts = firstThree.concat(posts);
402
+ posts = posts.map(function (ele, i) {
403
+ if (ele._type === 'lg-infeed') {
404
+ return _extends({}, ele, { slotId: 'lg-infeed_' + i, targeting: _extends({}, ele.targeting, { pos: 'lg-infeed_' + i }) });
405
+ } else {
406
+ return ele;
407
+ }
408
+ });
355
409
  } else {
356
410
  posts = this.state.data;
357
411
  }
358
-
359
412
  var itemsPerPage = this.props.params && this.props.params.itemsPerPage ? this.props.params.itemsPerPage : 10;
360
413
  var heroContent = this.props.heroContent ? this.props.heroContent : 0;
361
414
  var featureCount = 0;
@@ -497,10 +550,12 @@ var GridContent = function (_React$Component) {
497
550
  main_39 && _this2.props.rightItems && (index + 1) % numberOfItemsBeforeAd === 0 && _this2.renderMobileAd(index, numberOfItemsBeforeAd)
498
551
  );
499
552
  }
553
+ } else if (row._type === 'lg-infeed' && row.adUnit) {
554
+ return React__default.createElement(ADlgInfeed, _extends({ index: index }, row));
500
555
  } else if (row._type === 'BrandInsight' && row.adUnit) {
501
556
  return React__default.createElement(ADInfeed, { index: index, infeedAd: row });
502
557
  }
503
- if (index + 1 > heroContent + featureCount) {
558
+ if (index + 1 > heroContent + featureCount && row._type && !['lg-infeed', 'brandInsightAd'].includes(row._type)) {
504
559
  return React__default.createElement(
505
560
  React__default.Fragment,
506
561
  { key: itemCounter },
@@ -604,7 +659,7 @@ var GridContent = function (_React$Component) {
604
659
  React__default.createElement(
605
660
  Container,
606
661
  null,
607
- this.cardLoader(page, columns, variant, showVideo, VideoPlayer, showBI, brandInsight)
662
+ this.cardLoader(page, columns, variant, showVideo, VideoPlayer, showBI, brandInsight, this.state.desktopView)
608
663
  )
609
664
  ) : React__default.createElement(
610
665
  React__default.Fragment,
@@ -612,7 +667,7 @@ var GridContent = function (_React$Component) {
612
667
  React__default.createElement(
613
668
  Container,
614
669
  null,
615
- this.cardLoader(page, columns, variant, showVideo, VideoPlayer, showBI, brandInsight)
670
+ this.cardLoader(page, columns, variant, showVideo, VideoPlayer, showBI, brandInsight, this.state.desktopView)
616
671
  ),
617
672
  React__default.createElement(
618
673
  'div',
@@ -28,6 +28,8 @@ import './slicedToArray-04e02710.js';
28
28
  import './AdSlot-78e48a2c.js';
29
29
  import './promise-2592a80a.js';
30
30
  import './ADInfeed-e5cefea5.js';
31
+ import './lodash-17fdfebb.js';
32
+ import './ADlgInfeed-51a2801a.js';
31
33
  import './get-53653403.js';
32
- export { G as default } from './GridContent-e3224519.js';
34
+ export { G as default } from './GridContent-90c0f8b5.js';
33
35
  import './AuthorComponent-c9e46673.js';
@@ -2081,7 +2081,6 @@ var AD728x90 = function AD728x90(_ref) {
2081
2081
  _ref$fixedPos = _ref.fixedPos,
2082
2082
  fixedPos = _ref$fixedPos === undefined ? '60px' : _ref$fixedPos;
2083
2083
 
2084
-
2085
2084
  var mobileView = false;
2086
2085
  if (main_39) {
2087
2086
  pos = 'top-mobile';