@mjhls/mjh-framework 1.0.447 → 1.0.448

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.447
2
+ # mjh-framework v. 1.0.448
3
3
 
4
4
  > Foundation Framework
5
5
 
@@ -12,7 +12,7 @@ require('prop-types');
12
12
  require('./isSymbol-488934a7.js');
13
13
  require('./debounce-32e57002.js');
14
14
  var main = require('./main-d76cde9c.js');
15
- require('./slicedToArray-8063ee51.js');
15
+ var slicedToArray = require('./slicedToArray-8063ee51.js');
16
16
  require('./stringify-7c5aff47.js');
17
17
  require('./asyncToGenerator-db08763c.js');
18
18
  require('./_set-species-4458e975.js');
@@ -41,6 +41,12 @@ var AD728x90 = function AD728x90(_ref) {
41
41
  pos = 'top-mobile';
42
42
  mobileView = true;
43
43
  }
44
+ //If ad rendered, should turn this to true and enable sticky position
45
+
46
+ var _useState = React.useState(false),
47
+ _useState2 = slicedToArray._slicedToArray(_useState, 2),
48
+ stickyAd = _useState2[0],
49
+ setStickyAd = _useState2[1];
44
50
 
45
51
  var adTargeting = {
46
52
  content_placement: targeting.content_placement,
@@ -55,29 +61,34 @@ var AD728x90 = function AD728x90(_ref) {
55
61
 
56
62
  var adRef = React.useRef(null);
57
63
 
64
+ //removed this from event listener and made into its own function
65
+ var applySticky = function applySticky() {
66
+ var navbar = document.querySelector('.navbar');
67
+ var AdOffsetTop = adRef.current.getBoundingClientRect().top;
68
+ if (stickyAd && window.pageYOffset + (AdOffsetTop - navbar.offsetHeight) > AdOffsetTop) {
69
+ if (adRef.current && adRef.current.style) {
70
+ adRef.current.style.position = 'fixed';
71
+ adRef.current.style.top = fixedPos;
72
+ adRef.current.style.left = '0px';
73
+ adRef.current.style.zIndex = '9999';
74
+ adRef.current.style.width = '100%';
75
+ adRef.current.style.marginTop = '2px';
76
+ }
77
+ } else {
78
+ if (adRef.current && adRef.current.style) {
79
+ adRef.current.style.position = 'relative';
80
+ adRef.current.style.top = '';
81
+ }
82
+ }
83
+ };
84
+
85
+ //Need to reapply event listener once 'stickyAd' is toggled, will only make leaderboard ad sticky if ad is rendered
86
+
58
87
  React.useEffect(function () {
59
- if (window && window.innerWidth && window.innerWidth < 768) {
60
- var navbar = document.querySelector('.navbar');
61
- var AdOffsetTop = adRef.current.getBoundingClientRect().top;
62
- window.addEventListener('scroll', function () {
63
- if (window.pageYOffset + (AdOffsetTop - navbar.offsetHeight) > AdOffsetTop) {
64
- if (adRef.current && adRef.current.style) {
65
- adRef.current.style.position = 'fixed';
66
- adRef.current.style.top = fixedPos;
67
- adRef.current.style.left = '0px';
68
- adRef.current.style.zIndex = '9999';
69
- adRef.current.style.width = '100%';
70
- adRef.current.style.marginTop = '2px';
71
- }
72
- } else {
73
- if (adRef.current && adRef.current.style) {
74
- adRef.current.style.position = 'relative';
75
- adRef.current.style.top = '';
76
- }
77
- }
78
- });
88
+ if (stickyAd && window && window.innerWidth && window.innerWidth < 768) {
89
+ window.addEventListener('scroll', applySticky);
79
90
  }
80
- }, []);
91
+ }, [stickyAd]);
81
92
 
82
93
  var browserSizes = [[728, 90], [970, 90], [320, 50], [300, 50]];
83
94
  var mobileSizes = [[320, 50], [300, 50]];
@@ -86,6 +97,7 @@ var AD728x90 = function AD728x90(_ref) {
86
97
  'div',
87
98
  { className: 'leaderboard-ad-wrapper', ref: adRef, style: { backgroundColor: '#fff' } },
88
99
  React__default['default'].createElement(AdSlot, {
100
+ setStickyAd: setStickyAd,
89
101
  slotId: slotId,
90
102
  networkID: networkID,
91
103
  adUnit: adUnit,
@@ -99,7 +111,12 @@ var AD728x90 = function AD728x90(_ref) {
99
111
  viewport: [1, 1],
100
112
  sizes: [[320, 50], [300, 50]]
101
113
  }]
102
- })
114
+ }),
115
+ React__default['default'].createElement(
116
+ 'style',
117
+ { jsx: 'true' },
118
+ '\n .leaderboard-ad-wrapper {\n min-height: 90px;\n }\n @media screen and (max-width: 768px) {\n .leaderboard-ad-wrapper {\n min-height: 50px;\n }\n }\n '
119
+ )
103
120
  );
