@mjhls/mjh-framework 1.0.221 → 1.0.222

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/cjs/index.js CHANGED
@@ -24,9 +24,10 @@ require('./index-0d0efcfa.js');
24
24
  var main = require('./main-58839f4e.js');
25
25
  var entities = require('./entities-3e0b4a16.js');
26
26
  var _babelHelpers = require('./_babelHelpers-f321c258.js');
27
+ var AdSlot = require('./AdSlot-d87cef08.js');
27
28
  var DeckContent = require('./DeckContent.js');
28
29
  require('./get-126b1712.js');
29
- var GridContent = require('./GridContent-089aa22c.js');
30
+ var GridContent = require('./GridContent-1575c8db.js');
30
31
  var DeckQueue = require('./DeckQueue.js');
31
32
  require('react-bootstrap/Media');
32
33
  var ThumbnailCard = require('./ThumbnailCard.js');
@@ -43,7 +44,7 @@ var PublicationDeck = require('./PublicationDeck.js');
43
44
  var IssueDeck = require('./IssueDeck.js');
44
45
  require('react-bootstrap/Badge');
45
46
  var IssueContentDeck = require('./IssueContentDeck.js');
46
- var TemplateNormal = require('./Normal-47d9e184.js');
47
+ var TemplateNormal = require('./Normal-2886d08f.js');
47
48
  require('react-bootstrap/ListGroup');
48
49
  var Head = _interopDefault(require('next/head'));
49
50
  var Accordion = _interopDefault(require('react-bootstrap/Accordion'));
