@mjhls/mjh-framework 1.0.881-beta.0 → 1.0.881-beta.1

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.
@@ -44,7 +44,7 @@ require('./ADInfeed-2e48af77.js');
44
44
  require('./lodash-fc2922d0.js');
45
45
  require('./ADlgInfeed-c39c7131.js');
46
46
  require('react-bootstrap/Spinner');
47
- require('./Pagination-d6a59f99.js');
47
+ require('./Pagination-f3ef7bc1.js');
48
48
  var MasterDeck = require('./MasterDeck.js');
49
49
 
50
50
  var _this = undefined;
@@ -39,11 +39,12 @@ var urlFor = require('./urlFor.js');
39
39
  var index$2 = require('./index-96b3db50.js');
40
40
  var main = require('./main-02daeefe.js');
41
41
  var entities = require('./entities-310b46ee.js');
42
+ var stringify = require('./stringify-bbc68047.js');
42
43
  var asyncToGenerator = require('./asyncToGenerator-df19209d.js');
43
44
  var get = require('./get-adbb11e3.js');
44
45
  require('./eq-bb2843ed.js');
45
46
  var Spinner = _interopDefault(require('react-bootstrap/Spinner'));
46
- var Pagination = require('./Pagination-d6a59f99.js');
47
+ var Pagination = require('./Pagination-f3ef7bc1.js');
47
48
 