104
121
  };
105
122
 
@@ -35,7 +35,10 @@ var DFPAdSlot = function DFPAdSlot(_ref) {
35
35
  targeting = _ref$targeting === undefined ? {} : _ref$targeting,
36
36
  _ref$refreshFlag = _ref.refreshFlag,
37
37
  refreshFlag = _ref$refreshFlag === undefined ? true : _ref$refreshFlag,
38
- checkIsAdFound = _ref.checkIsAdFound;
38
+ _ref$checkIsAdFound = _ref.checkIsAdFound,
39
+ checkIsAdFound = _ref$checkIsAdFound === undefined ? function () {} : _ref$checkIsAdFound,
40
+ _ref$setStickyAd = _ref.setStickyAd,
41
+ setStickyAd = _ref$setStickyAd === undefined ? function () {} : _ref$setStickyAd;
39
42
 
40
43
  var _useState = React.useState(false),
41
44
  _useState2 = slicedToArray._slicedToArray(_useState, 2),
@@ -77,6 +80,7 @@ var DFPAdSlot = function DFPAdSlot(_ref) {
77
80
  sizeMapping: sizeMapping,
78
81
  targetingArguments: targeting,
79
82
  onSlotIsViewable: function onSlotIsViewable(e) {
83
+ setStickyAd(true);
80
84
  Beam.report_beam_ad('Impression', main.main_16, eventData.cID, eventData.lID, eventData.campID, eventData.adSize, eventData.slot_id);
81
85
  Segment.adViewed(eventData.domain, eventData.advertiserId, eventData.campID, eventData.cID, eventData.lID, eventData.adSize, eventData.isEmpty, eventData.sourceAgnosticCreativeId, eventData.sourceAgnosticLineItemId);
82
86
  },
@@ -40,7 +40,7 @@ require('./promise-074978a7.js');
40
40
  require('./Beam.js');
41
41
  require('./Segment.js');
42
42
  require('./AdSlot.js');
43
- var ADInfeed = require('./ADInfeed-7609d929.js');
43
+ var ADInfeed = require('./ADInfeed-7b80e936.js');
44
44
 
45
45
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
46
46
 
@@ -40,9 +40,9 @@ require('./promise-074978a7.js');
40
40
  require('./Beam.js');
41
41
  require('./Segment.js');
42
42
  require('./AdSlot.js');
43
- var ADInfeed = require('./ADInfeed-7609d929.js');
43
+ var ADInfeed = require('./ADInfeed-7b80e936.js');
44
44
  var lodash = require('./lodash-fc2922d0.js');
45
- var ADlgInfeed = require('./ADlgInfeed-700551ef.js');
45
+ var ADlgInfeed = require('./ADlgInfeed-23bfb514.js');
46
46
  require('./_arrayMap-3b4a0f75.js');
47
47
  var get = require('./get-5dfcdc33.js');
48
48
  require('./AD.js');
@@ -33,9 +33,9 @@ require('./promise-074978a7.js');
33
33
  require('./Beam.js');
34
34
  require('./Segment.js');
35
35
  require('./AdSlot.js');
36
- require('./ADInfeed-7609d929.js');
36
+ require('./ADInfeed-7b80e936.js');
37
37
  require('./lodash-fc2922d0.js');
38
- require('./ADlgInfeed-700551ef.js');
38
+ require('./ADlgInfeed-23bfb514.js');
39
39
  require('./AuthorComponent-5bb8f868.js');
40
40
  require('react-bootstrap');
41
41
  var QueueDeckExpanded = require('./QueueDeckExpanded.js');
@@ -101,7 +101,7 @@ var NavNative = function NavNative(props) {
101
101
  bg: 'primary',
102
102
  sticky: 'top',
103
103
  ref: navRef,
104
- style: { minHeight: '61px' } },
104
+ style: { minHeight: '65px' } },
105
105
  React__default['default'].createElement(
106
106
  Container__default['default'],
107
107
  { style: { maxHeight: '80vh' }, className: 'mobile-nav' },
@@ -33,9 +33,9 @@ require('./promise-074978a7.js');
33
33
  require('./Beam.js');
34
34
  require('./Segment.js');
35
35
  require('./AdSlot.js');
36
- var ADInfeed = require('./ADInfeed-7609d929.js');
36
+ var ADInfeed = require('./ADInfeed-7b80e936.js');
37
37
  var lodash = require('./lodash-fc2922d0.js');
38
- var ADlgInfeed = require('./ADlgInfeed-700551ef.js');
38
+ var ADlgInfeed = require('./ADlgInfeed-23bfb514.js');
39
39
  var AuthorComponent = require('./AuthorComponent-5bb8f868.js');
40
40
  var reactBootstrap = require('react-bootstrap');
41
41
 
package/dist/cjs/index.js CHANGED
@@ -42,10 +42,10 @@ require('./promise-074978a7.js');
42
42
  var Beam = require('./Beam.js');
43
43
  var Segment = require('./Segment.js');
44
44
  var AdSlot = require('./AdSlot.js');
45
- require('./ADInfeed-7609d929.js');
45
+ require('./ADInfeed-7b80e936.js');
46
46
  var DeckContent = require('./DeckContent.js');
47
47
  require('./lodash-fc2922d0.js');
48
- require('./ADlgInfeed-700551ef.js');
48
+ require('./ADlgInfeed-23bfb514.js');
49
49
  require('./_arrayMap-3b4a0f75.js');
50
50
  require('./get-5dfcdc33.js');
51
51
  var AD = require('./AD.js');
@@ -4,13 +4,13 @@ import './core.get-iterator-method-f5c0d66a.js';
4
4
  import './_library-528f1934.js';
5
5
  import './_iter-detect-6e099a34.js';
6
6
  import './web.dom.iterable-46c95e52.js';
7
- import React, { useRef, useEffect } from 'react';
7
+ import React, { useState, useRef, useEffect } from 'react';
8
8
  import './index-fb49124c.js';
9
9
  import 'prop-types';
10
10
  import './isSymbol-c1b9be80.js';
11
11
  import './debounce-8cd9e09c.js';
12
12
  import { m as main_36 } from './main-8c8784b8.js';
13
- import './slicedToArray-f1e40361.js';
13
+ import { _ as _slicedToArray } from './slicedToArray-f1e40361.js';
14
14
  import './stringify-e30bc114.js';
15
15
  import './asyncToGenerator-204b5a5c.js';
16
16
  import './_set-species-6f64f1c1.js';
@@ -35,6 +35,12 @@ var AD728x90 = function AD728x90(_ref) {
35
35
  pos = 'top-mobile';
36
36
  mobileView = true;
37
37
  }
38
+ //If ad rendered, should turn this to true and enable sticky position
39
+
40
+ var _useState = useState(false),
41
+ _useState2 = _slicedToArray(_useState, 2),
42
+ stickyAd = _useState2[0],
43
+ setStickyAd = _useState2[1];
38
44
 
39
45
  var adTargeting = {
40
46
  content_placement: targeting.content_placement,
@@ -49,29 +55,34 @@ var AD728x90 = function AD728x90(_ref) {
49
55
 
50
56
  var adRef = useRef(null);
51
57
 
58
+ //removed this from event listener and made into its own function
59
+ var applySticky = function applySticky() {
60
+ var navbar = document.querySelector('.navbar');
61
+ var AdOffsetTop = adRef.current.getBoundingClientRect().top;
62
+ if (stickyAd && window.pageYOffset + (AdOffsetTop - navbar.offsetHeight) > AdOffsetTop) {
63
+ if (adRef.current && adRef.current.style) {
64
+ adRef.current.style.position = 'fixed';
65
+ adRef.current.style.top = fixedPos;
66
+ adRef.current.style.left = '0px';
67
+ adRef.current.style.zIndex = '9999';
68
+ adRef.current.style.width = '100%';
69
+ adRef.current.style.marginTop = '2px';
70
+ }
71
+ } else {
72
+ if (adRef.current && adRef.current.style) {
73
+ adRef.current.style.position = 'relative';
74
+ adRef.current.style.top = '';
75
+ }
76
+ }
77
+ };
78
+
79
+ //Need to reapply event listener once 'stickyAd' is toggled, will only make leaderboard ad sticky if ad is rendered
80
+
52
81
  useEffect(function () {
53
- if (window && window.innerWidth && window.innerWidth < 768) {
54
- var navbar = document.querySelector('.navbar');
55
- var AdOffsetTop = adRef.current.getBoundingClientRect().top;
56
- window.addEventListener('scroll', function () {
57
- if (window.pageYOffset + (AdOffsetTop - navbar.offsetHeight) > AdOffsetTop) {
58
- if (adRef.current && adRef.current.style) {
59
- adRef.current.style.position = 'fixed';
60
- adRef.current.style.top = fixedPos;
61
- adRef.current.style.left = '0px';
62
- adRef.current.style.zIndex = '9999';
63
- adRef.current.style.width = '100%';
64
- adRef.current.style.marginTop = '2px';
65
- }
66
- } else {
67
- if (adRef.current && adRef.current.style) {
68
- adRef.current.style.position = 'relative';
69
- adRef.current.style.top = '';
70
- }
71
- }
72
- });
82
+ if (stickyAd && window && window.innerWidth && window.innerWidth < 768) {
83
+ window.addEventListener('scroll', applySticky);
73
84
  }
74
- }, []);
85
+ }, [stickyAd]);
75
86
 
76
87
  var browserSizes = [[728, 90], [970, 90], [320, 50], [300, 50]];
77
88
  var mobileSizes = [[320, 50], [300, 50]];
@@ -80,6 +91,7 @@ var AD728x90 = function AD728x90(_ref) {
80
91
  'div',
81
92
  { className: 'leaderboard-ad-wrapper', ref: adRef, style: { backgroundColor: '#fff' } },
82
93
  React.createElement(DFPAdSlot, {
94
+ setStickyAd: setStickyAd,
83
95
  slotId: slotId,
84
96
  networkID: networkID,
85
97
  adUnit: adUnit,
@@ -93,7 +105,12 @@ var AD728x90 = function AD728x90(_ref) {
93
105
  viewport: [1, 1],
94
106
  sizes: [[320, 50], [300, 50]]
95
107
  }]
96
- })
108
+ }),
109
+ React.createElement(
110
+ 'style',
111
+ { jsx: 'true' },
112
+ '\n .leaderboard-ad-wrapper {\n min-height: 90px;\n }\n @media screen and (max-width: 768px) {\n .leaderboard-ad-wrapper {\n min-height: 50px;\n }\n }\n '
113
+ )
97
114
  );
