@mjhls/mjh-framework 1.0.460 → 1.0.462

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.460
1
+ # mjh-framework v. 1.0.462
2
2
 
3
3
  > Foundation Framework
4
4
 
@@ -35,8 +35,6 @@ var ADWebcast = function ADWebcast(_ref) {
35
35
  adUnit = webcastAd.adUnit,
36
36
  _webcastAd$targeting = webcastAd.targeting,
37
37
  targeting = _webcastAd$targeting === undefined ? {} : _webcastAd$targeting,
38
- _webcastAd$position = webcastAd.position,
39
- position = _webcastAd$position === undefined ? '' : _webcastAd$position,
40
38
  networkID = webcastAd.networkID,
41
39
  _webcastAd$sizes = webcastAd.sizes,
42
40
  sizes = _webcastAd$sizes === undefined ? [[200, 100]] : _webcastAd$sizes;
@@ -48,7 +46,8 @@ var ADWebcast = function ADWebcast(_ref) {
48
46
  tags: targeting.tags,
49
47
  document_group: targeting.document_group,
50
48
  document_url: targeting.document_url,
51
- pos: position,
49
+ // setting pos for webcast ad.
50
+ pos: 'smrec1',
52
51
  campaign_id: targeting.campaign_id,
53
52
  issue_url: targeting.issue_url,
54
53
  publication_url: targeting.publication_url
@@ -91,7 +90,7 @@ var ADWebcast = function ADWebcast(_ref) {
91
90
  { id: 'webcast-ad-wrapper', className: 'webcast-ad-wrapper' },
92
91
  React__default.createElement(
93
92
  'div',
94
- { className: 'webcast-ad' },
93
+ { className: 'webcast-ad', style: { paddingBottom: '15px' } },
95
94
  React__default.createElement(AdSlot, {
96
95
  className: className,
97
96
  slotId: slotId,
@@ -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
 
@@ -222,7 +229,7 @@ var Article = function Article(props) {
222
229
 
223
230
  var findIndex = function findIndex(arr) {
224
231
  var indexes = [];
225
- if ((typeof arr === 'undefined' ? 'undefined' : _typeof._typeof(arr)) == 'object') {
232
+ if ((typeof arr === 'undefined' ? 'undefined' : _typeof._typeof(arr)) === 'object') {
226
233
  var _iteratorNormalCompletion = true;
227
234
  var _didIteratorError = false;
228
235
  var _iteratorError = undefined;
@@ -233,7 +240,9 @@ var Article = function Article(props) {
233
240
 
234
241
  if (ele['_type'] === 'block' && ele.children.some(function (child) {
235
242
  return child.text.trim().length > 0;
236
- }) && ele['listItem'] !== 'bullet' && ele['style'] === 'normal' || ele['_type'] === 'figure') {
243
+ }) && ele['listItem'] !== 'bullet' &&
244
+ // To skip li tags when setting contextual native ads
245
+ ele['listItem'] !== 'number' && ele['style'] === 'normal' || ele['_type'] === 'figure') {
237
246
  indexes.push(arr.indexOf(ele));
238
247
  }
239
248
  }
@@ -321,6 +330,8 @@ var Article = function Article(props) {
321
330
  contextualAD: _extends._extends({}, payload.contextualAD, {
322
331
  slotId: (payload.contextualAD.slotId || 'contextual_ad') + '-' + payload._id,
323
332
  className: 'ADFluid',
333
+ // Fetching new contextual targeting based on the current active article.
334
+ targeting: props.getTargeting(props.article, 'native-ad'),
324
335
  // Adding new ad size for large contextual ad for desktop screen width >= 1400
325
336
  sizes: lgContextAd ? [[728, 90], 'fluid', [300, 100]] : ['fluid', [300, 100]],
326
337
  sizeMapping: lgContextAd ? [{
@@ -366,7 +377,7 @@ var Article = function Article(props) {
366
377
  imageOptions: { w: 320, h: 240, fit: 'max' }
367
378
  }, client.config())),
368
379
  contextualADFlag && React__default.createElement('span', { className: 'clearfix' }),
369
- React__default.createElement(
380
+ (visibleFlag || queueData && queueData.length === 1) && React__default.createElement(
370
381
  'div',
371
382
  { id: 'contextual-native-ad-' + payload._id, className: 'contextual-native-ad' },
372
383
  React__default.createElement(AdSlot, _extends._extends({}, payload.contextualAD, { refreshFlag: false, checkIsAdFound: _checkIsAdFound }))
@@ -464,6 +475,8 @@ var Article = function Article(props) {
464
475
  onChange: function onChange(visible) {
465
476
  if (visible === 'top' || visible === 'bottom' || visible === 'small-top') {
466
477
  onChangeArticle(url, visible, meta);
478
+ // Setting 'visibleFlag' to know that the article is visible.
479
+ setVisibleFlag(true);
467
480
  }
468
481
  } },
469
482
  React__default.createElement(
@@ -629,7 +642,7 @@ var Article = function Article(props) {
629
642
  React__default.createElement(
630
643
  'style',
631
644
  { jsx: 'true' },
632
- '\n .sanityDisplayLabel {\n margin: .5rem 0;\n border: 2px solid var(--franchise-primary, #484848);\n width: fit-content;\n padding: 5px;\n color: var(--franchise-primary, #484848);\n border-radius: 2px;\n }\n '
645
+ '\n .sanityDisplayLabel {\n margin: 0.5rem 0;\n border: 2px solid var(--franchise-primary, #484848);\n width: fit-content;\n padding: 5px;\n color: var(--franchise-primary, #484848);\n border-radius: 2px;\n }\n '
633
646
  )
634
647
  );
635
648
  };
@@ -731,10 +744,10 @@ var ArticleQueue = function ArticleQueue(props) {
731
744
  return article;
732
745
  };
733
746
 
734
- var _useState3 = React.useState([firstArticle()]),
735
- _useState4 = slicedToArray._slicedToArray(_useState3, 2),
736
- queueData = _useState4[0],
737
- setQueueData = _useState4[1];
747
+ var _useState5 = React.useState([firstArticle()]),
748
+ _useState6 = slicedToArray._slicedToArray(_useState5, 2),
749
+ queueData = _useState6[0],
750
+ setQueueData = _useState6[1];
738
751
 
739
752
  var refreshAD = function refreshAD(path) {
740
753
  if (!main.main_36) {
@@ -875,6 +888,8 @@ var ArticleQueue = function ArticleQueue(props) {
875
888
  article: article,
876
889
  cpModificationRequired: cpModificationRequired,
877
890
  queueData: queueData
891
+ // Passing 'getTargeting' so that contextual AD can fetch target based on current active article.
892
+ , getTargeting: getTargeting
878
893
  }));
879
894
  })
880
895
  );
package/dist/cjs/View.js CHANGED
@@ -186,7 +186,7 @@ var DocumentGroup = function DocumentGroup(_ref) {
186
186
 
187
187
  var findIndex = function findIndex(arr) {
188
188
  var indexes = [];
189
- if ((typeof arr === 'undefined' ? 'undefined' : _typeof$1._typeof(arr)) == 'object') {
189
+ if ((typeof arr === 'undefined' ? 'undefined' : _typeof$1._typeof(arr)) === 'object') {
190
190
  var _iteratorNormalCompletion = true;
191
191
  var _didIteratorError = false;
192
192
  var _iteratorError = undefined;
@@ -197,7 +197,9 @@ var findIndex = function findIndex(arr) {
197
197
 
198
198
  if (ele['_type'] === 'block' && ele.children.some(function (child) {
199
199
  return child.text.trim().length > 0;
200
- }) && ele['listItem'] !== 'bullet' && ele['style'] === 'normal' || ele['_type'] === 'figure') {
200
+ }) && ele['listItem'] !== 'bullet' &&
201
+ // To skip li tags when setting contextual native ads
202
+ ele['listItem'] !== 'number' && ele['style'] === 'normal' || ele['_type'] === 'figure') {
201
203
  indexes.push(arr.indexOf(ele));
202
204
  }
203
205
  }
@@ -299,30 +301,40 @@ var Article = function Article(props) {
299
301
  ISIContent = props.ISIContent,
300
302
  shareOptions = props.shareOptions,
301
303
  cpModificationRequired = props.cpModificationRequired,
302
- authorPrefix = props.authorPrefix;
304
+ authorPrefix = props.authorPrefix,
305
+ _props$lgContextAd = props.lgContextAd,
306
+ lgContextAd = _props$lgContextAd === undefined ? false : _props$lgContextAd,
307
+ queueData = props.queueData;
303
308
  var onChangeArticle = props.onChangeArticle;
304
309
 
305
310
  var _useState = React.useState(null),
306
311
  _useState2 = slicedToArray._slicedToArray(_useState, 2),
307
312
  contextualADFlag = _useState2[0],
308
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.
309
315
 
310
- var summary = getArticleSummary(props.article);
311
316
 
312
- var _useState3 = React.useState(1),
317
+ var _useState3 = React.useState(false),
313
318
  _useState4 = slicedToArray._slicedToArray(_useState3, 2),
314
- auth = _useState4[0],
315
- setAuth = _useState4[1];
319
+ visibleFlag = _useState4[0],
320
+ setVisibleFlag = _useState4[1];
321
+
322
+ var summary = getArticleSummary(props.article);
316
323
 
317
- var _useState5 = React.useState(''),
324
+ var _useState5 = React.useState(1),
318
325
  _useState6 = slicedToArray._slicedToArray(_useState5, 2),
319
- passwordKey = _useState6[0],
320
- setPasswordKey = _useState6[1];
326
+ auth = _useState6[0],
327
+ setAuth = _useState6[1];
321
328
 
322
- var _useState7 = React.useState(false),
329
+ var _useState7 = React.useState(''),
323
330
  _useState8 = slicedToArray._slicedToArray(_useState7, 2),
324
- showVotes = _useState8[0],
325
- 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];
326
338
 
327
339
  var isCutomPage = function isCutomPage(article) {
328
340
  var url = article.url.current;
@@ -460,7 +472,6 @@ var Article = function Article(props) {
460
472
  setContextualADFlag(true);
461
473
  }
462
474
  };
463
-
464
475
  return React__default.createElement(
465
476
  React__default.Fragment,
466
477
  null,
@@ -490,7 +501,15 @@ var Article = function Article(props) {
490
501
  } else if (indexes.length >= 2 && body.length > 3 && payload.contextualAD && !payload.contextualVideoAD) {
491
502
  payload = _extends._extends({}, payload, {
492
503
  contextualAD: _extends._extends({}, payload.contextualAD, {
493
- 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]]
494
513
  })
495
514
  });
496
515
  var _selectedIndex = indexes[1] + 1;
@@ -518,7 +537,7 @@ var Article = function Article(props) {
518
537
  imageOptions: { w: 320, h: 240, fit: 'max' }
519
538
  }, client.config())),
520
539
  contextualADFlag && React__default.createElement('span', { className: 'clearfix' }),
521
- React__default.createElement(
540
+ (visibleFlag || queueData && queueData.length === 1) && React__default.createElement(
522
541
  'div',
523
542
  { id: 'contextual-native-ad-' + payload._id, className: 'contextual-native-ad' },
524
543
  React__default.createElement(AdSlot, _extends._extends({}, payload.contextualAD, { refreshFlag: false, checkIsAdFound: _checkIsAdFound }))
@@ -623,6 +642,8 @@ var Article = function Article(props) {
623
642
  onChange: function onChange(visible) {
624
643
  if (visible === 'top' || visible === 'bottom' || visible === 'small-top') {
625
644
  onChangeArticle(url, visible, meta);
645
+ // Setting 'visibleFlag' to know that the article is visible.
646
+ setVisibleFlag(true);
626
647
  }
627
648
  } },
628
649
  React__default.createElement(
@@ -1028,7 +1049,16 @@ var ArticleQueue = function ArticleQueue(props) {
1028
1049
  if (!checkSponseredArticle(article) && Ads.getNativeContextualAD) {
1029
1050
  article.contextualAD = Ads.getNativeContextualAD(getTargeting.getTargeting(props));
1030
1051
  }
1031
- 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
+ }));
1032
1062
  })
1033
1063
  );
1034
1064
  };
@@ -30,8 +30,6 @@ var ADWebcast = function ADWebcast(_ref) {
30
30
  adUnit = webcastAd.adUnit,
31
31
  _webcastAd$targeting = webcastAd.targeting,
32
32
  targeting = _webcastAd$targeting === undefined ? {} : _webcastAd$targeting,
33
- _webcastAd$position = webcastAd.position,
34
- position = _webcastAd$position === undefined ? '' : _webcastAd$position,
35
33
  networkID = webcastAd.networkID,
36
34
  _webcastAd$sizes = webcastAd.sizes,
37
35
  sizes = _webcastAd$sizes === undefined ? [[200, 100]] : _webcastAd$sizes;
@@ -43,7 +41,8 @@ var ADWebcast = function ADWebcast(_ref) {
43
41
  tags: targeting.tags,
44
42
  document_group: targeting.document_group,
45
43
  document_url: targeting.document_url,
46
- pos: position,
44
+ // setting pos for webcast ad.
45
+ pos: 'smrec1',
47
46
  campaign_id: targeting.campaign_id,
48
47
  issue_url: targeting.issue_url,
49
48
  publication_url: targeting.publication_url
@@ -86,7 +85,7 @@ var ADWebcast = function ADWebcast(_ref) {
86
85
  { id: 'webcast-ad-wrapper', className: 'webcast-ad-wrapper' },
87
86
  React__default.createElement(
88
87
  'div',
89
- { className: 'webcast-ad' },
88
+ { className: 'webcast-ad', style: { paddingBottom: '15px' } },
90
89
  React__default.createElement(DFPAdSlot, {
91
90
  className: className,
92
91
  slotId: slotId,
@@ -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
 
@@ -217,7 +224,7 @@ var Article = function Article(props) {
217
224
 
218
225
  var findIndex = function findIndex(arr) {
219
226
  var indexes = [];
220
- if ((typeof arr === 'undefined' ? 'undefined' : _typeof(arr)) == 'object') {
227
+ if ((typeof arr === 'undefined' ? 'undefined' : _typeof(arr)) === 'object') {
221
228
  var _iteratorNormalCompletion = true;
222
229
  var _didIteratorError = false;
223
230
  var _iteratorError = undefined;
@@ -228,7 +235,9 @@ var Article = function Article(props) {
228
235
 
229
236
  if (ele['_type'] === 'block' && ele.children.some(function (child) {
230
237
  return child.text.trim().length > 0;
231
- }) && ele['listItem'] !== 'bullet' && ele['style'] === 'normal' || ele['_type'] === 'figure') {
238
+ }) && ele['listItem'] !== 'bullet' &&
239
+ // To skip li tags when setting contextual native ads
240
+ ele['listItem'] !== 'number' && ele['style'] === 'normal' || ele['_type'] === 'figure') {
232
241
  indexes.push(arr.indexOf(ele));
233
242
  }
234
243
  }
@@ -316,6 +325,8 @@ var Article = function Article(props) {
316
325
  contextualAD: _extends({}, payload.contextualAD, {
317
326
  slotId: (payload.contextualAD.slotId || 'contextual_ad') + '-' + payload._id,
318
327
  className: 'ADFluid',
328
+ // Fetching new contextual targeting based on the current active article.
329
+ targeting: props.getTargeting(props.article, 'native-ad'),
319
330
  // Adding new ad size for large contextual ad for desktop screen width >= 1400
320
331
  sizes: lgContextAd ? [[728, 90], 'fluid', [300, 100]] : ['fluid', [300, 100]],
321
332
  sizeMapping: lgContextAd ? [{
@@ -361,7 +372,7 @@ var Article = function Article(props) {
361
372
  imageOptions: { w: 320, h: 240, fit: 'max' }
362
373
  }, client.config())),
363
374
  contextualADFlag && React__default.createElement('span', { className: 'clearfix' }),
364
- React__default.createElement(
375
+ (visibleFlag || queueData && queueData.length === 1) && React__default.createElement(
365
376
  'div',
366
377
  { id: 'contextual-native-ad-' + payload._id, className: 'contextual-native-ad' },
367
378
  React__default.createElement(DFPAdSlot, _extends({}, payload.contextualAD, { refreshFlag: false, checkIsAdFound: _checkIsAdFound }))
@@ -459,6 +470,8 @@ var Article = function Article(props) {
459
470
  onChange: function onChange(visible) {
460
471
  if (visible === 'top' || visible === 'bottom' || visible === 'small-top') {
461
472
  onChangeArticle(url, visible, meta);
473
+ // Setting 'visibleFlag' to know that the article is visible.
474
+ setVisibleFlag(true);
462
475
  }
463
476
  } },
464
477
  React__default.createElement(
@@ -624,7 +637,7 @@ var Article = function Article(props) {
624
637
  React__default.createElement(
625
638
  'style',
626
639
  { jsx: 'true' },
627
- '\n .sanityDisplayLabel {\n margin: .5rem 0;\n border: 2px solid var(--franchise-primary, #484848);\n width: fit-content;\n padding: 5px;\n color: var(--franchise-primary, #484848);\n border-radius: 2px;\n }\n '
640
+ '\n .sanityDisplayLabel {\n margin: 0.5rem 0;\n border: 2px solid var(--franchise-primary, #484848);\n width: fit-content;\n padding: 5px;\n color: var(--franchise-primary, #484848);\n border-radius: 2px;\n }\n '
628
641
  )
629
642
  );
630
643
  };
@@ -726,10 +739,10 @@ var ArticleQueue = function ArticleQueue(props) {
726
739
  return article;
727
740
  };
728
741
 
729
- var _useState3 = useState([firstArticle()]),
730
- _useState4 = _slicedToArray(_useState3, 2),
731
- queueData = _useState4[0],
732
- setQueueData = _useState4[1];
742
+ var _useState5 = useState([firstArticle()]),
743
+ _useState6 = _slicedToArray(_useState5, 2),
744
+ queueData = _useState6[0],
745
+ setQueueData = _useState6[1];
733
746
 
734
747
  var refreshAD = function refreshAD(path) {
735
748
  if (!main_36) {
@@ -870,6 +883,8 @@ var ArticleQueue = function ArticleQueue(props) {
870
883
  article: article,
871
884
  cpModificationRequired: cpModificationRequired,
872
885
  queueData: queueData
886
+ // Passing 'getTargeting' so that contextual AD can fetch target based on current active article.
887
+ , getTargeting: getTargeting
873
888
  }));
874
889
  })
875
890
  );
package/dist/esm/View.js CHANGED
@@ -181,7 +181,7 @@ var DocumentGroup = function DocumentGroup(_ref) {
181
181
 
182
182
  var findIndex = function findIndex(arr) {
183
183
  var indexes = [];
184
- if ((typeof arr === 'undefined' ? 'undefined' : _typeof(arr)) == 'object') {
184
+ if ((typeof arr === 'undefined' ? 'undefined' : _typeof(arr)) === 'object') {
185
185
  var _iteratorNormalCompletion = true;
186
186
  var _didIteratorError = false;
187
187
  var _iteratorError = undefined;
@@ -192,7 +192,9 @@ var findIndex = function findIndex(arr) {
192
192
 
193
193
  if (ele['_type'] === 'block' && ele.children.some(function (child) {
194
194
  return child.text.trim().length > 0;
195
- }) && ele['listItem'] !== 'bullet' && ele['style'] === 'normal' || ele['_type'] === 'figure') {
195
+ }) && ele['listItem'] !== 'bullet' &&
196
+ // To skip li tags when setting contextual native ads
197
+ ele['listItem'] !== 'number' && ele['style'] === 'normal' || ele['_type'] === 'figure') {
196
198
  indexes.push(arr.indexOf(ele));
197
199
  }
198
200
  }
@@ -294,30 +296,40 @@ var Article = function Article(props) {
294
296
  ISIContent = props.ISIContent,
295
297
  shareOptions = props.shareOptions,
296
298
  cpModificationRequired = props.cpModificationRequired,
297
- authorPrefix = props.authorPrefix;
299
+ authorPrefix = props.authorPrefix,
300
+ _props$lgContextAd = props.lgContextAd,
301
+ lgContextAd = _props$lgContextAd === undefined ? false : _props$lgContextAd,
302
+ queueData = props.queueData;
298
303
  var onChangeArticle = props.onChangeArticle;
299
304
 
300
305
  var _useState = useState(null),
301
306
  _useState2 = _slicedToArray(_useState, 2),
302
307
  contextualADFlag = _useState2[0],
303
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.
304
310
 
305
- var summary = getArticleSummary(props.article);
306
311
 
307
- var _useState3 = useState(1),
312
+ var _useState3 = useState(false),
308
313
  _useState4 = _slicedToArray(_useState3, 2),
309
- auth = _useState4[0],
310
- setAuth = _useState4[1];
314
+ visibleFlag = _useState4[0],
315
+ setVisibleFlag = _useState4[1];
316
+
317
+ var summary = getArticleSummary(props.article);
311
318
 
312
- var _useState5 = useState(''),
319
+ var _useState5 = useState(1),
313
320
  _useState6 = _slicedToArray(_useState5, 2),
314
- passwordKey = _useState6[0],
315
- setPasswordKey = _useState6[1];
321
+ auth = _useState6[0],
322
+ setAuth = _useState6[1];
316
323
 
317
- var _useState7 = useState(false),
324
+ var _useState7 = useState(''),
318
325
  _useState8 = _slicedToArray(_useState7, 2),
319
- showVotes = _useState8[0],
320
- 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];
321
333
 
322
334
  var isCutomPage = function isCutomPage(article) {
323
335
  var url = article.url.current;
@@ -455,7 +467,6 @@ var Article = function Article(props) {
455
467
  setContextualADFlag(true);
456
468
  }
457
469
  };
458
-
459
470
  return React__default.createElement(
460
471
  React__default.Fragment,
461
472
  null,
@@ -485,7 +496,15 @@ var Article = function Article(props) {
485
496
  } else if (indexes.length >= 2 && body.length > 3 && payload.contextualAD && !payload.contextualVideoAD) {
486
497
  payload = _extends({}, payload, {
487
498
  contextualAD: _extends({}, payload.contextualAD, {
488
- 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]]
489
508
  })
490
509
  });
491
510
  var _selectedIndex = indexes[1] + 1;
@@ -513,7 +532,7 @@ var Article = function Article(props) {
513
532
  imageOptions: { w: 320, h: 240, fit: 'max' }
514
533
  }, client.config())),
515
534
  contextualADFlag && React__default.createElement('span', { className: 'clearfix' }),
516
- React__default.createElement(
535
+ (visibleFlag || queueData && queueData.length === 1) && React__default.createElement(
517
536
  'div',
518
537
  { id: 'contextual-native-ad-' + payload._id, className: 'contextual-native-ad' },
519
538
  React__default.createElement(DFPAdSlot, _extends({}, payload.contextualAD, { refreshFlag: false, checkIsAdFound: _checkIsAdFound }))
@@ -618,6 +637,8 @@ var Article = function Article(props) {
618
637
  onChange: function onChange(visible) {
619
638
  if (visible === 'top' || visible === 'bottom' || visible === 'small-top') {
620
639
  onChangeArticle(url, visible, meta);
640
+ // Setting 'visibleFlag' to know that the article is visible.
641
+ setVisibleFlag(true);
621
642
  }
622
643
  } },
623
644
  React__default.createElement(
@@ -1023,7 +1044,16 @@ var ArticleQueue = function ArticleQueue(props) {
1023
1044
  if (!checkSponseredArticle(article) && Ads.getNativeContextualAD) {
1024
1045
  article.contextualAD = Ads.getNativeContextualAD(getTargeting(props));
1025
1046
  }
1026
- 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
+ }));
1027
1057
  })
1028
1058
  );
1029
1059
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mjhls/mjh-framework",
3
- "version": "1.0.460",
3
+ "version": "1.0.462",
4
4
  "description": "Foundation Framework",
5
5
  "author": "mjh-framework",
6
6
  "license": "MIT",