@@ -202,7 +203,7 @@ var AD300x250 = function AD300x250(_ref) {
202
203
  _ref$targeting = _ref.targeting,
203
204
  targeting = _ref$targeting === undefined ? {} : _ref$targeting;
204
205
 
205
- return React__default.createElement(TemplateNormal.DFPAdSlot, {
206
+ return React__default.createElement(AdSlot.DFPAdSlot, {
206
207
  networkID: networkID,
207
208
  adUnit: adUnit,
208
209
  slotId: slotId,
@@ -219,7 +220,7 @@ var AD300x250x600 = function AD300x250x600(_ref) {
219
220
  _ref$targeting = _ref.targeting,
220
221
  targeting = _ref$targeting === undefined ? {} : _ref$targeting;
221
222
 
222
- return React__default.createElement(TemplateNormal.DFPAdSlot, {
223
+ return React__default.createElement(AdSlot.DFPAdSlot, {
223
224
  networkID: networkID,
224
225
  adUnit: adUnit,
225
226
  className: 'AD300x250',
@@ -10491,7 +10492,7 @@ var NativeAd = function NativeAd(props) {
10491
10492
  return React__default.createElement(
10492
10493
  'div',
10493
10494
  { className: 'native-ad-wrapper', style: { textAlign: 'center' } },
10494
- React__default.createElement(GridContent.AD, { networkID: networkID, adUnit: adUnit, slotId: slotId, targeting: targeting, className: className, sizes: sizes, sizeMapping: sizeMapping })
10495
+ React__default.createElement(AdSlot.DFPAdSlot, { networkID: networkID, adUnit: adUnit, slotId: slotId, targeting: targeting, className: className, sizes: sizes, sizeMapping: sizeMapping })
10495
10496
  );
10496
10497
  };
10497
10498
 
@@ -12235,84 +12236,97 @@ var Article = function Article(props) {
12235
12236
 
12236
12237
  var siteName = props.website.title;
12237
12238
  return React__default.createElement(
12238
- InscreenSensor,
12239
- {
12240
- offSetTop: 45,
12241
- onChange: function onChange(visible) {
12242
- if (visible !== false) {
12243
- changeUrl(url, visible);
12244
- }
12245
- } },
12239
+ React__default.Fragment,
12240
+ null,
12246
12241
  React__default.createElement(
12247
- 'div',
12248
- null,
12249
- React__default.createElement(
12250
- Head,
12251
- null,
12252
- passwordLock && React__default.createElement('meta', { name: 'robots', content: 'noindex, nofollow' })
12253
- ),
12254
- React__default.createElement(
12255
- 'h1',
12256
- { className: 'page-title' },
12257
- title
12258
- ),
12242
+ InscreenSensor,
12243
+ {
12244
+ offSetTop: 45,
12245
+ onChange: function onChange(visible) {
12246
+ if (visible !== false) {
12247
+ changeUrl(url, visible);
12248
+ }
12249
+ } },
12259
12250
  React__default.createElement(
12260
12251
  'div',
12261
- { className: 'video-detail', style: { marginBottom: isCutomPage(props.article) ? '150px' : 0 } },
12252
+ null,
12262
12253
  React__default.createElement(
12263
- 'div',
12254
+ Head,
12264
12255
  null,
12265
- visibilitySensor.moment(published).format('LL')
12256
+ passwordLock && React__default.createElement('meta', { name: 'robots', content: 'noindex, nofollow' })
12266
12257
  ),
12267
12258
  React__default.createElement(
12268
- 'div',
12269
- { className: 'mb-3' },
12270
- authorDetails && authorDetails.map(function (authorDetail, index) {
12271
- return React__default.createElement(
12272
- 'div',
12273
- { key: index },
12274
- renderAuthor(authorDetail.displayName, authorDetail.url, index, authorDetails.length)
12275
- );
12276
- })
12259
+ 'h1',
12260
+ { className: 'page-title' },
12261
+ title
12277
12262
  ),
12278
12263
  React__default.createElement(
12279
- 'p',
12280
- null,
12281
- React__default.createElement(SocialShare$1, {
12282
- shareUrl: shareUrl,
12283
- shareTitle: shareTitle,
12284
- shareVia: shareVia,
12285
- shareSummary: shareSummary,
12286
- shareSubject: shareSubject,
12287
- shareImage: shareImage,
12288
- size: 32,
12289
- siteName: siteName,
12290
- twitterSiteName: twitterSiteName
12291
- })
12292
- ),
12293
- React__default.createElement(
12294
- 'p',
12295
- null,
12264
+ 'div',
12265
+ { className: 'video-detail', style: { marginBottom: isCutomPage(props.article) ? '150px' : 0 } },
12266
+ React__default.createElement(
12267
+ 'div',
12268
+ null,
12269
+ visibilitySensor.moment(published).format('LL')
12270
+ ),
12296
12271
  React__default.createElement(
12297
- 'em',
12272
+ 'div',
12273
+ { className: 'mb-3' },
12274
+ authorDetails && authorDetails.map(function (authorDetail, index) {
12275
+ return React__default.createElement(
12276
+ 'div',
12277
+ { key: index },
12278
+ renderAuthor(authorDetail.displayName, authorDetail.url, index, authorDetails.length)
12279
+ );
12280
+ })
12281
+ ),
12282
+ React__default.createElement(
12283
+ 'p',
12298
12284
  null,
12299
- summary
12285
+ React__default.createElement(SocialShare$1, {
12286
+ shareUrl: shareUrl,
12287
+ shareTitle: shareTitle,
12288
+ shareVia: shareVia,
12289
+ shareSummary: shareSummary,
12290
+ shareSubject: shareSubject,
12291
+ shareImage: shareImage,
12292
+ size: 32,
12293
+ siteName: siteName,
12294
+ twitterSiteName: twitterSiteName
12295
+ })
12300
12296
  ),
12301
- React__default.createElement('br', null),
12302
- React__default.createElement('br', null)
12297
+ React__default.createElement(
12298
+ 'p',
12299
+ null,
12300
+ React__default.createElement(
12301
+ 'em',
12302
+ null,
12303
+ summary
12304
+ ),
12305
+ React__default.createElement('br', null),
12306
+ React__default.createElement('br', null)
12307
+ ),
12308
+ React__default.createElement(
12309
+ 'div',
12310
+ { className: 'block-content' },
12311
+ React__default.createElement(TaxonomyCard.BlockContent, _babelHelpers._extends({
12312
+ serializers: getSerializers(client, pageview, videoAccountIDs, function () {}, true),
12313
+ blocks: articleBody,
12314
+ imageOptions: { w: 320, h: 240, fit: 'max' }
12315
+ }, client.config()))
12316
+ )
12303
12317
  ),
12304
- React__default.createElement(
12305
- 'div',
12306
- { className: 'block-content' },
12307
- React__default.createElement(TaxonomyCard.BlockContent, _babelHelpers._extends({
12308
- serializers: getSerializers(client, pageview, videoAccountIDs, function () {}, true),
12309
- blocks: articleBody,
12310
- imageOptions: { w: 320, h: 240, fit: 'max' }
12311
- }, client.config()))
12312
- )
12313
- ),
12314
- renderIsiContent(props.article)
12315
- )
12318
+ renderIsiContent(props.article)
12319
+ )
12320
+ ),
12321
+ sMobileOnly && React__default.createElement('hr', { className: 'add-seperater' }),
12322
+ main.main_36 && props.article.Ads.map(function (ad, index) {
12323
+ return React__default.createElement(
12324
+ 'div',
12325
+ { key: index, id: 'addid-' + index, style: { display: 'flex', flex: '1 0 auto' } },
12326
+ ad.component
12327
+ );
12328
+ }),
12329
+ React__default.createElement('hr', { className: 'article-seperater' })
12316
12330
  );
12317
12331
  };
12318
12332
 
@@ -12336,6 +12350,8 @@ var ArticleQueue = function (_React$Component) {
12336
12350
 
12337
12351
  var targeting = _this.getTargeting(_this.props.article);
12338
12352
  var metaDescription = description ? description : summary ? summary : _this.getFirstLine(_this.props.article);
12353
+ var article = _this.props.article;
12354
+ article.Ads = _this.props.Ads.getRightItems(targeting);
12339
12355
 
12340
12356
  _this.state = {
12341
12357
  config: {
@@ -12349,7 +12365,7 @@ var ArticleQueue = function (_React$Component) {
12349
12365
  },
12350
12366
  title: _this.props.article.title,
12351
12367
  summary: metaDescription,
12352
- queueData: [_this.props.article],
12368
+ queueData: [article],
12353
12369
  relatedArticles: [],
12354
12370
  keywords: []
12355
12371
  }, _this.preVscroll = 0;
@@ -12366,9 +12382,14 @@ var ArticleQueue = function (_React$Component) {
12366
12382
  }, {
12367
12383
  key: 'componentDidUpdate',
12368
12384
  value: function componentDidUpdate(prevProps) {
12369
- if (prevProps.relatedArticles != this.props.relatedArticles) {
12370
- var relatedArticles = this.props.relatedArticles;
12385
+ var _this2 = this;
12371
12386
 
12387
+ if (prevProps.relatedArticles != this.props.relatedArticles) {
12388
+ var relatedArticles = this.props.relatedArticles.map(function (article) {
12389
+ var targeting = _this2.getTargeting(_this2.props.article);
12390
+ var Ads = _this2.props.Ads.getRightItems(targeting);
12391
+ return _babelHelpers._extends({}, article, { Ads: Ads });
12392
+ });
12372
12393
  var queueData = [].concat(_babelHelpers.toConsumableArray(this.state.queueData));
12373
12394
  if (prevProps.relatedArticles.length == 0) {
12374
12395
  queueData.push(relatedArticles.shift());
@@ -12387,7 +12408,7 @@ var ArticleQueue = function (_React$Component) {
12387
12408
  }, {
12388
12409
  key: 'render',
12389
12410
  value: function render() {
12390
- var _this2 = this;
12411
+ var _this3 = this;
12391
12412
 
12392
12413
  var _state = this.state,
12393
12414
  config = _state.config,
@@ -12403,19 +12424,19 @@ var ArticleQueue = function (_React$Component) {
12403
12424
 
12404
12425
  return React__default.createElement(
12405
12426
  TemplateNormal.TemplateNormal,
12406
- { config: config, website: website, keywords: keywords, description: summary, title: title, showRightAd: true },
12427
+ { config: config, website: website, keywords: keywords, description: summary, title: title, showRightAd: !main.main_36 },
12407
12428
  React__default.createElement(
12408
12429
  visibilitySensor.InfiniteScroll,
12409
12430
  { dataLength: queueData.length, next: this.loadmore, scrollThreshold: '200px', hasMore: true },
12410
12431
  queueData.map(function (article, index) {
12411
12432
  return React__default.createElement(Article, _babelHelpers._extends({
12412
12433
  key: index,
12413
- urlFor: _this2.urlFor,
12414
- isCutomPage: _this2.isCutomPage,
12415
- renderIsiContent: _this2.renderIsiContent
12416
- }, _this2.props, {
12434
+ urlFor: _this3.urlFor,
12435
+ isCutomPage: _this3.isCutomPage,
12436
+ renderIsiContent: _this3.renderIsiContent
12437
+ }, _this3.props, {
12417
12438
  shareOptions: shareOptions,
12418
- changeUrl: _this2.changeUrl,
12439
+ changeUrl: _this3.changeUrl,
12419
12440
  article: article
12420
12441
  }));
12421
12442
  })
@@ -12427,37 +12448,37 @@ var ArticleQueue = function (_React$Component) {
12427
12448
  }(React__default.Component);
12428
12449
 
12429
12450
  var _initialiseProps = function _initialiseProps() {
12430
- var _this3 = this;
12451
+ var _this4 = this;
12431
12452
 
12432
12453
  this.scrollDirectionDetect = function (e) {
12433
12454
  var window = e.currentTarget;
12434
- var isScrollDown = _this3.isScrollDown;
12455
+ var isScrollDown = _this4.isScrollDown;
12435
12456
 
12436
12457
 
12437
- if (_this3.preVscroll > window.scrollY) {
12458
+ if (_this4.preVscroll > window.scrollY) {
12438
12459
  if (!isScrollDown) {
12439
- _this3.isScrollDown = true;
12460
+ _this4.isScrollDown = true;
12440
12461
  }
12441
- } else if (_this3.preVscroll < window.scrollY) {
12462
+ } else if (_this4.preVscroll < window.scrollY) {
12442
12463
  if (isScrollDown) {
12443
- _this3.isScrollDown = false;
12464
+ _this4.isScrollDown = false;
12444
12465
  }
12445
12466
  }
12446
- _this3.preVscroll = window.scrollY;
12467
+ _this4.preVscroll = window.scrollY;
12447
12468
  };
12448
12469
 
12449
12470
  this.loadmore = function () {
12450
- var queueData = [].concat(_babelHelpers.toConsumableArray(_this3.state.queueData));
12451
- var relatedArticles = [].concat(_babelHelpers.toConsumableArray(_this3.state.relatedArticles));
12471
+ var queueData = [].concat(_babelHelpers.toConsumableArray(_this4.state.queueData));
12472
+ var relatedArticles = [].concat(_babelHelpers.toConsumableArray(_this4.state.relatedArticles));
12452
12473
  if (relatedArticles.length > 0) {
12453
12474
  queueData.push(relatedArticles.shift());
12454
- _this3.setState({ queueData: queueData, relatedArticles: relatedArticles });
12475
+ _this4.setState({ queueData: queueData, relatedArticles: relatedArticles });
12455
12476
  }
12456
12477
  };
12457
12478
 
12458
12479
  this.isCutomPage = function (article) {
12459
12480
  var url = article.url.current;
12460
- var _props2 = _this3.props,
12481
+ var _props2 = _this4.props,
12461
12482
  regionalPages = _props2.regionalPages,
12462
12483
  nationalPage = _props2.nationalPage;
12463
12484
 
@@ -12465,7 +12486,7 @@ var _initialiseProps = function _initialiseProps() {
12465
12486
  };
12466
12487
 
12467
12488
  this.urlFor = function (source) {
12468
- return index$1.imageUrlBuilder(_this3.props.client).image(source);
12489
+ return index$1.imageUrlBuilder(_this4.props.client).image(source);
12469
12490
  };
12470
12491
 
12471
12492
  this.getTargeting = function (article) {
@@ -12490,7 +12511,7 @@ var _initialiseProps = function _initialiseProps() {
12490
12511
  content_placement = article.content_placement;
12491
12512
 
12492
12513
  var context = url;
12493
- var localHistory = _this3.props.historyCookie ? JSON.parse(_this3.props.historyCookie) : [];
12514
+ var localHistory = _this4.props.historyCookie ? JSON.parse(_this4.props.historyCookie) : [];
12494
12515
  if (!context && localHistory) {
12495
12516
  context = localHistory[localHistory.length - 1];
12496
12517
  }
@@ -12529,7 +12550,7 @@ var _initialiseProps = function _initialiseProps() {
12529
12550
  var _article$taxonomyMapp = article.taxonomyMapping,
12530
12551
  taxonomyMapping = _article$taxonomyMapp === undefined ? [] : _article$taxonomyMapp;
12531
12552
 
12532
- if (_this3.props.checkSponsered) {
12553
+ if (_this4.props.checkSponsered) {
12533
12554
 
12534
12555
  return taxonomyMapping.some(function (item) {
12535
12556
  return item._ref === 'ict_taxonomy_735_sponsoredresources';
@@ -12541,7 +12562,7 @@ var _initialiseProps = function _initialiseProps() {
12541
12562
 
12542
12563
  this.renderIsiContent = function (article) {
12543
12564
  var url = article.url.current;
12544
- var _props3 = _this3.props,
12565
+ var _props3 = _this4.props,
12545
12566
  ISIContent = _props3.iSIContent,
12546
12567
  regionalPages = _props3.regionalPages,
12547
12568
  nationalPage = _props3.nationalPage;
@@ -12575,7 +12596,7 @@ var _initialiseProps = function _initialiseProps() {
12575
12596
  };
12576
12597
 
12577
12598
  this.refreshAdd = function (path) {
12578
- var article = _this3.state.queueData.find(function (item) {
12599
+ var article = _this4.state.queueData.find(function (item) {
12579
12600
  return item.url.current == path;
12580
12601
  });
12581
12602
  var title = article.title,
@@ -12595,52 +12616,53 @@ var _initialiseProps = function _initialiseProps() {
12595
12616
  var description = _article$seo.meta_description;
12596
12617
 
12597
12618
  var keywords = [].concat(_babelHelpers.toConsumableArray(internalTag), _babelHelpers.toConsumableArray(userDefinedTag), _babelHelpers.toConsumableArray(SponsorshipTag), _babelHelpers.toConsumableArray(seoTag));
12598
- var config = _babelHelpers._extends({}, _this3.state.config);
12599
- var targeting = _this3.getTargeting(article);
12619
+ var config = _babelHelpers._extends({}, _this4.state.config);
12620
+ var targeting = _this4.getTargeting(article);
12600
12621
  var rightItems = [];
12601
12622
 
12602
- if (_this3.checkSponseredArticle(article)) {
12623
+ if (_this4.checkSponseredArticle(article)) {
12603
12624
  rightItems = [];
12604
12625
  } else {
12605
- rightItems = _this3.props.Ads.getRightItems(targeting);
12626
+ rightItems = _this4.props.Ads.getRightItems(targeting);
12606
12627
  }
12607
- var horizontalAD = _this3.props.Ads.getHorizontal(targeting);
12628
+ var horizontalAD = _this4.props.Ads.getHorizontal(targeting);
12608
12629
  config.rightItems = rightItems;
12609
12630
  config.horizontalAD = horizontalAD;
12610
- var metaDescription = description ? description : summary ? summary : _this3.getFirstLine(article);
12611
- _this3.setState({ config: config, title: title, summary: metaDescription }, function () {
12631
+ var metaDescription = description ? description : summary ? summary : _this4.getFirstLine(article);
12632
+ _this4.setState({ config: config, title: title, summary: metaDescription }, function () {
12612
12633
  index.lib_3.refresh();
12613
12634
  });
12614
12635
  };
12615
12636
 
12616
12637
  this.changeUrl = function (path, visibility) {
12617
- var isScrollDown = _this3.isScrollDown;
12638
+ var isScrollDown = _this4.isScrollDown;
12618
12639
 
12619
12640
  var newPath = '/view/' + path;
12620
12641
  if (!isScrollDown) {
12621
12642
  if (visibility == 'top') {
12622
12643
  // Router.push('/view/[url]', newPath, {shallow:true})
12623
12644
  window.history.pushState({ page: path }, path, newPath);
12624
- if (_this3.props.pageview) {
12625
- _this3.props.pageview(newPath);
12645
+ if (_this4.props.pageview) {
12646
+ _this4.props.pageview(newPath);
12626
12647
  }
12627
12648
 
12628
- _this3.refreshAdd(path);
12649
+ _this4.refreshAdd(path);
12629
12650
  }
12630
12651
  } else {
12631
12652
  if (visibility == 'bottom') {
12632
12653
  // Router.push('/view/[url]', newPath, {shallow:true})
12633
12654
  window.history.pushState({ page: path }, path, newPath);
12634
- if (_this3.props.pageview) {
12635
- _this3.props.pageview(newPath);
12655
+ if (_this4.props.pageview) {
12656
+ _this4.props.pageview(newPath);
12636
12657
  }
12637
12658
 
12638
- _this3.refreshAdd(path);
12659
+ _this4.refreshAdd(path);
12639
12660
  }
12640
12661
  }
12641
12662
  };
12642
12663
  };
12643
12664
 
12665
+ exports.AdSlot = AdSlot.DFPAdSlot;
12644
12666
  exports.DeckContent = DeckContent;
12645
12667
  exports.AD = GridContent.AD;
12646
12668
  exports.GridContent = GridContent.GridContent;
@@ -12656,7 +12678,6 @@ exports.PublicationDeck = PublicationDeck;
12656
12678
  exports.IssueDeck = IssueDeck;
12657
12679
  exports.IssueContentDeck = IssueContentDeck;
12658
12680
  exports.AD728x90 = TemplateNormal.AD728x90;
12659
- exports.AdSlot = TemplateNormal.DFPAdSlot;
12660
12681
  exports.Column1 = TemplateNormal.Column1;
12661
12682
  exports.Column2 = TemplateNormal.Column2;
12662
12683
  exports.Column3 = TemplateNormal.Column3;
@@ -0,0 +1,64 @@
1
+ import React__default, { useState } from 'react';
2
+ import { b as lib_2 } from './index-6a79dad6.js';
3
+ import PropTypes from 'prop-types';
4
+ import { d as debounce_1 } from './debounce-dc0c02e5.js';
5
+ import { s as slicedToArray } from './_babelHelpers-67c05996.js';
6
+
7
+ var DFPAdSlot = function DFPAdSlot(_ref) {
8
+ var adUnit = _ref.adUnit,
9
+ sizeMapping = _ref.sizeMapping,
10
+ className = _ref.className,
11
+ slotId = _ref.slotId,
12
+ sizes = _ref.sizes,
13
+ _ref$targeting = _ref.targeting,
14
+ targeting = _ref$targeting === undefined ? {} : _ref$targeting;
15
+
16
+ var _useState = useState(false),
17
+ _useState2 = slicedToArray(_useState, 2),
18
+ adRendered = _useState2[0],
19
+ setAdRendered = _useState2[1];
20
+
21
+ var _useState3 = useState(false),
22
+ _useState4 = slicedToArray(_useState3, 2),
23
+ adRefreshable = _useState4[0],
24
+ setAdRefreshable = _useState4[1];
25
+
26
+ var handleVisibilityChange = debounce_1(function (_ref2) {
27
+ var event = _ref2.event;
28
+
29
+ if (event.inViewPercentage <= 0) {
30
+ setAdRefreshable(false);
31
+ } else {
32
+ setAdRefreshable(true);
33
+ }
34
+ }, 500);
35
+
36
+ return React__default.createElement(
37
+ 'div',
38
+ { className: className },
39
+ React__default.createElement(lib_2, {
40
+ slotId: slotId,
41
+ sizes: sizes,
42
+ adUnit: adUnit,
43
+ sizeMapping: sizeMapping,
44
+ targetingArguments: targeting,
45
+ onSlotRender: function onSlotRender(eventData) {
46
+ setAdRendered(true);
47
+ },
48
+ onSlotVisibilityChanged: handleVisibilityChange,
49
+ shouldRefresh: function shouldRefresh() {
50
+ if (adRendered && adRefreshable) return true;else return false;
51
+ }
52
+ })
53
+ );
54
+ };
55
+
56
+ DFPAdSlot.propTypes = {
57
+ adUnit: PropTypes.string.isRequired,
58
+ slotId: PropTypes.string,
59
+ className: PropTypes.string,
60
+ sizeMapping: PropTypes.array,
61
+ sizes: PropTypes.array
62
+ };
63
+
64
+ export { DFPAdSlot as D };