@mjhls/mjh-framework 1.0.873-test → 1.0.874-ad-test
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 +1 -1
- package/dist/cjs/AD300x250.js +41 -7
- package/dist/esm/AD300x250.js +42 -8
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# mjh-framework v. 1.0.
|
|
1
|
+
# mjh-framework v. 1.0.874
|
|
2
2
|
|
|
3
3
|
[](https://www.npmjs.com/package/mjh-framework) [](https://standardjs.com)
|
|
4
4
|
|
package/dist/cjs/AD300x250.js
CHANGED
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
require('./stringify-f7a37a8d.js');
|
|
4
3
|
var slicedToArray = require('./slicedToArray-067dd3bc.js');
|
|
5
4
|
var React = require('react');
|
|
6
5
|
var main = require('./main-025fdc78.js');
|
|
7
6
|
var AdSlot = require('./AdSlot.js');
|
|
8
7
|
require('./_commonjsHelpers-06173234.js');
|
|
9
|
-
require('./core.get-iterator-method-5643aa10.js');
|
|
10
8
|
require('./web.dom.iterable-d98303e0.js');
|
|
9
|
+
require('./core.get-iterator-method-5643aa10.js');
|
|
11
10
|
require('./extends-7c86182f.js');
|
|
12
11
|
require('./_object-pie-083f2dd6.js');
|
|
13
12
|
require('prop-types');
|
|
@@ -17,6 +16,7 @@ require('./debounce-d4a2369b.js');
|
|
|
17
16
|
require('./isSymbol-03abbdf0.js');
|
|
18
17
|
require('./toNumber-5e1fac58.js');
|
|
19
18
|
require('./Beam.js');
|
|
19
|
+
require('./stringify-f7a37a8d.js');
|
|
20
20
|
require('./asyncToGenerator-77821af0.js');
|
|
21
21
|
require('./_library-dd23b178.js');
|
|
22
22
|
require('./_iter-detect-b1df62f0.js');
|
|
@@ -42,11 +42,12 @@ var AD300x250 = function AD300x250(_ref) {
|
|
|
42
42
|
pos = 'rec1-mobile';
|
|
43
43
|
mobileView = true;
|
|
44
44
|
}
|
|
45
|
+
var adContainer = React.useRef(null);
|
|
45
46
|
|
|
46
47
|
var _useState = React.useState(true),
|
|
47
|
-
_useState2 = slicedToArray._slicedToArray(_useState, 2)
|
|
48
|
-
_useState2[0]
|
|
49
|
-
|
|
48
|
+
_useState2 = slicedToArray._slicedToArray(_useState, 2),
|
|
49
|
+
previewAd = _useState2[0],
|
|
50
|
+
setPreviewAd = _useState2[1];
|
|
50
51
|
|
|
51
52
|
React.useEffect(function () {
|
|
52
53
|
var path = window && window.location && window.location.search;
|
|
@@ -71,9 +72,42 @@ var AD300x250 = function AD300x250(_ref) {
|
|
|
71
72
|
var browserSizes = [[300, 600], [300, 250], [300, 100]];
|
|
72
73
|
var mobileSizes = [[300, 250], [300, 100]];
|
|
73
74
|
|
|
75
|
+
// CallBack function to check if ad has got creative or not.
|
|
76
|
+
var checkIsAdFound = function checkIsAdFound(isFound, adData) {
|
|
77
|
+
if (isFound && adData && main.main_43) {
|
|
78
|
+
|
|
79
|
+
if (typeof adData.event.size[1] === "number") {
|
|
80
|
+
adContainer.style.minHeight = adData.event.size[1] + 'px';
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
// if (isFound) {
|
|
84
|
+
// // Dynamically fetching parent from slotID to display or collapse.
|
|
85
|
+
// const parent = document.getElementById(adData.slotId)
|
|
86
|
+
|
|
87
|
+
// const adSizes = [[1, 1]]
|
|
88
|
+
// // Collapsing ad if the as size is [1,1]
|
|
89
|
+
// if (adData && adData.event && adData.event.size) {
|
|
90
|
+
// const checkAdSize = (size) => {
|
|
91
|
+
// return JSON.stringify(size) === JSON.stringify(adData.event.size)
|
|
92
|
+
// }
|
|
93
|
+
|
|
94
|
+
// if (adSizes.some(checkAdSize)) {
|
|
95
|
+
// // passing slotID to collape
|
|
96
|
+
// collapseAd(adData.slotId)
|
|
97
|
+
// parent.style.display = 'none'
|
|
98
|
+
// } else {
|
|
99
|
+
// parent.style.display = 'block'
|
|
100
|
+
// }
|
|
101
|
+
// }
|
|
102
|
+
// } else {
|
|
103
|
+
// // collapsing ad if no creative is found
|
|
104
|
+
// collapseAd(adData.slotId)
|
|
105
|
+
// }
|
|
106
|
+
};
|
|
107
|
+
|
|
74
108
|
return React__default['default'].createElement(
|
|
75
109
|
'div',
|
|
76
|
-
|
|
110
|
+
{ ref: adContainer, style: { minHeight: main.main_43 ? '250px' : 'unset', transition: 'min-height .1s linear .3s' } },
|
|
77
111
|
React__default['default'].createElement(AdSlot, {
|
|
78
112
|
networkID: networkID,
|
|
79
113
|
adUnit: adUnit,
|
|
@@ -82,7 +116,7 @@ var AD300x250 = function AD300x250(_ref) {
|
|
|
82
116
|
className: 'AD300x250',
|
|
83
117
|
sizes: mobileView ? mobileSizes : browserSizes
|
|
84
118
|
/* Passing function to check for ad creative only if it is not in preview. */
|
|
85
|
-
|
|
119
|
+
, checkIsAdFound: previewAd ? null : checkIsAdFound
|
|
86
120
|
// style={{ display: 'none' }}
|
|
87
121
|
}),
|
|
88
122
|
React__default['default'].createElement(
|
package/dist/esm/AD300x250.js
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import './stringify-c21932b3.js';
|
|
2
1
|
import { _ as _slicedToArray } from './slicedToArray-ca2c8b8d.js';
|
|
3
|
-
import React, { useState, useEffect } from 'react';
|
|
2
|
+
import React, { useRef, useState, useEffect } from 'react';
|
|
4
3
|
import { m as main_43 } from './main-b5c5aac1.js';
|
|
5
4
|
import DFPAdSlot from './AdSlot.js';
|
|
6
5
|
import './_commonjsHelpers-0c4b6f40.js';
|
|
7
|
-
import './core.get-iterator-method-e903ff31.js';
|
|
8
6
|
import './web.dom.iterable-fdf034f5.js';
|
|
7
|
+
import './core.get-iterator-method-e903ff31.js';
|
|
9
8
|
import './extends-dc6a71fd.js';
|
|
10
9
|
import './_object-pie-133f504a.js';
|
|
11
10
|
import 'prop-types';
|
|
@@ -15,6 +14,7 @@ import './debounce-533d9748.js';
|
|
|
15
14
|
import './isSymbol-a7e9aafe.js';
|
|
16
15
|
import './toNumber-5aeba6e7.js';
|
|
17
16
|
import './Beam.js';
|
|
17
|
+
import './stringify-c21932b3.js';
|
|
18
18
|
import './asyncToGenerator-b4dfe691.js';
|
|
19
19
|
import './_library-528f1934.js';
|
|
20
20
|
import './_iter-detect-f089461c.js';
|
|
@@ -36,11 +36,12 @@ var AD300x250 = function AD300x250(_ref) {
|
|
|
36
36
|
pos = 'rec1-mobile';
|
|
37
37
|
mobileView = true;
|
|
38
38
|
}
|
|
39
|
+
var adContainer = useRef(null);
|
|
39
40
|
|
|
40
41
|
var _useState = useState(true),
|
|
41
|
-
_useState2 = _slicedToArray(_useState, 2)
|
|
42
|
-
_useState2[0]
|
|
43
|
-
|
|
42
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
43
|
+
previewAd = _useState2[0],
|
|
44
|
+
setPreviewAd = _useState2[1];
|
|
44
45
|
|
|
45
46
|
useEffect(function () {
|
|
46
47
|
var path = window && window.location && window.location.search;
|
|
@@ -65,9 +66,42 @@ var AD300x250 = function AD300x250(_ref) {
|
|
|
65
66
|
var browserSizes = [[300, 600], [300, 250], [300, 100]];
|
|
66
67
|
var mobileSizes = [[300, 250], [300, 100]];
|
|
67
68
|
|
|
69
|
+
// CallBack function to check if ad has got creative or not.
|
|
70
|
+
var checkIsAdFound = function checkIsAdFound(isFound, adData) {
|
|
71
|
+
if (isFound && adData && main_43) {
|
|
72
|
+
|
|
73
|
+
if (typeof adData.event.size[1] === "number") {
|
|
74
|
+
adContainer.style.minHeight = adData.event.size[1] + 'px';
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
// if (isFound) {
|
|
78
|
+
// // Dynamically fetching parent from slotID to display or collapse.
|
|
79
|
+
// const parent = document.getElementById(adData.slotId)
|
|
80
|
+
|
|
81
|
+
// const adSizes = [[1, 1]]
|
|
82
|
+
// // Collapsing ad if the as size is [1,1]
|
|
83
|
+
// if (adData && adData.event && adData.event.size) {
|
|
84
|
+
// const checkAdSize = (size) => {
|
|
85
|
+
// return JSON.stringify(size) === JSON.stringify(adData.event.size)
|
|
86
|
+
// }
|
|
87
|
+
|
|
88
|
+
// if (adSizes.some(checkAdSize)) {
|
|
89
|
+
// // passing slotID to collape
|
|
90
|
+
// collapseAd(adData.slotId)
|
|
91
|
+
// parent.style.display = 'none'
|
|
92
|
+
// } else {
|
|
93
|
+
// parent.style.display = 'block'
|
|
94
|
+
// }
|
|
95
|
+
// }
|
|
96
|
+
// } else {
|
|
97
|
+
// // collapsing ad if no creative is found
|
|
98
|
+
// collapseAd(adData.slotId)
|
|
99
|
+
// }
|
|
100
|
+
};
|
|
101
|
+
|
|
68
102
|
return React.createElement(
|
|
69
103
|
'div',
|
|
70
|
-
|
|
104
|
+
{ ref: adContainer, style: { minHeight: main_43 ? '250px' : 'unset', transition: 'min-height .1s linear .3s' } },
|
|
71
105
|
React.createElement(DFPAdSlot, {
|
|
72
106
|
networkID: networkID,
|
|
73
107
|
adUnit: adUnit,
|
|
@@ -76,7 +110,7 @@ var AD300x250 = function AD300x250(_ref) {
|
|
|
76
110
|
className: 'AD300x250',
|
|
77
111
|
sizes: mobileView ? mobileSizes : browserSizes
|
|
78
112
|
/* Passing function to check for ad creative only if it is not in preview. */
|
|
79
|
-
|
|
113
|
+
, checkIsAdFound: previewAd ? null : checkIsAdFound
|
|
80
114
|
// style={{ display: 'none' }}
|
|
81
115
|
}),
|
|
82
116
|
React.createElement(
|