98
115
  };
99
116
 
@@ -28,7 +28,10 @@ var DFPAdSlot = function DFPAdSlot(_ref) {
28
28
  targeting = _ref$targeting === undefined ? {} : _ref$targeting,
29
29
  _ref$refreshFlag = _ref.refreshFlag,
30
30
  refreshFlag = _ref$refreshFlag === undefined ? true : _ref$refreshFlag,
31
- checkIsAdFound = _ref.checkIsAdFound;
31
+ _ref$checkIsAdFound = _ref.checkIsAdFound,
32
+ checkIsAdFound = _ref$checkIsAdFound === undefined ? function () {} : _ref$checkIsAdFound,
33
+ _ref$setStickyAd = _ref.setStickyAd,
34
+ setStickyAd = _ref$setStickyAd === undefined ? function () {} : _ref$setStickyAd;
32
35
 
33
36
  var _useState = useState(false),
34
37
  _useState2 = _slicedToArray(_useState, 2),
@@ -70,6 +73,7 @@ var DFPAdSlot = function DFPAdSlot(_ref) {
70
73
  sizeMapping: sizeMapping,
71
74
  targetingArguments: targeting,
72
75
  onSlotIsViewable: function onSlotIsViewable(e) {
76
+ setStickyAd(true);
73
77
  Beam.report_beam_ad('Impression', main_16, eventData.cID, eventData.lID, eventData.campID, eventData.adSize, eventData.slot_id);
74
78
  Segment.adViewed(eventData.domain, eventData.advertiserId, eventData.campID, eventData.cID, eventData.lID, eventData.adSize, eventData.isEmpty, eventData.sourceAgnosticCreativeId, eventData.sourceAgnosticLineItemId);
75
79
  },
@@ -38,7 +38,7 @@ import './promise-53143c9a.js';
38
38
  import './Beam.js';
39
39
  import './Segment.js';
40
40
  import './AdSlot.js';
41
- import { A as ADInfeed } from './ADInfeed-1c17dc0e.js';
41
+ import { A as ADInfeed } from './ADInfeed-1d67a779.js';
42
42
 
43
43
  var DeckContent = function (_React$Component) {
44
44
  _inherits(DeckContent, _React$Component);
@@ -38,9 +38,9 @@ import './promise-53143c9a.js';
38
38
  import './Beam.js';
39
39
  import './Segment.js';
40
40
  import './AdSlot.js';
41
- import { A as ADInfeed } from './ADInfeed-1c17dc0e.js';
41
+ import { A as ADInfeed } from './ADInfeed-1d67a779.js';
42
42
  import { l as lodash } from './lodash-17fdfebb.js';
43
- import { A as ADlgInfeed } from './ADlgInfeed-94d7f5dd.js';
43
+ import { A as ADlgInfeed } from './ADlgInfeed-d5161b6e.js';
44
44
  import './_arrayMap-a8dd2b2c.js';
45
45
  import { g as get_1 } from './get-ae817b75.js';
46
46
  import './AD.js';
@@ -31,9 +31,9 @@ import './promise-53143c9a.js';
31
31
  import './Beam.js';
32
32
  import './Segment.js';
33
33
  import './AdSlot.js';
34
- import './ADInfeed-1c17dc0e.js';
34
+ import './ADInfeed-1d67a779.js';
35
35
  import './lodash-17fdfebb.js';
36
- import './ADlgInfeed-94d7f5dd.js';
36
+ import './ADlgInfeed-d5161b6e.js';
37
37
  import './AuthorComponent-f67cb027.js';
38
38
  import 'react-bootstrap';
39
39
  import QueueDeckExpanded from './QueueDeckExpanded.js';
@@ -89,7 +89,7 @@ var NavNative = function NavNative(props) {
89
89
  bg: 'primary',
90
90
  sticky: 'top',
91
91
  ref: navRef,
92
- style: { minHeight: '61px' } },
92
+ style: { minHeight: '65px' } },
93
93
  React.createElement(
94
94
  Container,
95
95
  { style: { maxHeight: '80vh' }, className: 'mobile-nav' },
@@ -31,9 +31,9 @@ import './promise-53143c9a.js';
31
31
  import './Beam.js';
32
32
  import './Segment.js';
33
33
  import './AdSlot.js';
34
- import { A as ADInfeed } from './ADInfeed-1c17dc0e.js';
34
+ import { A as ADInfeed } from './ADInfeed-1d67a779.js';
35
35
  import { l as lodash } from './lodash-17fdfebb.js';
36
- import { A as ADlgInfeed } from './ADlgInfeed-94d7f5dd.js';
36
+ import { A as ADlgInfeed } from './ADlgInfeed-d5161b6e.js';
37
37
  import { A as AuthorComponent } from './AuthorComponent-f67cb027.js';
38
38
  import { Container, Media } from 'react-bootstrap';
39
39
 
package/dist/esm/index.js CHANGED
@@ -38,10 +38,10 @@ import './promise-53143c9a.js';
38
38
  export { default as Beam } from './Beam.js';
39
39
  export { default as Segment } from './Segment.js';
40
40
  export { default as AdSlot } from './AdSlot.js';
41
- import './ADInfeed-1c17dc0e.js';
41
+ import './ADInfeed-1d67a779.js';
42
42
  export { default as DeckContent } from './DeckContent.js';
43
43
  import './lodash-17fdfebb.js';
44
- import './ADlgInfeed-94d7f5dd.js';
44
+ import './ADlgInfeed-d5161b6e.js';
45
45
  import './_arrayMap-a8dd2b2c.js';
46
46
  import './get-ae817b75.js';
47
47
  export { default as AD } from './AD.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mjhls/mjh-framework",
3
- "version": "1.0.447",
3
+ "version": "1.0.448",
4
4
  "description": "Foundation Framework",
5
5
  "author": "mjh-framework",
6
6
  "license": "MIT",