@mjhls/mjh-framework 1.0.441 → 1.0.443

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.441
2
+ # mjh-framework v. 1.0.443
3
3
 
4
4
  > Foundation Framework
5
5
 
@@ -108,6 +108,16 @@ var GridContent = function (_React$Component) {
108
108
  if (prevState.currentPage !== _this.state.currentPage) {
109
109
  document.addEventListener('scroll', _this.trackScrolling);
110
110
  }
111
+
112
+ // Logging GA Pageview on path change
113
+ var _this$props = _this.props,
114
+ pageview = _this$props.pageview,
115
+ currentPath = _this$props.router.asPath;
116
+ var prevPath = prevProps.router.asPath;
117
+
118
+ if (pageview && currentPath !== prevPath) {
119
+ pageview(currentPath);
120
+ }
111
121
  }, _this.trackScrolling = function () {
112
122
  var itemsPerPage = _this.props.params.itemsPerPage ? _this.props.params.itemsPerPage : 10;
113
123
  if (window.pageYOffset === 0) {
@@ -166,10 +176,10 @@ var GridContent = function (_React$Component) {
166
176
  return _this.defaultImage;
167
177
  }
168
178
  }, _this.changePageNumber = function (pageNumber, itemsPerPage, itemIndex) {
169
- var _this$props = _this.props,
170
- seoPaginate = _this$props.seoPaginate,
171
- pageview = _this$props.pageview,
172
- router = _this$props.router;
179
+ var _this$props2 = _this.props,
180
+ seoPaginate = _this$props2.seoPaginate,
181
+ pageview = _this$props2.pageview,
182
+ router = _this$props2.router;
173
183
  var currentPage = _this.state.currentPage;
174
184
 
175
185
  if (seoPaginate) {
@@ -218,9 +228,9 @@ var GridContent = function (_React$Component) {
218
228
  }
219
229
 
220
230
  var newPath = pageNumber === 1 ? '' + path : path + '?page=' + pageNumber;
221
- if (pageview) {
222
- pageview(newPath);
223
- }
231
+ // if (pageview) {
232
+ // pageview(newPath)
233
+ // }
224
234
 
225
235
  router.push(pathname, newPath, {
226
236
  shallow: true
@@ -33,7 +33,7 @@ require('./ADInfeed-ae1f348d.js');
33
33
  require('./lodash-fc2922d0.js');
34
34
  require('./ADlgInfeed-f4c4a1bf.js');
35
35
  require('./get-7a75c563.js');
36
- var GridContent = require('./GridContent-db383f73.js');
36
+ var GridContent = require('./GridContent-25762807.js');
37
37
  require('./AuthorComponent-b44bb44e.js');
38
38
 
39
39
 
@@ -130,9 +130,9 @@ var changePageNumber = function changePageNumber(pageNumber, seoPaginate, pagevi
130
130
  }
131
131
  var newPath = pageNumber === 1 ? '' + path : '' + path + (queryString.length > 0 ? '&' : '?') + 'page=' + pageNumber;
132
132
 
133
- if (pageview) {
134
- pageview(newPath);
135
- }
133
+ // if (pageview) {
134
+ // pageview(newPath)
135
+ // }
136
136
 
137
137
  router.push(pathname, newPath, {
138
138
  shallow: true
@@ -576,6 +576,18 @@ var usePrevious = function usePrevious(value) {
576
576
 
577
577
  var QueueDeckExpanded = function QueueDeckExpanded(props) {
578
578
  var router = Router.useRouter();
579
+
580
+ // Logging GA Pageview on path change
581
+ var prevPath = usePrevious(lodash.lodash.get(router, 'asPath', undefined));
582
+ React.useEffect(function () {
583
+ var pageview = props.pageview;
584
+
585
+ var currentPath = router.asPath;
586
+ if (prevPath && prevPath !== currentPath && pageview) {
587
+ pageview(router.asPath);
588
+ }
589
+ }, [router]);
590
+
579
591
  var initialData = props.dataRecord,
580
592
  client = props.client,
581
593
  params = props.params,
@@ -640,6 +652,23 @@ var QueueDeckExpanded = function QueueDeckExpanded(props) {
640
652
  var itemsPerPage = params && params.itemsPerPage ? params.itemsPerPage : 10;
641
653
 
642
654
  var prevValues = usePrevious(values);
655
+
656
+ //check for change in filter parameters from client side and refresh the page
657
+ React.useEffect(function () {
658
+ if (initialData && data !== initialData && initialData.length >= 0) {
659
+ setData(initialData);
660
+ setCurrentPage(initialCurrentPage ? initialCurrentPage : 1);
661
+ setValues({
662
+ from: params ? params.from : 0,
663
+ to: params ? params.to : 0,
664
+ page: 1
665
+ });
666
+ if (initialData.length > 0) {
667
+ setScrolling(true);
668
+ }
669
+ }
670
+ }, [initialData]);
671
+
643
672
  React.useEffect(function () {
644
673
  if (lgInfeedAd && window && window.innerWidth >= 1200) {
645
674
  setDesktopView(true);
package/dist/cjs/index.js CHANGED
@@ -36,7 +36,7 @@ var DeckContent = require('./DeckContent.js');
36
36
  require('./lodash-fc2922d0.js');
37
37
  require('./ADlgInfeed-f4c4a1bf.js');
38
38
  var get$1 = require('./get-7a75c563.js');
39
- var GridContent = require('./GridContent-db383f73.js');
39
+ var GridContent = require('./GridContent-25762807.js');
40
40
  var AuthorComponent = require('./AuthorComponent-b44bb44e.js');
41
41
  var DeckQueue = require('./DeckQueue.js');
42
42
  require('react-bootstrap/Media');
@@ -2552,6 +2552,11 @@ var CMEDeck = function CMEDeck(_ref) {
2552
2552
  autoScroll ? React__default['default'].createElement(
2553
2553
  React__default['default'].Fragment,
2554
2554
  null,
2555
+ React__default['default'].createElement(
2556
+ 'style',
2557
+ { jsx: true },
2558
+ '\n .infinite-scroll-component {\n overflow: hidden !important;\n }\n '
2559
+ ),
2555
2560
  React__default['default'].createElement(
2556
2561
  index_es.InfiniteScroll,
2557
2562
  {
@@ -17310,11 +17315,12 @@ var Article = function Article(props) {
17310
17315
  contextualAD: _extends$2._extends({}, payload.contextualAD, {
17311
17316
  slotId: (payload.contextualAD.slotId || 'contextual_ad') + '-' + payload._id,
17312
17317
  className: 'ADFluid',
17313
- sizes: lgContextAd ? [[728, 90], ['fluid'], [300, 100]] : [['fluid'], [300, 100]],
17314
- sizeMapping: [{
17315
- viewport: [7680, 4320],
17316
- sizes: lgContextAd ? [[728, 90], ['fluid'], [300, 100]] : [['fluid'], [300, 100]]
17317
- }, { viewport: [1024, 768], sizes: [['fluid'], [300, 100]] }]
17318
+ // Adding new ad size for large contextual ad for desktop screens >= 1200x768
17319
+ sizes: lgContextAd ? [[728, 90], 'fluid', [300, 100]] : ['fluid', [300, 100]],
17320
+ sizeMapping: lgContextAd ? [{
17321
+ viewport: [1200, 768],
17322
+ sizes: [[728, 90], 'fluid', [300, 100]]
17323
+ }, { viewport: [0, 0], sizes: ['fluid', [300, 100]] }] : ['fluid', [300, 100]]
17318
17324
  })
17319
17325
  });
17320
17326
  var _selectedIndex = indexes[1] + 1;
@@ -17328,8 +17334,15 @@ var Article = function Article(props) {
17328
17334
  } else {
17329
17335
  var _parent = document.getElementById('contextual-native-ad-' + payload._id);
17330
17336
  if (adData && adData.event && adData.event.size && _parent) {
17331
- _parent.style.width = adData.event.size[0] + 'px';
17332
- _parent.style.height = adData.event.size[1] + 'px';
17337
+ // Adding fix for fluid contextual ad to avoid from collapsing when size is [0,0]
17338
+ var fluidSizes = [[0, 0]];
17339
+ var checkAdSize = function checkAdSize(size) {
17340
+ return AdSlot._JSON$stringify(size) === AdSlot._JSON$stringify(adData.event.size);
17341
+ };
17342
+ if (!fluidSizes.some(checkAdSize)) {
17343
+ _parent.style.width = adData.event.size[0] + 'px';
17344
+ _parent.style.height = adData.event.size[1] + 'px';
17345
+ }
17333
17346
  _parent.style.margin = 'auto';
17334
17347
  }
17335
17348
  if (body[0]._type === 'figure' || body[1]._type === 'figure' || body[2]._type === 'figure' || body[3]._type === 'figure') {
@@ -17593,7 +17606,7 @@ var Article = function Article(props) {
17593
17606
  React__default['default'].createElement(
17594
17607
  'style',
17595
17608
  { jsx: 'true' },
17596
- '\n .sanityDisplayLabel {\n margin: .5rem 0;\n border: 1px solid black;\n width: fit-content;\n padding: 5px;\n }\n '
17609
+ '\n .sanityDisplayLabel {\n margin: 0.5rem 0;\n border: 1px solid black;\n width: fit-content;\n padding: 5px;\n }\n '
17597
17610
  )
17598
17611
  );
17599
17612
  };
@@ -98,6 +98,16 @@ var GridContent = function (_React$Component) {
98
98
  if (prevState.currentPage !== _this.state.currentPage) {
99
99
  document.addEventListener('scroll', _this.trackScrolling);
100
100
  }
101
+
102
+ // Logging GA Pageview on path change
103
+ var _this$props = _this.props,
104
+ pageview = _this$props.pageview,
105
+ currentPath = _this$props.router.asPath;
106
+ var prevPath = prevProps.router.asPath;
107
+
108
+ if (pageview && currentPath !== prevPath) {
109
+ pageview(currentPath);
110
+ }
101
111
  }, _this.trackScrolling = function () {
102
112
  var itemsPerPage = _this.props.params.itemsPerPage ? _this.props.params.itemsPerPage : 10;
103
113
  if (window.pageYOffset === 0) {
@@ -156,10 +166,10 @@ var GridContent = function (_React$Component) {
156
166
  return _this.defaultImage;
157
167
  }
158
168
  }, _this.changePageNumber = function (pageNumber, itemsPerPage, itemIndex) {
159
- var _this$props = _this.props,
160
- seoPaginate = _this$props.seoPaginate,
161
- pageview = _this$props.pageview,
162
- router = _this$props.router;
169
+ var _this$props2 = _this.props,
170
+ seoPaginate = _this$props2.seoPaginate,
171
+ pageview = _this$props2.pageview,
172
+ router = _this$props2.router;
163
173
  var currentPage = _this.state.currentPage;
164
174
 
165
175
  if (seoPaginate) {
@@ -208,9 +218,9 @@ var GridContent = function (_React$Component) {
208
218
  }
209
219
 
210
220
  var newPath = pageNumber === 1 ? '' + path : path + '?page=' + pageNumber;
211
- if (pageview) {
212
- pageview(newPath);
213
- }
221
+ // if (pageview) {
222
+ // pageview(newPath)
223
+ // }
214
224
 
215
225
  router.push(pathname, newPath, {
216
226
  shallow: true
@@ -31,5 +31,5 @@ import './ADInfeed-dff74bbe.js';
31
31
  import './lodash-17fdfebb.js';
32
32
  import './ADlgInfeed-7b29db85.js';
33
33
  import './get-bc6cf9fb.js';
34
- export { G as default } from './GridContent-6b38c580.js';
34
+ export { G as default } from './GridContent-93e5f16a.js';
35
35
  import './AuthorComponent-4f5f15ed.js';
@@ -6,7 +6,7 @@ import './_iter-detect-7c281f0a.js';
6
6
  import { _ as _toConsumableArray } from './toConsumableArray-c5e2fde8.js';
7
7
  import './_object-pie-33c40e79.js';
8
8
  import { _ as _extends } from './extends-92072fff.js';
9
- import React, { useState, useEffect, useRef } from 'react';
9
+ import React, { useEffect, useState, useRef } from 'react';
10
10
  import { l as lib_3 } from './debounce-42a7f724.js';
11
11
  import 'prop-types';
12
12
  import 'react-bootstrap/Card';
@@ -124,9 +124,9 @@ var changePageNumber = function changePageNumber(pageNumber, seoPaginate, pagevi
124
124
  }
125
125
  var newPath = pageNumber === 1 ? '' + path : '' + path + (queryString.length > 0 ? '&' : '?') + 'page=' + pageNumber;
126
126
 
127
- if (pageview) {
128
- pageview(newPath);
129
- }
127
+ // if (pageview) {
128
+ // pageview(newPath)
129
+ // }
130
130
 
131
131
  router.push(pathname, newPath, {
132
132
  shallow: true
@@ -570,6 +570,18 @@ var usePrevious = function usePrevious(value) {
570
570
 
571
571
  var QueueDeckExpanded = function QueueDeckExpanded(props) {
572
572
  var router = useRouter();
573
+
574
+ // Logging GA Pageview on path change
575
+ var prevPath = usePrevious(lodash.get(router, 'asPath', undefined));
576
+ useEffect(function () {
577
+ var pageview = props.pageview;
578
+
579
+ var currentPath = router.asPath;
580
+ if (prevPath && prevPath !== currentPath && pageview) {
581
+ pageview(router.asPath);
582
+ }
583
+ }, [router]);
584
+
573
585
  var initialData = props.dataRecord,
574
586
  client = props.client,
575
587
  params = props.params,
@@ -634,6 +646,23 @@ var QueueDeckExpanded = function QueueDeckExpanded(props) {
634
646
  var itemsPerPage = params && params.itemsPerPage ? params.itemsPerPage : 10;
635
647
 
636
648
  var prevValues = usePrevious(values);
649
+
650
+ //check for change in filter parameters from client side and refresh the page
651
+ useEffect(function () {
652
+ if (initialData && data !== initialData && initialData.length >= 0) {
653
+ setData(initialData);
654
+ setCurrentPage(initialCurrentPage ? initialCurrentPage : 1);
655
+ setValues({
656
+ from: params ? params.from : 0,
657
+ to: params ? params.to : 0,
658
+ page: 1
659
+ });
660
+ if (initialData.length > 0) {
661
+ setScrolling(true);
662
+ }
663
+ }
664
+ }, [initialData]);
665
+
637
666
  useEffect(function () {
638
667
  if (lgInfeedAd && window && window.innerWidth >= 1200) {
639
668
  setDesktopView(true);
package/dist/esm/index.js CHANGED
@@ -33,7 +33,7 @@ export { default as DeckContent } from './DeckContent.js';
33
33
  import './lodash-17fdfebb.js';
34
34
  import './ADlgInfeed-7b29db85.js';
35
35
  import { i as isFunction_1, a as isArray_1, _ as _arrayMap } from './get-bc6cf9fb.js';
36
- export { A as AD, G as GridContent } from './GridContent-6b38c580.js';
36
+ export { A as AD, G as GridContent } from './GridContent-93e5f16a.js';
37
37
  import { A as AuthorComponent } from './AuthorComponent-4f5f15ed.js';
38
38
  export { default as DeckQueue } from './DeckQueue.js';
39
39
  import 'react-bootstrap/Media';
@@ -2528,6 +2528,11 @@ var CMEDeck = function CMEDeck(_ref) {
2528
2528
  autoScroll ? React.createElement(
2529
2529
  React.Fragment,
2530
2530
  null,
2531
+ React.createElement(
2532
+ 'style',
2533
+ { jsx: true },
2534
+ '\n .infinite-scroll-component {\n overflow: hidden !important;\n }\n '
2535
+ ),
2531
2536
  React.createElement(
2532
2537
  InfiniteScroll,
2533
2538
  {
@@ -17286,11 +17291,12 @@ var Article = function Article(props) {
17286
17291
  contextualAD: _extends$2({}, payload.contextualAD, {
17287
17292
  slotId: (payload.contextualAD.slotId || 'contextual_ad') + '-' + payload._id,
17288
17293
  className: 'ADFluid',
17289
- sizes: lgContextAd ? [[728, 90], ['fluid'], [300, 100]] : [['fluid'], [300, 100]],
17290
- sizeMapping: [{
17291
- viewport: [7680, 4320],
17292
- sizes: lgContextAd ? [[728, 90], ['fluid'], [300, 100]] : [['fluid'], [300, 100]]
17293
- }, { viewport: [1024, 768], sizes: [['fluid'], [300, 100]] }]
17294
+ // Adding new ad size for large contextual ad for desktop screens >= 1200x768
17295
+ sizes: lgContextAd ? [[728, 90], 'fluid', [300, 100]] : ['fluid', [300, 100]],
17296
+ sizeMapping: lgContextAd ? [{
17297
+ viewport: [1200, 768],
17298
+ sizes: [[728, 90], 'fluid', [300, 100]]
17299
+ }, { viewport: [0, 0], sizes: ['fluid', [300, 100]] }] : ['fluid', [300, 100]]
17294
17300
  })
17295
17301
  });
17296
17302
  var _selectedIndex = indexes[1] + 1;
@@ -17304,8 +17310,15 @@ var Article = function Article(props) {
17304
17310
  } else {
17305
17311
  var _parent = document.getElementById('contextual-native-ad-' + payload._id);
17306
17312
  if (adData && adData.event && adData.event.size && _parent) {
17307
- _parent.style.width = adData.event.size[0] + 'px';
17308
- _parent.style.height = adData.event.size[1] + 'px';
17313
+ // Adding fix for fluid contextual ad to avoid from collapsing when size is [0,0]
17314
+ var fluidSizes = [[0, 0]];
17315
+ var checkAdSize = function checkAdSize(size) {
17316
+ return _JSON$stringify(size) === _JSON$stringify(adData.event.size);
17317
+ };
17318
+ if (!fluidSizes.some(checkAdSize)) {
17319
+ _parent.style.width = adData.event.size[0] + 'px';
17320
+ _parent.style.height = adData.event.size[1] + 'px';
17321
+ }
17309
17322
  _parent.style.margin = 'auto';
17310
17323
  }
17311
17324
  if (body[0]._type === 'figure' || body[1]._type === 'figure' || body[2]._type === 'figure' || body[3]._type === 'figure') {
@@ -17569,7 +17582,7 @@ var Article = function Article(props) {
17569
17582
  React.createElement(
17570
17583
  'style',
17571
17584
  { jsx: 'true' },
17572
- '\n .sanityDisplayLabel {\n margin: .5rem 0;\n border: 1px solid black;\n width: fit-content;\n padding: 5px;\n }\n '
17585
+ '\n .sanityDisplayLabel {\n margin: 0.5rem 0;\n border: 1px solid black;\n width: fit-content;\n padding: 5px;\n }\n '
17573
17586
  )
17574
17587
  );
17575
17588
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mjhls/mjh-framework",
3
- "version": "1.0.441",
3
+ "version": "1.0.443",
4
4
  "description": "Foundation Framework",
5
5
  "author": "mjh-framework",
6
6
  "license": "MIT",