@mjhls/mjh-framework 1.0.461 → 1.0.463

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/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # mjh-framework v. 1.0.461
1
+ # mjh-framework v. 1.0.463
2
2
 
3
3
  > Foundation Framework
4
4
 
@@ -160,6 +160,13 @@ var Article = function Article(props) {
160
160
  _useState2 = slicedToArray._slicedToArray(_useState, 2),
161
161
  contextualADFlag = _useState2[0],
162
162
  setContextualADFlag = _useState2[1];
163
+ // Setting new Flag 'visibleFlag' to know when the article is visible so that new contextual ad can be appended into DOM.
164
+
165
+
166
+ var _useState3 = React.useState(false),
167
+ _useState4 = slicedToArray._slicedToArray(_useState3, 2),
168
+ visibleFlag = _useState4[0],
169
+ setVisibleFlag = _useState4[1];
163
170
 
164
171
  var summary = getArticleSummary(props.article);
165
172
 
@@ -323,6 +330,8 @@ var Article = function Article(props) {
323
330
  contextualAD: _extends._extends({}, payload.contextualAD, {
324
331
  slotId: (payload.contextualAD.slotId || 'contextual_ad') + '-' + payload._id,
325
332
  className: 'ADFluid',
333
+ // Fetching new contextual targeting based on the current active article.
334
+ targeting: props.getTargeting(props.article, 'native-ad'),
326
335
  // Adding new ad size for large contextual ad for desktop screen width >= 1400
327
336
  sizes: lgContextAd ? [[728, 90], 'fluid', [300, 100]] : ['fluid', [300, 100]],
328
337
  sizeMapping: lgContextAd ? [{
@@ -368,7 +377,7 @@ var Article = function Article(props) {
368
377
  imageOptions: { w: 320, h: 240, fit: 'max' }
369
378
  }, client.config())),
370
379
  contextualADFlag && React__default.createElement('span', { className: 'clearfix' }),
371
- React__default.createElement(
380
+ (visibleFlag || queueData && queueData.length === 1) && React__default.createElement(
372
381
  'div',
373
382
  { id: 'contextual-native-ad-' + payload._id, className: 'contextual-native-ad' },
374
383
  React__default.createElement(AdSlot, _extends._extends({}, payload.contextualAD, { refreshFlag: false, checkIsAdFound: _checkIsAdFound }))
@@ -466,6 +475,8 @@ var Article = function Article(props) {
466
475
  onChange: function onChange(visible) {
467
476
  if (visible === 'top' || visible === 'bottom' || visible === 'small-top') {
468
477
  onChangeArticle(url, visible, meta);
478
+ // Setting 'visibleFlag' to know that the article is visible.
479
+ setVisibleFlag(true);
469
480
  }
470
481
  } },
471
482
  React__default.createElement(
@@ -733,10 +744,10 @@ var ArticleQueue = function ArticleQueue(props) {
733
744
  return article;
734
745
  };
735
746
 
736
- var _useState3 = React.useState([firstArticle()]),
737
- _useState4 = slicedToArray._slicedToArray(_useState3, 2),
738
- queueData = _useState4[0],
739
- setQueueData = _useState4[1];
747
+ var _useState5 = React.useState([firstArticle()]),
748
+ _useState6 = slicedToArray._slicedToArray(_useState5, 2),
749
+ queueData = _useState6[0],
750
+ setQueueData = _useState6[1];
740
751
 
741
752
  var refreshAD = function refreshAD(path) {
742
753
  if (!main.main_36) {
@@ -877,6 +888,8 @@ var ArticleQueue = function ArticleQueue(props) {
877
888
  article: article,
878
889
  cpModificationRequired: cpModificationRequired,
879
890
  queueData: queueData
891
+ // Passing 'getTargeting' so that contextual AD can fetch target based on current active article.
892
+ , getTargeting: getTargeting
880
893
  }));
881
894
  })
882
895
  );
package/dist/cjs/View.js CHANGED
@@ -301,30 +301,40 @@ var Article = function Article(props) {
301
301
  ISIContent = props.ISIContent,
302
302
  shareOptions = props.shareOptions,
303
303
  cpModificationRequired = props.cpModificationRequired,
304
- authorPrefix = props.authorPrefix;
304
+ authorPrefix = props.authorPrefix,
305
+ _props$lgContextAd = props.lgContextAd,
306
+ lgContextAd = _props$lgContextAd === undefined ? false : _props$lgContextAd,
307
+ queueData = props.queueData;
305
308
  var onChangeArticle = props.onChangeArticle;
306
309
 
307
310
  var _useState = React.useState(null),
308
311
  _useState2 = slicedToArray._slicedToArray(_useState, 2),
309
312
  contextualADFlag = _useState2[0],
310
313
  setContextualADFlag = _useState2[1];
314
+ // Setting new Flag 'visibleFlag' to know when the article is visible so that new contextual ad can be appended into DOM.
311
315
 
312
- var summary = getArticleSummary(props.article);
313
316
 
314
- var _useState3 = React.useState(1),
317
+ var _useState3 = React.useState(false),
315
318
  _useState4 = slicedToArray._slicedToArray(_useState3, 2),
316
- auth = _useState4[0],
317
- setAuth = _useState4[1];
319
+ visibleFlag = _useState4[0],
320
+ setVisibleFlag = _useState4[1];
321
+
322
+ var summary = getArticleSummary(props.article);
318
323
 
319
- var _useState5 = React.useState(''),
324
+ var _useState5 = React.useState(1),
320
325
  _useState6 = slicedToArray._slicedToArray(_useState5, 2),
321
- passwordKey = _useState6[0],
322
- setPasswordKey = _useState6[1];
326
+ auth = _useState6[0],
327
+ setAuth = _useState6[1];
323
328
 
324
- var _useState7 = React.useState(false),
329
+ var _useState7 = React.useState(''),
325
330
  _useState8 = slicedToArray._slicedToArray(_useState7, 2),
326
- showVotes = _useState8[0],
327
- setShowVotes = _useState8[1];
331
+ passwordKey = _useState8[0],
332
+ setPasswordKey = _useState8[1];
333
+
334
+ var _useState9 = React.useState(false),
335
+ _useState10 = slicedToArray._slicedToArray(_useState9, 2),
336
+ showVotes = _useState10[0],
337
+ setShowVotes = _useState10[1];
328
338
 
329
339
  var isCutomPage = function isCutomPage(article) {
330
340
  var url = article.url.current;
@@ -462,7 +472,6 @@ var Article = function Article(props) {
462
472
  setContextualADFlag(true);
463
473
  }
464
474
  };
465
-
466
475
  return React__default.createElement(
467
476
  React__default.Fragment,
468
477
  null,
@@ -492,7 +501,15 @@ var Article = function Article(props) {
492
501
  } else if (indexes.length >= 2 && body.length > 3 && payload.contextualAD && !payload.contextualVideoAD) {
493
502
  payload = _extends._extends({}, payload, {
494
503
  contextualAD: _extends._extends({}, payload.contextualAD, {
495
- slotId: (payload.contextualAD.slotId || 'native-ad') + '-' + payload._id
504
+ slotId: (payload.contextualAD.slotId || 'native-ad') + '-' + payload._id,
505
+ // Fetching new contextual targeting based on the current active article.
506
+ targeting: props.getTargeting(props.article, 'native-ad'),
507
+ // Adding new ad size for large contextual ad for desktop screen width >= 1400
508
+ sizes: lgContextAd ? [[728, 90], 'fluid', [300, 100]] : ['fluid', [300, 100]],
509
+ sizeMapping: lgContextAd ? [{
510
+ viewport: [1400, 0],
511
+ sizes: [[728, 90], 'fluid', [300, 100]]
512
+ }, { viewport: [0, 0], sizes: ['fluid', [300, 100]] }] : ['fluid', [300, 100]]
496
513
  })
497
514
  });
498
515
  var _selectedIndex = indexes[1] + 1;
@@ -520,7 +537,7 @@ var Article = function Article(props) {
520
537
  imageOptions: { w: 320, h: 240, fit: 'max' }
521
538
  }, client.config())),
522
539
  contextualADFlag && React__default.createElement('span', { className: 'clearfix' }),
523
- React__default.createElement(
540
+ (visibleFlag || queueData && queueData.length === 1) && React__default.createElement(
524
541
  'div',
525
542
  { id: 'contextual-native-ad-' + payload._id, className: 'contextual-native-ad' },
526
543
  React__default.createElement(AdSlot, _extends._extends({}, payload.contextualAD, { refreshFlag: false, checkIsAdFound: _checkIsAdFound }))
@@ -625,6 +642,8 @@ var Article = function Article(props) {
625
642
  onChange: function onChange(visible) {
626
643
  if (visible === 'top' || visible === 'bottom' || visible === 'small-top') {
627
644
  onChangeArticle(url, visible, meta);
645
+ // Setting 'visibleFlag' to know that the article is visible.
646
+ setVisibleFlag(true);
628
647
  }
629
648
  } },
630
649
  React__default.createElement(
@@ -1030,7 +1049,16 @@ var ArticleQueue = function ArticleQueue(props) {
1030
1049
  if (!checkSponseredArticle(article) && Ads.getNativeContextualAD) {
1031
1050
  article.contextualAD = Ads.getNativeContextualAD(getTargeting.getTargeting(props));
1032
1051
  }
1033
- return React__default.createElement(Article, _extends._extends({ key: index }, props, { onChangeArticle: onChangeArticle, authorPrfix: authorPrefix, article: article, cpModificationRequired: cpModificationRequired }));
1052
+ return React__default.createElement(Article, _extends._extends({
1053
+ key: index
1054
+ }, props, {
1055
+ onChangeArticle: onChangeArticle,
1056
+ authorPrfix: authorPrefix,
1057
+ article: article,
1058
+ cpModificationRequired: cpModificationRequired
1059
+ // Passing queueData to check for single article
1060
+ , queueData: queueData
1061
+ }));
1034
1062
  })
1035
1063
  );
1036
1064
  };
@@ -2018,7 +2018,7 @@ var Sidebar = function Sidebar(_ref) {
2018
2018
  React__default.createElement(
2019
2019
  'style',
2020
2020
  { jsx: 'true' },
2021
- '\n .sidebar {\n clear: both;\n float: right;\n background-color: #eee;\n width: 40%;\n padding: 1rem;\n margin: 0 0 1rem 1rem;\n }\n @media screen and (max-width: 991px) {\n .sidebar {\n float: none;\n width: auto;\n margin: 1rem 0;\n }\n }\n '
2021
+ '\n .sidebar {\n clear: both;\n float: right;\n background-color: #eee;\n width: 40%;\n padding: 1rem;\n margin: 0 0 1rem 1rem;\n }\n // resolving list items inside sidebar being shifted to center because of unusual margin\n .sidebar ul {\n margin-left: 0;\n padding-left: 2rem;\n }\n @media screen and (max-width: 991px) {\n .sidebar {\n float: none;\n width: auto;\n margin: 1rem 0;\n }\n }\n '
2022
2022
  )
2023
2023
  );
2024
2024
  };
@@ -155,6 +155,13 @@ var Article = function Article(props) {
155
155
  _useState2 = _slicedToArray(_useState, 2),
156
156
  contextualADFlag = _useState2[0],
157
157
  setContextualADFlag = _useState2[1];
158
+ // Setting new Flag 'visibleFlag' to know when the article is visible so that new contextual ad can be appended into DOM.
159
+
160
+
161
+ var _useState3 = useState(false),
162
+ _useState4 = _slicedToArray(_useState3, 2),
163
+ visibleFlag = _useState4[0],
164
+ setVisibleFlag = _useState4[1];
158
165
 
159
166
  var summary = getArticleSummary(props.article);
160
167
 
@@ -318,6 +325,8 @@ var Article = function Article(props) {
318
325
  contextualAD: _extends({}, payload.contextualAD, {
319
326
  slotId: (payload.contextualAD.slotId || 'contextual_ad') + '-' + payload._id,
320
327
  className: 'ADFluid',
328
+ // Fetching new contextual targeting based on the current active article.
329
+ targeting: props.getTargeting(props.article, 'native-ad'),
321
330
  // Adding new ad size for large contextual ad for desktop screen width >= 1400
322
331
  sizes: lgContextAd ? [[728, 90], 'fluid', [300, 100]] : ['fluid', [300, 100]],
323
332
  sizeMapping: lgContextAd ? [{
@@ -363,7 +372,7 @@ var Article = function Article(props) {
363
372
  imageOptions: { w: 320, h: 240, fit: 'max' }
364
373
  }, client.config())),
365
374
  contextualADFlag && React__default.createElement('span', { className: 'clearfix' }),
366
- React__default.createElement(
375
+ (visibleFlag || queueData && queueData.length === 1) && React__default.createElement(
367
376
  'div',
368
377
  { id: 'contextual-native-ad-' + payload._id, className: 'contextual-native-ad' },
369
378
  React__default.createElement(DFPAdSlot, _extends({}, payload.contextualAD, { refreshFlag: false, checkIsAdFound: _checkIsAdFound }))
@@ -461,6 +470,8 @@ var Article = function Article(props) {
461
470
  onChange: function onChange(visible) {
462
471
  if (visible === 'top' || visible === 'bottom' || visible === 'small-top') {
463
472
  onChangeArticle(url, visible, meta);
473
+ // Setting 'visibleFlag' to know that the article is visible.
474
+ setVisibleFlag(true);
464
475
  }
465
476
  } },
466
477
  React__default.createElement(
@@ -728,10 +739,10 @@ var ArticleQueue = function ArticleQueue(props) {
728
739
  return article;
729
740
  };
730
741
 
731
- var _useState3 = useState([firstArticle()]),
732
- _useState4 = _slicedToArray(_useState3, 2),
733
- queueData = _useState4[0],
734
- setQueueData = _useState4[1];
742
+ var _useState5 = useState([firstArticle()]),
743
+ _useState6 = _slicedToArray(_useState5, 2),
744
+ queueData = _useState6[0],
745
+ setQueueData = _useState6[1];
735
746
 
736
747
  var refreshAD = function refreshAD(path) {
737
748
  if (!main_36) {
@@ -872,6 +883,8 @@ var ArticleQueue = function ArticleQueue(props) {
872
883
  article: article,
873
884
  cpModificationRequired: cpModificationRequired,
874
885
  queueData: queueData
886
+ // Passing 'getTargeting' so that contextual AD can fetch target based on current active article.
887
+ , getTargeting: getTargeting
875
888
  }));
876
889
  })
877
890
  );
package/dist/esm/View.js CHANGED
@@ -296,30 +296,40 @@ var Article = function Article(props) {
296
296
  ISIContent = props.ISIContent,
297
297
  shareOptions = props.shareOptions,
298
298
  cpModificationRequired = props.cpModificationRequired,
299
- authorPrefix = props.authorPrefix;
299
+ authorPrefix = props.authorPrefix,
300
+ _props$lgContextAd = props.lgContextAd,
301
+ lgContextAd = _props$lgContextAd === undefined ? false : _props$lgContextAd,
302
+ queueData = props.queueData;
300
303
  var onChangeArticle = props.onChangeArticle;
301
304
 
302
305
  var _useState = useState(null),
303
306
  _useState2 = _slicedToArray(_useState, 2),
304
307
  contextualADFlag = _useState2[0],
305
308
  setContextualADFlag = _useState2[1];
309
+ // Setting new Flag 'visibleFlag' to know when the article is visible so that new contextual ad can be appended into DOM.
306
310
 
307
- var summary = getArticleSummary(props.article);
308
311
 
309
- var _useState3 = useState(1),
312
+ var _useState3 = useState(false),
310
313
  _useState4 = _slicedToArray(_useState3, 2),
311
- auth = _useState4[0],
312
- setAuth = _useState4[1];
314
+ visibleFlag = _useState4[0],
315
+ setVisibleFlag = _useState4[1];
316
+
317
+ var summary = getArticleSummary(props.article);
313
318
 
314
- var _useState5 = useState(''),
319
+ var _useState5 = useState(1),
315
320
  _useState6 = _slicedToArray(_useState5, 2),
316
- passwordKey = _useState6[0],
317
- setPasswordKey = _useState6[1];
321
+ auth = _useState6[0],
322
+ setAuth = _useState6[1];
318
323
 
319
- var _useState7 = useState(false),
324
+ var _useState7 = useState(''),
320
325
  _useState8 = _slicedToArray(_useState7, 2),
321
- showVotes = _useState8[0],
322
- setShowVotes = _useState8[1];
326
+ passwordKey = _useState8[0],
327
+ setPasswordKey = _useState8[1];
328
+
329
+ var _useState9 = useState(false),
330
+ _useState10 = _slicedToArray(_useState9, 2),
331
+ showVotes = _useState10[0],
332
+ setShowVotes = _useState10[1];
323
333
 
324
334
  var isCutomPage = function isCutomPage(article) {
325
335
  var url = article.url.current;
@@ -457,7 +467,6 @@ var Article = function Article(props) {
457
467
  setContextualADFlag(true);
458
468
  }
459
469
  };
460
-
461
470
  return React__default.createElement(
462
471
  React__default.Fragment,
463
472
  null,
@@ -487,7 +496,15 @@ var Article = function Article(props) {
487
496
  } else if (indexes.length >= 2 && body.length > 3 && payload.contextualAD && !payload.contextualVideoAD) {
488
497
  payload = _extends({}, payload, {
489
498
  contextualAD: _extends({}, payload.contextualAD, {
490
- slotId: (payload.contextualAD.slotId || 'native-ad') + '-' + payload._id
499
+ slotId: (payload.contextualAD.slotId || 'native-ad') + '-' + payload._id,
500
+ // Fetching new contextual targeting based on the current active article.
501
+ targeting: props.getTargeting(props.article, 'native-ad'),
502
+ // Adding new ad size for large contextual ad for desktop screen width >= 1400
503
+ sizes: lgContextAd ? [[728, 90], 'fluid', [300, 100]] : ['fluid', [300, 100]],
504
+ sizeMapping: lgContextAd ? [{
505
+ viewport: [1400, 0],
506
+ sizes: [[728, 90], 'fluid', [300, 100]]
507
+ }, { viewport: [0, 0], sizes: ['fluid', [300, 100]] }] : ['fluid', [300, 100]]
491
508
  })
492
509
  });
493
510
  var _selectedIndex = indexes[1] + 1;
@@ -515,7 +532,7 @@ var Article = function Article(props) {
515
532
  imageOptions: { w: 320, h: 240, fit: 'max' }
516
533
  }, client.config())),
517
534
  contextualADFlag && React__default.createElement('span', { className: 'clearfix' }),
518
- React__default.createElement(
535
+ (visibleFlag || queueData && queueData.length === 1) && React__default.createElement(
519
536
  'div',
520
537
  { id: 'contextual-native-ad-' + payload._id, className: 'contextual-native-ad' },
521
538
  React__default.createElement(DFPAdSlot, _extends({}, payload.contextualAD, { refreshFlag: false, checkIsAdFound: _checkIsAdFound }))
@@ -620,6 +637,8 @@ var Article = function Article(props) {
620
637
  onChange: function onChange(visible) {
621
638
  if (visible === 'top' || visible === 'bottom' || visible === 'small-top') {
622
639
  onChangeArticle(url, visible, meta);
640
+ // Setting 'visibleFlag' to know that the article is visible.
641
+ setVisibleFlag(true);
623
642
  }
624
643
  } },
625
644
  React__default.createElement(
@@ -1025,7 +1044,16 @@ var ArticleQueue = function ArticleQueue(props) {
1025
1044
  if (!checkSponseredArticle(article) && Ads.getNativeContextualAD) {
1026
1045
  article.contextualAD = Ads.getNativeContextualAD(getTargeting(props));
1027
1046
  }
1028
- return React__default.createElement(Article, _extends({ key: index }, props, { onChangeArticle: onChangeArticle, authorPrfix: authorPrefix, article: article, cpModificationRequired: cpModificationRequired }));
1047
+ return React__default.createElement(Article, _extends({
1048
+ key: index
1049
+ }, props, {
1050
+ onChangeArticle: onChangeArticle,
1051
+ authorPrfix: authorPrefix,
1052
+ article: article,
1053
+ cpModificationRequired: cpModificationRequired
1054
+ // Passing queueData to check for single article
1055
+ , queueData: queueData
1056
+ }));
1029
1057
  })
1030
1058
  );
1031
1059
  };
@@ -2012,7 +2012,7 @@ var Sidebar = function Sidebar(_ref) {
2012
2012
  React__default.createElement(
2013
2013
  'style',
2014
2014
  { jsx: 'true' },
2015
- '\n .sidebar {\n clear: both;\n float: right;\n background-color: #eee;\n width: 40%;\n padding: 1rem;\n margin: 0 0 1rem 1rem;\n }\n @media screen and (max-width: 991px) {\n .sidebar {\n float: none;\n width: auto;\n margin: 1rem 0;\n }\n }\n '
2015
+ '\n .sidebar {\n clear: both;\n float: right;\n background-color: #eee;\n width: 40%;\n padding: 1rem;\n margin: 0 0 1rem 1rem;\n }\n // resolving list items inside sidebar being shifted to center because of unusual margin\n .sidebar ul {\n margin-left: 0;\n padding-left: 2rem;\n }\n @media screen and (max-width: 991px) {\n .sidebar {\n float: none;\n width: auto;\n margin: 1rem 0;\n }\n }\n '
2016
2016
  )
2017
2017
  );
2018
2018
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mjhls/mjh-framework",
3
- "version": "1.0.461",
3
+ "version": "1.0.463",
4
4
  "description": "Foundation Framework",
5
5
  "author": "mjh-framework",
6
6
  "license": "MIT",