@mjhls/mjh-framework 1.0.378 → 1.0.380

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,5 +1,5 @@
1
1
 
2
- # mjh-framework v. 1.0.378
2
+ # mjh-framework v. 1.0.380
3
3
 
4
4
 
5
5
  > Foundation Framework
@@ -34,7 +34,8 @@ var FigureComponent = function FigureComponent(props) {
34
34
  setOpenImgSrc = _useState4[1];
35
35
 
36
36
  var node = props.node,
37
- client = props.client;
37
+ client = props.client,
38
+ contextualADFlag = props.contextualADFlag;
38
39
  var caption = node.caption,
39
40
  alt = node.alt,
40
41
  blank = node.blank,
@@ -121,7 +122,7 @@ var FigureComponent = function FigureComponent(props) {
121
122
  caption && React__default.createElement('div', { dangerouslySetInnerHTML: { __html: '<span class=\'figure-caption\'>' + caption + '</span>' } })
122
123
  )
123
124
  ),
124
- React__default.createElement('p', { className: 'clearfix' }),
125
+ contextualADFlag && React__default.createElement('p', { className: 'clearfix' }),
125
126
  React__default.createElement(
126
127
  'div',
127
128
  { className: 'lightbox-target ' + (openImg ? 'open' : 'close') },
package/dist/cjs/index.js CHANGED
@@ -8910,7 +8910,9 @@ function (_React$Component) {
8910
8910
 
8911
8911
  var Video = function Video(_ref) {
8912
8912
  var node = _ref.node,
8913
- accountIDs = _ref.accountIDs;
8913
+ accountIDs = _ref.accountIDs,
8914
+ _ref$autoplay = _ref.autoplay,
8915
+ autoplay = _ref$autoplay === undefined ? false : _ref$autoplay;
8914
8916
  var source = node.source,
8915
8917
  videoID = node.videoID,
8916
8918
  playlistID = node.playlistID,
@@ -8930,6 +8932,19 @@ var Video = function Video(_ref) {
8930
8932
  var queue = Math.floor(duration / 10);
8931
8933
  var segment = Math.floor(current / queue);
8932
8934
 
8935
+ // try to auto play first with no-mute
8936
+ if (autoplay) {
8937
+ player.play().then(function () {
8938
+ player.muted(false);
8939
+ }).catch(function (error) {
8940
+ // then try to auto play with mute
8941
+ player.muted(true);
8942
+ player.play();
8943
+ });
8944
+ } else {
8945
+ player.pause();
8946
+ }
8947
+
8933
8948
  AdSlot.Beam.report_beam_video('Ready', main.main_16, duration, current, segment, 'BrightCove', accountIDs.brightcove.playerId, accountIDs.brightcove.accountId, videoID);
8934
8949
  });
8935
8950
 
@@ -8992,14 +9007,14 @@ var Video = function Video(_ref) {
8992
9007
 
8993
9008
  if (source === 'brightcove' && accountIDs.brightcove) {
8994
9009
  if (videoID) {
8995
- return React__default.createElement(ReactPlayerLoader, { onSuccess: onVideoSuccess, accountId: accountIDs.brightcove.accountId, videoId: videoID, playerId: accountIDs.brightcove.playerId, attrs: { className: 'brightcove' } });
9010
+ return React__default.createElement(ReactPlayerLoader, { onSuccess: onVideoSuccess, accountId: accountIDs.brightcove.accountId, videoId: videoID, playerId: accountIDs.brightcove.playerId, attrs: { className: 'brightcove', autoplay: 'muted' } });
8996
9011
  } else if (playlistID) {
8997
9012
  return React__default.createElement(ReactPlayerLoader, {
8998
9013
  accountId: accountIDs.brightcove.accountId,
8999
9014
  playlistId: playlistID,
9000
9015
  playerId: accountIDs.brightcove.playerId,
9001
9016
  onSuccess: onVideoSuccess,
9002
- attrs: { className: 'brightcove brightcove-playlist' }
9017
+ attrs: { className: 'brightcove brightcove-playlist', autoplay: 'muted' }
9003
9018
  });
9004
9019
  } else if (experienceID) {
9005
9020
  return React__default.createElement(
@@ -14385,7 +14400,7 @@ var NativeAd = function NativeAd(props) {
14385
14400
  };
14386
14401
 
14387
14402
  var Figure = dynamic(function () {
14388
- return Promise.resolve().then(function () { return require('./Figure-68977d29.js'); });
14403
+ return Promise.resolve().then(function () { return require('./Figure-04b8dbbe.js'); });
14389
14404
  }, { ssr: false });
14390
14405
 
14391
14406
  var checkUrlIsExternal = function checkUrlIsExternal(url) {
@@ -14422,7 +14437,11 @@ var getSerializers = function getSerializers() {
14422
14437
  onVote = props[3],
14423
14438
  showVotes = props[4],
14424
14439
  drupalLeadSettings = props[5],
14425
- currentPage = props[6];
14440
+ currentPage = props[6],
14441
+ _props$ = props[7],
14442
+ autoplay = _props$ === undefined ? false : _props$,
14443
+ _props$2 = props[8],
14444
+ contextualADFlag = _props$2 === undefined ? false : _props$2;
14426
14445
 
14427
14446
  return {
14428
14447
  types: {
@@ -14444,7 +14463,7 @@ var getSerializers = function getSerializers() {
14444
14463
  figure: function figure(_ref3) {
14445
14464
  var node = _ref3.node;
14446
14465
 
14447
- return React__default.createElement(Figure, { node: node, client: client });
14466
+ return React__default.createElement(Figure, { node: node, client: client, contextualADFlag: contextualADFlag });
14448
14467
  },
14449
14468
  slideshow: function slideshow(_ref4) {
14450
14469
  var node = _ref4.node;
@@ -14478,7 +14497,7 @@ var getSerializers = function getSerializers() {
14478
14497
  video: function video(_ref9) {
14479
14498
  var node = _ref9.node;
14480
14499
 
14481
- return React__default.createElement(Video, { node: node, accountIDs: videoAccountIDs || {} });
14500
+ return React__default.createElement(Video, { node: node, autoplay: autoplay, accountIDs: videoAccountIDs || {} });
14482
14501
  },
14483
14502
  audio: function audio(_ref10) {
14484
14503
  var node = _ref10.node;
@@ -17070,6 +17089,10 @@ var Article = function Article(props) {
17070
17089
  shareOptions = props.shareOptions,
17071
17090
  cpModificationRequired = props.cpModificationRequired;
17072
17091
 
17092
+ var _useState = React.useState(null),
17093
+ _useState2 = slicedToArray._slicedToArray(_useState, 2),
17094
+ contextualADFlag = _useState2[0],
17095
+ setContextualADFlag = _useState2[1];
17073
17096
 
17074
17097
  var summary = getArticleSummary(props.article);
17075
17098
 
@@ -17178,6 +17201,11 @@ var Article = function Article(props) {
17178
17201
  parent.style.height = '0%';
17179
17202
  parent.style.width = '0%';
17180
17203
  parent.style.display = 'none';
17204
+ setContextualADFlag(false);
17205
+ } else {
17206
+ if (body && body[1] && body[1]._type === 'figure') {
17207
+ setContextualADFlag(true);
17208
+ }
17181
17209
  }
17182
17210
  };
17183
17211
 
@@ -17185,7 +17213,7 @@ var Article = function Article(props) {
17185
17213
  React__default.Fragment,
17186
17214
  null,
17187
17215
  React__default.createElement(TaxonomyCard.BlockContent, _extends$2._extends({
17188
- serializers: getSerializers(client, pageview, videoAccountIDs, function () {}, true, drupalLeadSettings, currentPage),
17216
+ serializers: getSerializers(client, pageview, videoAccountIDs, function () {}, true, drupalLeadSettings, currentPage, false, contextualADFlag),
17189
17217
  blocks: [].concat(toConsumableArray._toConsumableArray(body.slice(0, selectedIndex))),
17190
17218
  imageOptions: { w: 320, h: 240, fit: 'max' }
17191
17219
  }, client.config())),
@@ -17195,14 +17223,14 @@ var Article = function Article(props) {
17195
17223
  React__default.createElement(AdSlot.DFPAdSlot, _extends$2._extends({}, payload.contextualAD, { refreshFlag: false, checkIsAdFound: checkIsAdFound }))
17196
17224
  ),
17197
17225
  React__default.createElement(TaxonomyCard.BlockContent, _extends$2._extends({
17198
- serializers: getSerializers(client, pageview, videoAccountIDs, function () {}, true, drupalLeadSettings, currentPage),
17226
+ serializers: getSerializers(client, pageview, videoAccountIDs, function () {}, true, drupalLeadSettings, currentPage, false),
17199
17227
  blocks: [].concat(toConsumableArray._toConsumableArray(body.slice(selectedIndex))),
17200
17228
  imageOptions: { w: 320, h: 240, fit: 'max' }
17201
17229
  }, client.config()))
17202
17230
  );
17203
17231
  } else {
17204
17232
  return React__default.createElement(TaxonomyCard.BlockContent, _extends$2._extends({
17205
- serializers: getSerializers(client, pageview, videoAccountIDs, function () {}, true, drupalLeadSettings),
17233
+ serializers: getSerializers(client, pageview, videoAccountIDs, function () {}, true, drupalLeadSettings, currentPage, false),
17206
17234
  blocks: articleBody,
17207
17235
  imageOptions: { w: 320, h: 240, fit: 'max' }
17208
17236
  }, client.config()));
@@ -17490,10 +17518,10 @@ var ArticleQueue = function ArticleQueue(props) {
17490
17518
  return article;
17491
17519
  };
17492
17520
 
17493
- var _useState = React.useState([firstArticle()]),
17494
- _useState2 = slicedToArray._slicedToArray(_useState, 2),
17495
- queueData = _useState2[0],
17496
- setQueueData = _useState2[1];
17521
+ var _useState3 = React.useState([firstArticle()]),
17522
+ _useState4 = slicedToArray._slicedToArray(_useState3, 2),
17523
+ queueData = _useState4[0],
17524
+ setQueueData = _useState4[1];
17497
17525
 
17498
17526
  var refreshAD = function refreshAD(path) {
17499
17527
  if (!main.main_39) {
@@ -29,7 +29,8 @@ var FigureComponent = function FigureComponent(props) {
29
29
  setOpenImgSrc = _useState4[1];
30
30
 
31
31
  var node = props.node,
32
- client = props.client;
32
+ client = props.client,
33
+ contextualADFlag = props.contextualADFlag;
33
34
  var caption = node.caption,
34
35
  alt = node.alt,
35
36
  blank = node.blank,
@@ -116,7 +117,7 @@ var FigureComponent = function FigureComponent(props) {
116
117
  caption && React__default.createElement('div', { dangerouslySetInnerHTML: { __html: '<span class=\'figure-caption\'>' + caption + '</span>' } })
117
118
  )
118
119
  ),
119
- React__default.createElement('p', { className: 'clearfix' }),
120
+ contextualADFlag && React__default.createElement('p', { className: 'clearfix' }),
120
121
  React__default.createElement(
121
122
  'div',
122
123
  { className: 'lightbox-target ' + (openImg ? 'open' : 'close') },
package/dist/esm/index.js CHANGED
@@ -8907,7 +8907,9 @@ function (_React$Component) {
8907
8907
 
8908
8908
  var Video = function Video(_ref) {
8909
8909
  var node = _ref.node,
8910
- accountIDs = _ref.accountIDs;
8910
+ accountIDs = _ref.accountIDs,
8911
+ _ref$autoplay = _ref.autoplay,
8912
+ autoplay = _ref$autoplay === undefined ? false : _ref$autoplay;
8911
8913
  var source = node.source,
8912
8914
  videoID = node.videoID,
8913
8915
  playlistID = node.playlistID,
@@ -8927,6 +8929,19 @@ var Video = function Video(_ref) {
8927
8929
  var queue = Math.floor(duration / 10);
8928
8930
  var segment = Math.floor(current / queue);
8929
8931
 
8932
+ // try to auto play first with no-mute
8933
+ if (autoplay) {
8934
+ player.play().then(function () {
8935
+ player.muted(false);
8936
+ }).catch(function (error) {
8937
+ // then try to auto play with mute
8938
+ player.muted(true);
8939
+ player.play();
8940
+ });
8941
+ } else {
8942
+ player.pause();
8943
+ }
8944
+
8930
8945
  Beam.report_beam_video('Ready', main_16, duration, current, segment, 'BrightCove', accountIDs.brightcove.playerId, accountIDs.brightcove.accountId, videoID);
8931
8946
  });
8932
8947
 
@@ -8989,14 +9004,14 @@ var Video = function Video(_ref) {
8989
9004
 
8990
9005
  if (source === 'brightcove' && accountIDs.brightcove) {
8991
9006
  if (videoID) {
8992
- return React__default.createElement(ReactPlayerLoader, { onSuccess: onVideoSuccess, accountId: accountIDs.brightcove.accountId, videoId: videoID, playerId: accountIDs.brightcove.playerId, attrs: { className: 'brightcove' } });
9007
+ return React__default.createElement(ReactPlayerLoader, { onSuccess: onVideoSuccess, accountId: accountIDs.brightcove.accountId, videoId: videoID, playerId: accountIDs.brightcove.playerId, attrs: { className: 'brightcove', autoplay: 'muted' } });
8993
9008
  } else if (playlistID) {
8994
9009
  return React__default.createElement(ReactPlayerLoader, {
8995
9010
  accountId: accountIDs.brightcove.accountId,
8996
9011
  playlistId: playlistID,
8997
9012
  playerId: accountIDs.brightcove.playerId,
8998
9013
  onSuccess: onVideoSuccess,
8999
- attrs: { className: 'brightcove brightcove-playlist' }
9014
+ attrs: { className: 'brightcove brightcove-playlist', autoplay: 'muted' }
9000
9015
  });
9001
9016
  } else if (experienceID) {
9002
9017
  return React__default.createElement(
@@ -14382,7 +14397,7 @@ var NativeAd = function NativeAd(props) {
14382
14397
  };
14383
14398
 
14384
14399
  var Figure = dynamic(function () {
14385
- return import('./Figure-d0930225.js');
14400
+ return import('./Figure-aa16a017.js');
14386
14401
  }, { ssr: false });
14387
14402
 
14388
14403
  var checkUrlIsExternal = function checkUrlIsExternal(url) {
@@ -14419,7 +14434,11 @@ var getSerializers = function getSerializers() {
14419
14434
  onVote = props[3],
14420
14435
  showVotes = props[4],
14421
14436
  drupalLeadSettings = props[5],
14422
- currentPage = props[6];
14437
+ currentPage = props[6],
14438
+ _props$ = props[7],
14439
+ autoplay = _props$ === undefined ? false : _props$,
14440
+ _props$2 = props[8],
14441
+ contextualADFlag = _props$2 === undefined ? false : _props$2;
14423
14442
 
14424
14443
  return {
14425
14444
  types: {
@@ -14441,7 +14460,7 @@ var getSerializers = function getSerializers() {
14441
14460
  figure: function figure(_ref3) {
14442
14461
  var node = _ref3.node;
14443
14462
 
14444
- return React__default.createElement(Figure, { node: node, client: client });
14463
+ return React__default.createElement(Figure, { node: node, client: client, contextualADFlag: contextualADFlag });
14445
14464
  },
14446
14465
  slideshow: function slideshow(_ref4) {
14447
14466
  var node = _ref4.node;
@@ -14475,7 +14494,7 @@ var getSerializers = function getSerializers() {
14475
14494
  video: function video(_ref9) {
14476
14495
  var node = _ref9.node;
14477
14496
 
14478
- return React__default.createElement(Video, { node: node, accountIDs: videoAccountIDs || {} });
14497
+ return React__default.createElement(Video, { node: node, autoplay: autoplay, accountIDs: videoAccountIDs || {} });
14479
14498
  },
14480
14499
  audio: function audio(_ref10) {
14481
14500
  var node = _ref10.node;
@@ -17067,6 +17086,10 @@ var Article = function Article(props) {
17067
17086
  shareOptions = props.shareOptions,
17068
17087
  cpModificationRequired = props.cpModificationRequired;
17069
17088
 
17089
+ var _useState = useState(null),
17090
+ _useState2 = _slicedToArray(_useState, 2),
17091
+ contextualADFlag = _useState2[0],
17092
+ setContextualADFlag = _useState2[1];
17070
17093
 
17071
17094
  var summary = getArticleSummary(props.article);
17072
17095
 
@@ -17175,6 +17198,11 @@ var Article = function Article(props) {
17175
17198
  parent.style.height = '0%';
17176
17199
  parent.style.width = '0%';
17177
17200
  parent.style.display = 'none';
17201
+ setContextualADFlag(false);
17202
+ } else {
17203
+ if (body && body[1] && body[1]._type === 'figure') {
17204
+ setContextualADFlag(true);
17205
+ }
17178
17206
  }
17179
17207
  };
17180
17208
 
@@ -17182,7 +17210,7 @@ var Article = function Article(props) {
17182
17210
  React__default.Fragment,
17183
17211
  null,
17184
17212
  React__default.createElement(BlockContent, _extends$2({
17185
- serializers: getSerializers(client, pageview, videoAccountIDs, function () {}, true, drupalLeadSettings, currentPage),
17213
+ serializers: getSerializers(client, pageview, videoAccountIDs, function () {}, true, drupalLeadSettings, currentPage, false, contextualADFlag),
17186
17214
  blocks: [].concat(_toConsumableArray(body.slice(0, selectedIndex))),
17187
17215
  imageOptions: { w: 320, h: 240, fit: 'max' }
17188
17216
  }, client.config())),
@@ -17192,14 +17220,14 @@ var Article = function Article(props) {
17192
17220
  React__default.createElement(DFPAdSlot, _extends$2({}, payload.contextualAD, { refreshFlag: false, checkIsAdFound: checkIsAdFound }))
17193
17221
  ),
17194
17222
  React__default.createElement(BlockContent, _extends$2({
17195
- serializers: getSerializers(client, pageview, videoAccountIDs, function () {}, true, drupalLeadSettings, currentPage),
17223
+ serializers: getSerializers(client, pageview, videoAccountIDs, function () {}, true, drupalLeadSettings, currentPage, false),
17196
17224
  blocks: [].concat(_toConsumableArray(body.slice(selectedIndex))),
17197
17225
  imageOptions: { w: 320, h: 240, fit: 'max' }
17198
17226
  }, client.config()))
17199
17227
  );
17200
17228
  } else {
17201
17229
  return React__default.createElement(BlockContent, _extends$2({
17202
- serializers: getSerializers(client, pageview, videoAccountIDs, function () {}, true, drupalLeadSettings),
17230
+ serializers: getSerializers(client, pageview, videoAccountIDs, function () {}, true, drupalLeadSettings, currentPage, false),
17203
17231
  blocks: articleBody,
17204
17232
  imageOptions: { w: 320, h: 240, fit: 'max' }
17205
17233
  }, client.config()));
@@ -17487,10 +17515,10 @@ var ArticleQueue = function ArticleQueue(props) {
17487
17515
  return article;
17488
17516
  };
17489
17517
 
17490
- var _useState = useState([firstArticle()]),
17491
- _useState2 = _slicedToArray(_useState, 2),
17492
- queueData = _useState2[0],
17493
- setQueueData = _useState2[1];
17518
+ var _useState3 = useState([firstArticle()]),
17519
+ _useState4 = _slicedToArray(_useState3, 2),
17520
+ queueData = _useState4[0],
17521
+ setQueueData = _useState4[1];
17494
17522
 
17495
17523
  var refreshAD = function refreshAD(path) {
17496
17524
  if (!main_39) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mjhls/mjh-framework",
3
- "version": "1.0.378",
3
+ "version": "1.0.380",
4
4
  "description": "Foundation Framework",
5
5
  "author": "mjh-framework",
6
6
  "license": "MIT",