48
49
  var DeckQueue = function (_React$Component) {
49
50
  inherits._inherits(DeckQueue, _React$Component);
@@ -60,11 +61,12 @@ var DeckQueue = function (_React$Component) {
60
61
  args[_key] = arguments[_key];
61
62
  }
62
63
 
63
- return _ret = (_temp = (_this = inherits._possibleConstructorReturn(this, (_ref = DeckQueue.__proto__ || inherits._Object$getPrototypeOf(DeckQueue)).call.apply(_ref, [this].concat(args))), _this), _this.page = _this.props.page, _this.data = _this.props.dataRecord, _this.query = _this.props.query, _this.params = _this.props.params, _this.client = _this.props.client, _this.pointer = _this.props.pointer ? _this.props.pointer : false, _this.pointerArray = _this.props.pointerArray ? _this.props.pointerArray : false, _this.defaultImage = _this.props.defaultImage ? _this.props.defaultImage : '/placeholder.jpg', _this.imageHeight = _this.props.imageHeight ? _this.props.imageHeight : 270, _this.state = {
64
+ return _ret = (_temp = (_this = inherits._possibleConstructorReturn(this, (_ref = DeckQueue.__proto__ || inherits._Object$getPrototypeOf(DeckQueue)).call.apply(_ref, [this].concat(args))), _this), _this.page = _this.props.page, _this.data = _this.props.dataRecord, _this.client = _this.props.client, _this.pointer = _this.props.pointer ? _this.props.pointer : false, _this.pointerArray = _this.props.pointerArray ? _this.props.pointerArray : false, _this.defaultImage = _this.props.defaultImage ? _this.props.defaultImage : '/placeholder.jpg', _this.imageHeight = _this.props.imageHeight ? _this.props.imageHeight : 270, _this.state = {
64
65
  data: _this.data,
66
+ prevData: _this.data,
65
67
  currentPage: _this.props.currentPage || 1,
66
68
  isDataLoading: false,
67
- itemsPerPage: _this.params ? _this.params.to - _this.params.from : 2
69
+ itemsPerPage: _this.props.params ? _this.props.params.to - _this.props.params.from : 2
68
70
  }, _this.renderCardImage = function (row) {
69
71
  if (row.thumbnail && row.thumbnail.asset) {
70
72
  var url = urlFor({
@@ -172,6 +174,13 @@ var DeckQueue = function (_React$Component) {
172
174
  }
173
175
 
174
176
  inherits._createClass(DeckQueue, [{
177
+ key: 'componentDidUpdate',
178
+ value: function componentDidUpdate(prevProps, prevState) {
179
+ if (stringify._JSON$stringify(prevState.prevData) !== stringify._JSON$stringify(this.state.prevData)) {
180
+ this.seoPagination(this.state.currentPage);
181
+ }
182
+ }
183
+ }, {
175
184
  key: 'cardLoader',
176
185
  value: function cardLoader(_ref3) {
177
186
  var _this3 = this;
@@ -271,6 +280,7 @@ var DeckQueue = function (_React$Component) {
271
280
  variant = _props.variant,
272
281
  totalDataCount = _props.totalDataCount;
273
282
  var _state = this.state,
283
+ data = _state.data,
274
284
  isDataLoading = _state.isDataLoading,
275
285
  itemsPerPage = _state.itemsPerPage,
276
286
  currentPage = _state.currentPage;
@@ -290,7 +300,7 @@ var DeckQueue = function (_React$Component) {
290
300
  'Loading...'
291
301
  )
292
302
  )
293
- ) : React__default.createElement(
303
+ ) : data && data.length > 0 ? React__default.createElement(
294
304
  Container,
295
305
  null,
296
306
  this.cardLoader({ columns: columns, variant: variant }),
@@ -309,9 +319,21 @@ var DeckQueue = function (_React$Component) {
309
319
  '\n .pagination-wrapper {\n margin: 3rem 0;\n }\n @media only screen and (max-width: 768px) {\n .pagination-wrapper {\n margin-bottom: 6rem;\n }\n }\n '
310
320
  )
311
321
  )
312
- )
322
+ ) : null
313
323
  );
314
324
  }
325
+ }], [{
326
+ key: 'getDerivedStateFromProps',
327
+ value: function getDerivedStateFromProps(props, state) {
328
+ if (stringify._JSON$stringify(props.dataRecord) !== stringify._JSON$stringify(state.prevData)) {
329
+ return {
330
+ data: props.dataRecord,
331
+ prevData: props.dataRecord,
332
+ currentPage: props.currentPage
333
+ };
334
+ }
335
+ return null;
336
+ }
315
337
  }]);
316
338
 
317
339
  return DeckQueue;
@@ -48,7 +48,7 @@ require('./ADlgInfeed-c39c7131.js');
48
48
  require('./getContentCategory-f38a4c00.js');
49
49
  require('./AuthorComponent-02e827ae.js');
50
50
  require('react-bootstrap/Button');
51
- require('./Pagination-d6a59f99.js');
51
+ require('./Pagination-f3ef7bc1.js');
52
52
  var BlockContent = require('./BlockContent-091a991f.js');
53
53
  require('./index-187c967e.js');
54
54
  require('./smoothscroll-5054361f.js');
@@ -36,7 +36,7 @@ var visibilitySensor = require('./visibility-sensor-ad5e3116.js');
36
36
  require('./slicedToArray-f6d4eaa8.js');
37
37
  require('./index-be0c82be.js');
38
38
  var main = require('./main-02daeefe.js');
39
- require('./stringify-bbc68047.js');
39
+ var stringify = require('./stringify-bbc68047.js');
40
40
  var asyncToGenerator = require('./asyncToGenerator-df19209d.js');
41
41
  require('./Segment.js');
42
42
  require('./Beam.js');
@@ -45,7 +45,7 @@ var ADInfeed = require('./ADInfeed-2e48af77.js');
45
45
  var lodash = require('./lodash-fc2922d0.js');
46
46
  var ADlgInfeed = require('./ADlgInfeed-c39c7131.js');
47
47
  var Spinner = _interopDefault(require('react-bootstrap/Spinner'));
48
- var Pagination = require('./Pagination-d6a59f99.js');
48
+ var Pagination = require('./Pagination-f3ef7bc1.js');
49
49
 
50
50
  var MasterDeck = function (_React$Component) {
51
51
  inherits._inherits(MasterDeck, _React$Component);
@@ -62,12 +62,13 @@ var MasterDeck = function (_React$Component) {
62
62
  args[_key] = arguments[_key];
63
63
  }
64
64
 
65
- return _ret = (_temp = (_this = inherits._possibleConstructorReturn(this, (_ref = MasterDeck.__proto__ || inherits._Object$getPrototypeOf(MasterDeck)).call.apply(_ref, [this].concat(args))), _this), _this.Deck = _this.props.deck, _this.variant = _this.props.variant, _this.mapping = _this.props.mapping, _this.data = _this.props.dataRecord || [], _this.query = _this.props.query, _this.params = _this.props.params, _this.pointer = _this.props.pointer ? _this.props.pointer : false, _this.pointerArray = _this.props.pointerArray ? _this.props.pointerArray : false, _this.defaultImage = _this.props.defaultImage ? _this.props.defaultImage : '/placeholder.jpg', _this.rightItems = _this.props.rightItems ? _this.props.rightItems : false, _this.isSeriesLanding = _this.props.isSeriesLanding ? _this.props.isSeriesLanding : false, _this.client = _this.props.client, _this.state = {
65
+ return _ret = (_temp = (_this = inherits._possibleConstructorReturn(this, (_ref = MasterDeck.__proto__ || inherits._Object$getPrototypeOf(MasterDeck)).call.apply(_ref, [this].concat(args))), _this), _this.Deck = _this.props.deck, _this.data = _this.props.dataRecord || [], _this.pointer = _this.props.pointer ? _this.props.pointer : false, _this.pointerArray = _this.props.pointerArray ? _this.props.pointerArray : false, _this.defaultImage = _this.props.defaultImage ? _this.props.defaultImage : '/placeholder.jpg', _this.rightItems = _this.props.rightItems ? _this.props.rightItems : false, _this.isSeriesLanding = _this.props.isSeriesLanding ? _this.props.isSeriesLanding : false, _this.state = {
66
66
  isDataLoading: false,
67
67
  data: _this.data,
68
+ prevData: _this.data,
68
69
  currentPage: _this.props.currentPage || 1,
69
70
  dataRemapped: !_this.props.showBI || !_this.props.brandInsightAd,
70
- itemsPerPage: _this.params ? _this.params.to - _this.params.from : 2,
71
+ itemsPerPage: _this.props.params ? _this.props.params.to - _this.props.params.from : 2,
71
72
  mobileView: false
72
73
  }, _this.seoPagination = function (pageNumber) {
73
74
  var _this$props = _this.props,
@@ -359,17 +360,17 @@ var MasterDeck = function (_React$Component) {
359
360
  inherits._createClass(MasterDeck, [{
360
361
  key: 'componentDidUpdate',
361
362
  value: function componentDidUpdate(prevProps, prevState) {
363
+ if (stringify._JSON$stringify(prevState.prevData) !== stringify._JSON$stringify(this.state.prevData)) {
364
+ this.seoPagination(this.state.currentPage);
365
+ }
362
366
  // set dataRemap to true as there are no infeed or BI ads or window width is less than limit
363
367
  if (typeof window !== 'undefined' && (!this.props.lgInfeedAd || !this.props.brandInsightAd || window.innerWidth < 1400) && !this.state.dataRemapped) {
364
368
  !this.state.dataRemapped && this.setState({ dataRemapped: true });
365
369
  }
366
-
367
370
  if (typeof window !== 'undefined' && window.innerWidth <= 1191) {
368
371
  !this.state.mobileView && this.setState({ mobileView: true });
369
372
  }
370
373
  }
371
- // Passing 'brandInsightAd','showBI' and 'lgInfeedAd'
372
-
373
374
  }, {
374
375
  key: 'render',
375
376
  value: function render() {
@@ -383,6 +384,7 @@ var MasterDeck = function (_React$Component) {
383
384
  lgInfeedAd = _props$lgInfeedAd === undefined ? false : _props$lgInfeedAd,
384
385
  totalDataCount = _props.totalDataCount;
385
386
  var _state = this.state,
387
+ data = _state.data,
386
388
  itemsPerPage = _state.itemsPerPage,
387
389
  currentPage = _state.currentPage,
388
390
  isDataLoading = _state.isDataLoading;
@@ -402,7 +404,7 @@ var MasterDeck = function (_React$Component) {
402
404
  'Loading...'
403
405
  )
404
406
  )
405
- ) : React__default.createElement(
407
+ ) : data && data.length > 0 ? React__default.createElement(
406
408
  Container,
407
409
  null,
408
410
  this.cardLoader({ variant: variant, brandInsightAd: brandInsightAd, showBI: showBI, lgInfeedAd: lgInfeedAd }),
@@ -421,9 +423,23 @@ var MasterDeck = function (_React$Component) {
421
423
  '\n .pagination-wrapper {\n margin: 3rem 0;\n }\n @media only screen and (max-width: 768px) {\n .pagination-wrapper {\n margin-bottom: 6rem;\n }\n }\n '
422
424
  )
423
425
  )
424
- )
426
+ ) : null
425
427
  );
426
428
  }
429
+ }], [{
430
+ key: 'getDerivedStateFromProps',
431
+ value: function getDerivedStateFromProps(props, state) {
432
+ if (stringify._JSON$stringify(props.dataRecord) !== stringify._JSON$stringify(state.prevData)) {
433
+ return {
434
+ data: props.dataRecord,
435
+ prevData: props.dataRecord,
436
+ currentPage: props.currentPage
437
+ };
438
+ }
439
+ return null;
440
+ }
441
+ // Passing 'brandInsightAd','showBI' and 'lgInfeedAd'
442
+
427
443
  }]);
428
444
 
429
445
  return MasterDeck;
@@ -694,6 +710,7 @@ var MasterDeck$1 = function (_React$Component) {
694
710
  content_placement: brandInsightAd.targeting.content_placement,
695
711
  document_url: brandInsightAd.targeting.document_url,
696
712
  rootDocumentGroup: brandInsightAd.targeting.rootDocumentGroup
713
+
697
714
  },
698
715
  _type: 'brandInsightAd',
699
716
  /* Passing refresh flag */
@@ -858,6 +875,7 @@ var MasterDeck$1 = function (_React$Component) {
858
875
  value: function render() {
859
876
  var _this3 = this;
860
877
 
878
+ if (this.props.totalDataCount) return React__default.createElement(MasterDeckPaginated, this.props);
861
879
  // Setting default value for 'showBI' and 'lgInfeedAd'
862
880
  var _props = this.props,
863
881
  columns = _props.columns,
@@ -870,9 +888,6 @@ var MasterDeck$1 = function (_React$Component) {
870
888
  _props$lgInfeedAd = _props.lgInfeedAd,
871
889
  lgInfeedAd = _props$lgInfeedAd === undefined ? false : _props$lgInfeedAd;
872
890
 
873
-
874
- if (this.props.totalDataCount) return React__default.createElement(MasterDeckPaginated, this.props);
875
-
876
891
  return React__default.createElement(
877
892
  'div',
878
893
  { className: 'contentDeck' },