@times-components/ad 2.20.3 → 2.21.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.
- package/CHANGELOG.md +19 -0
- package/README.md +1 -14
- package/babel.config.js +14 -5
- package/dist/ad-composer-prop-types.js +63 -1
- package/dist/ad-composer.js +27 -1
- package/dist/ad-container.js +48 -1
- package/dist/ad-placeholder-prop-types.js +21 -1
- package/dist/ad-prop-types.js +31 -1
- package/dist/ad.js +177 -1
- package/dist/dom-context-prop-types-base.js +27 -1
- package/dist/dom-context-prop-types.js +21 -1
- package/dist/dom-context.js +116 -1
- package/dist/styles/index.js +13 -1
- package/dist/styles/index.shared.js +53 -1
- package/dist/utils/ad-init.js +473 -1
- package/dist/utils/generate-config.js +85 -1
- package/dist/utils/index.js +39 -1
- package/dist/utils/logger.js +37 -1
- package/dist/utils/prebid-config.js +137 -1
- package/dist/utils/sizes.js +75 -1
- package/dist/utils/webview-event-callback-setup.js +36 -1
- package/package.json +12 -14
- package/rnw.js +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,25 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [2.21.1](https://github.com/newsuk/times-components/compare/@times-components/ad@2.21.0...@times-components/ad@2.21.1) (2022-10-13)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @times-components/ad
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
# [2.21.0](https://github.com/newsuk/times-components/compare/@times-components/ad@2.20.3...@times-components/ad@2.21.0) (2022-08-18)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
### Features
|
|
18
|
+
|
|
19
|
+
* **TDP-1712:** remove react-native foreverrrrr ([#3064](https://github.com/newsuk/times-components/issues/3064)) ([2a20cb5](https://github.com/newsuk/times-components/commit/2a20cb5abc10a4e7ca2d62487967f8fcf4eccb62)), closes [#3037](https://github.com/newsuk/times-components/issues/3037) [#3045](https://github.com/newsuk/times-components/issues/3045) [#3050](https://github.com/newsuk/times-components/issues/3050) [#3056](https://github.com/newsuk/times-components/issues/3056) [#3057](https://github.com/newsuk/times-components/issues/3057) [#3066](https://github.com/newsuk/times-components/issues/3066) [#3065](https://github.com/newsuk/times-components/issues/3065) [#3037](https://github.com/newsuk/times-components/issues/3037) [#3045](https://github.com/newsuk/times-components/issues/3045) [#3045](https://github.com/newsuk/times-components/issues/3045) [#3056](https://github.com/newsuk/times-components/issues/3056) [#3066](https://github.com/newsuk/times-components/issues/3066) [#3069](https://github.com/newsuk/times-components/issues/3069) [#3068](https://github.com/newsuk/times-components/issues/3068) [#3070](https://github.com/newsuk/times-components/issues/3070) [#3072](https://github.com/newsuk/times-components/issues/3072) [#3073](https://github.com/newsuk/times-components/issues/3073) [#3071](https://github.com/newsuk/times-components/issues/3071) [#3074](https://github.com/newsuk/times-components/issues/3074) [#3076](https://github.com/newsuk/times-components/issues/3076) [#3079](https://github.com/newsuk/times-components/issues/3079) [#3078](https://github.com/newsuk/times-components/issues/3078) [#3083](https://github.com/newsuk/times-components/issues/3083) [#3087](https://github.com/newsuk/times-components/issues/3087) [#3091](https://github.com/newsuk/times-components/issues/3091) [#3096](https://github.com/newsuk/times-components/issues/3096) [#3102](https://github.com/newsuk/times-components/issues/3102) [#3105](https://github.com/newsuk/times-components/issues/3105) [#3108](https://github.com/newsuk/times-components/issues/3108) [#3111](https://github.com/newsuk/times-components/issues/3111) [#3112](https://github.com/newsuk/times-components/issues/3112) [#3113](https://github.com/newsuk/times-components/issues/3113) [#3114](https://github.com/newsuk/times-components/issues/3114) [#3120](https://github.com/newsuk/times-components/issues/3120) [#3119](https://github.com/newsuk/times-components/issues/3119) [#3112](https://github.com/newsuk/times-components/issues/3112) [#3126](https://github.com/newsuk/times-components/issues/3126) [#3112](https://github.com/newsuk/times-components/issues/3112) [#3126](https://github.com/newsuk/times-components/issues/3126) [#3127](https://github.com/newsuk/times-components/issues/3127) [#3116](https://github.com/newsuk/times-components/issues/3116) [#3128](https://github.com/newsuk/times-components/issues/3128) [#3132](https://github.com/newsuk/times-components/issues/3132) [#3133](https://github.com/newsuk/times-components/issues/3133)
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
6
25
|
## [2.20.3](https://github.com/newsuk/times-components/compare/@times-components/ad@2.20.2...@times-components/ad@2.20.3) (2022-08-05)
|
|
7
26
|
|
|
8
27
|
**Note:** Version bump only for package @times-components/ad
|
package/README.md
CHANGED
|
@@ -58,25 +58,12 @@ This mechanism helps us to determine if a certain Ad should not be shown on a
|
|
|
58
58
|
particular page (e.g. because it contains terror or hate speech related
|
|
59
59
|
content).
|
|
60
60
|
|
|
61
|
-
###
|
|
61
|
+
### With ADmantx
|
|
62
62
|
|
|
63
63
|
We use ADmantx as a Times brand safety mechanism. We send a uri to ADmantx, which crawls the page and returns an object of key value pairs they associate with that web page. The object has the follow keys: `admants`, `categories`, `feelings`, `entities`.
|
|
64
64
|
|
|
65
65
|
This object is then passed to the DFP code via page targeting, which determines whether to show ads or not.
|
|
66
66
|
|
|
67
|
-
### Mobile
|
|
68
|
-
|
|
69
|
-
For native we do not use ADmantx. Instead, we pass a string of comma-seperated
|
|
70
|
-
keywords that typically come from TPA. These keywords are then passed to DFP
|
|
71
|
-
using page targeting, and DFP determines whether to show the page from this
|
|
72
|
-
"list".
|
|
73
|
-
|
|
74
|
-
Example:
|
|
75
|
-
|
|
76
|
-
```
|
|
77
|
-
googletag.setTargeting("kw", "these,are,my,example,keywords");
|
|
78
|
-
```
|
|
79
|
-
|
|
80
67
|
## Ad slots
|
|
81
68
|
|
|
82
69
|
We have distinct positions on a page where we can display Ads. We refer to them
|
package/babel.config.js
CHANGED
|
@@ -1,10 +1,19 @@
|
|
|
1
1
|
module.exports = api => {
|
|
2
2
|
api.cache(true);
|
|
3
3
|
return {
|
|
4
|
-
plugins: [
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
4
|
+
plugins: ["babel-plugin-styled-components", "transform-class-properties"],
|
|
5
|
+
presets: [
|
|
6
|
+
[
|
|
7
|
+
"@babel/preset-env",
|
|
8
|
+
{
|
|
9
|
+
targets: {
|
|
10
|
+
esmodules: false,
|
|
11
|
+
node: "current"
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
],
|
|
15
|
+
"@babel/preset-react",
|
|
16
|
+
"@babel/preset-typescript"
|
|
17
|
+
]
|
|
9
18
|
};
|
|
10
19
|
};
|
|
@@ -1 +1,63 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.defaultProps = exports.propTypes = void 0;
|
|
7
|
+
|
|
8
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
9
|
+
|
|
10
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
|
+
|
|
12
|
+
const propTypes = {
|
|
13
|
+
adConfig: _propTypes.default.shape({
|
|
14
|
+
adUnit: _propTypes.default.string.isRequired,
|
|
15
|
+
biddersConfig: _propTypes.default.shape({}),
|
|
16
|
+
bidderSlots: _propTypes.default.arrayOf(_propTypes.default.string),
|
|
17
|
+
networkId: _propTypes.default.string.isRequired,
|
|
18
|
+
pageTargeting: _propTypes.default.shape({}),
|
|
19
|
+
slotTargeting: _propTypes.default.shape({})
|
|
20
|
+
}),
|
|
21
|
+
children: _propTypes.default.oneOfType([_propTypes.default.element, _propTypes.default.arrayOf(_propTypes.default.element)]).isRequired
|
|
22
|
+
}; // @TODO: check these are sensible
|
|
23
|
+
|
|
24
|
+
exports.propTypes = propTypes;
|
|
25
|
+
const defaultProps = {
|
|
26
|
+
adConfig: {
|
|
27
|
+
adUnit: "d.thetimes.co.uk",
|
|
28
|
+
biddersConfig: {
|
|
29
|
+
bidders: {
|
|
30
|
+
amazon: {
|
|
31
|
+
accountId: "3360"
|
|
32
|
+
},
|
|
33
|
+
appnexus: {
|
|
34
|
+
placementId: "5823281"
|
|
35
|
+
},
|
|
36
|
+
ix: {
|
|
37
|
+
siteId: "188830"
|
|
38
|
+
},
|
|
39
|
+
rubicon: {
|
|
40
|
+
accountId: "14062",
|
|
41
|
+
siteId: "70608",
|
|
42
|
+
zoneId: "335918"
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
bucketSize: 0.25,
|
|
46
|
+
maxBid: 15,
|
|
47
|
+
minPrice: 0.01,
|
|
48
|
+
timeout: 3000
|
|
49
|
+
},
|
|
50
|
+
bidderSlots: ["header", "inline-ad"],
|
|
51
|
+
bidInitialiser: Promise.resolve(),
|
|
52
|
+
globalSlots: ["ad-pixel", "ad-pixelskin", "ad-pixelteads"],
|
|
53
|
+
networkId: "25436805",
|
|
54
|
+
pageTargeting: {
|
|
55
|
+
label: "This is label",
|
|
56
|
+
title: "This is title"
|
|
57
|
+
},
|
|
58
|
+
slotTargeting: {
|
|
59
|
+
section: "news"
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
exports.defaultProps = defaultProps;
|
package/dist/ad-composer.js
CHANGED
|
@@ -1 +1,27 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
|
|
10
|
+
var _reactBroadcast = require("react-broadcast");
|
|
11
|
+
|
|
12
|
+
var _adComposerPropTypes = require("./ad-composer-prop-types");
|
|
13
|
+
|
|
14
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
15
|
+
|
|
16
|
+
const AdComposer = ({
|
|
17
|
+
adConfig,
|
|
18
|
+
children
|
|
19
|
+
}) => /*#__PURE__*/_react.default.createElement(_reactBroadcast.Broadcast, {
|
|
20
|
+
channel: "adConfig",
|
|
21
|
+
value: adConfig
|
|
22
|
+
}, children);
|
|
23
|
+
|
|
24
|
+
AdComposer.propTypes = _adComposerPropTypes.propTypes;
|
|
25
|
+
AdComposer.defaultProps = _adComposerPropTypes.defaultProps;
|
|
26
|
+
var _default = AdComposer;
|
|
27
|
+
exports.default = _default;
|
package/dist/ad-container.js
CHANGED
|
@@ -1 +1,48 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
|
|
10
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
11
|
+
|
|
12
|
+
var _utils = require("@times-components/utils");
|
|
13
|
+
|
|
14
|
+
var _styles = _interopRequireDefault(require("./styles"));
|
|
15
|
+
|
|
16
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
17
|
+
|
|
18
|
+
const AdContainer = ({
|
|
19
|
+
slotName,
|
|
20
|
+
style
|
|
21
|
+
}) => {
|
|
22
|
+
const adMap = {
|
|
23
|
+
header: "ad-header",
|
|
24
|
+
"inline-ad": "ad-article-inline",
|
|
25
|
+
articleListAd: "inline-ad",
|
|
26
|
+
pixel: "ad-pixel",
|
|
27
|
+
pixelteads: "ad-pixelteads",
|
|
28
|
+
pixelskin: "ad-pixelskin",
|
|
29
|
+
inlineAd1: "ad-article-inline-1",
|
|
30
|
+
inlineAd2: "ad-article-inline-2",
|
|
31
|
+
inlineAd3: "ad-article-inline-3"
|
|
32
|
+
};
|
|
33
|
+
return /*#__PURE__*/_react.default.createElement(_utils.TcView, {
|
|
34
|
+
style: { ..._styles.default.container,
|
|
35
|
+
...style
|
|
36
|
+
}
|
|
37
|
+
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
38
|
+
id: `${adMap[slotName]}`
|
|
39
|
+
}));
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
const propTypes = {
|
|
43
|
+
slotName: _propTypes.default.string.isRequired,
|
|
44
|
+
style: _propTypes.default.oneOfType([_propTypes.default.object]).isRequired
|
|
45
|
+
};
|
|
46
|
+
AdContainer.propTypes = propTypes;
|
|
47
|
+
var _default = AdContainer;
|
|
48
|
+
exports.default = _default;
|
|
@@ -1 +1,21 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.defaultProps = exports.propTypes = void 0;
|
|
7
|
+
|
|
8
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
9
|
+
|
|
10
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
|
+
|
|
12
|
+
const propTypes = {
|
|
13
|
+
height: _propTypes.default.number.isRequired,
|
|
14
|
+
style: _propTypes.default.object,
|
|
15
|
+
width: _propTypes.default.number.isRequired
|
|
16
|
+
};
|
|
17
|
+
exports.propTypes = propTypes;
|
|
18
|
+
const defaultProps = {
|
|
19
|
+
style: null
|
|
20
|
+
};
|
|
21
|
+
exports.defaultProps = defaultProps;
|
package/dist/ad-prop-types.js
CHANGED
|
@@ -1 +1,31 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.defaultProps = exports.propTypes = void 0;
|
|
7
|
+
|
|
8
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
9
|
+
|
|
10
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
|
+
|
|
12
|
+
const {
|
|
13
|
+
style: ViewPropTypesStyle
|
|
14
|
+
} = _propTypes.default.object;
|
|
15
|
+
const propTypes = {
|
|
16
|
+
baseUrl: _propTypes.default.string,
|
|
17
|
+
contextUrl: _propTypes.default.string,
|
|
18
|
+
isLoading: _propTypes.default.bool,
|
|
19
|
+
section: _propTypes.default.string,
|
|
20
|
+
slotName: _propTypes.default.string.isRequired,
|
|
21
|
+
style: ViewPropTypesStyle
|
|
22
|
+
};
|
|
23
|
+
exports.propTypes = propTypes;
|
|
24
|
+
const defaultProps = {
|
|
25
|
+
baseUrl: "https://www.thetimes.co.uk/",
|
|
26
|
+
contextUrl: "",
|
|
27
|
+
isLoading: false,
|
|
28
|
+
section: "",
|
|
29
|
+
style: null
|
|
30
|
+
};
|
|
31
|
+
exports.defaultProps = defaultProps;
|
package/dist/ad.js
CHANGED
|
@@ -1 +1,177 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
Object.defineProperty(exports, "AdContainer", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function () {
|
|
9
|
+
return _adContainer.default;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
Object.defineProperty(exports, "AdComposer", {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: function () {
|
|
15
|
+
return _adComposer.default;
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
exports.default = void 0;
|
|
19
|
+
|
|
20
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
21
|
+
|
|
22
|
+
var _reactBroadcast = require("react-broadcast");
|
|
23
|
+
|
|
24
|
+
var _utils = require("@times-components/utils");
|
|
25
|
+
|
|
26
|
+
var _utils2 = require("./utils");
|
|
27
|
+
|
|
28
|
+
var _adInit = _interopRequireDefault(require("./utils/ad-init"));
|
|
29
|
+
|
|
30
|
+
var _adContainer = _interopRequireDefault(require("./ad-container"));
|
|
31
|
+
|
|
32
|
+
var _domContext = _interopRequireDefault(require("./dom-context"));
|
|
33
|
+
|
|
34
|
+
var _adComposer = _interopRequireDefault(require("./ad-composer"));
|
|
35
|
+
|
|
36
|
+
var _adPropTypes = require("./ad-prop-types");
|
|
37
|
+
|
|
38
|
+
var _styles = _interopRequireDefault(require("./styles"));
|
|
39
|
+
|
|
40
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
41
|
+
|
|
42
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
43
|
+
|
|
44
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
45
|
+
|
|
46
|
+
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
47
|
+
|
|
48
|
+
class Ad extends _react.Component {
|
|
49
|
+
static getDerivedStateFromProps(nextProps) {
|
|
50
|
+
const {
|
|
51
|
+
slotName
|
|
52
|
+
} = nextProps;
|
|
53
|
+
return {
|
|
54
|
+
config: (0, _utils2.getSlotConfig)(slotName, (0, _utils.screenWidth)())
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
constructor(props) {
|
|
59
|
+
super(props);
|
|
60
|
+
|
|
61
|
+
this.setAdReady = () => {
|
|
62
|
+
this.setState({
|
|
63
|
+
isAdReady: true
|
|
64
|
+
});
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
this.setAdError = () => {
|
|
68
|
+
this.setState({
|
|
69
|
+
hasError: true
|
|
70
|
+
});
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
const {
|
|
74
|
+
slotName
|
|
75
|
+
} = props;
|
|
76
|
+
this.prebidConfig = _utils2.prebidConfig;
|
|
77
|
+
this.state = {
|
|
78
|
+
config: (0, _utils2.getSlotConfig)(slotName, (0, _utils.screenWidth)()),
|
|
79
|
+
hasError: false,
|
|
80
|
+
isAdReady: false,
|
|
81
|
+
hasAdBlock: false
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
componentDidMount() {
|
|
86
|
+
this.setState({
|
|
87
|
+
hasAdBlock: window.hasAdBlock
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
renderAd(adConfig) {
|
|
92
|
+
const {
|
|
93
|
+
baseUrl,
|
|
94
|
+
contextUrl,
|
|
95
|
+
isLoading,
|
|
96
|
+
section,
|
|
97
|
+
slotName,
|
|
98
|
+
style
|
|
99
|
+
} = this.props;
|
|
100
|
+
const {
|
|
101
|
+
config,
|
|
102
|
+
hasError,
|
|
103
|
+
isAdReady,
|
|
104
|
+
hasAdBlock
|
|
105
|
+
} = this.state;
|
|
106
|
+
if (hasAdBlock || hasError) return null;
|
|
107
|
+
this.slots = adConfig.bidderSlots.map(slot => (0, _utils2.getPrebidSlotConfig)(slot, section, config.maxSizes.width, adConfig.biddersConfig.bidders));
|
|
108
|
+
this.allSlotConfigs = adConfig.globalSlots.concat(adConfig.bidderSlots).map(slot => (0, _utils2.getSlotConfig)(slot, (0, _utils.screenWidth)()));
|
|
109
|
+
const data = {
|
|
110
|
+
adUnit: adConfig.adUnit,
|
|
111
|
+
allSlotConfigs: this.allSlotConfigs || this.slots,
|
|
112
|
+
bidInitialiser: adConfig.bidInitialiser || false,
|
|
113
|
+
config,
|
|
114
|
+
contextUrl,
|
|
115
|
+
debug: adConfig.debug || false,
|
|
116
|
+
disableAds: adConfig.disabled || false,
|
|
117
|
+
networkId: adConfig.networkId,
|
|
118
|
+
pageTargeting: adConfig.pageTargeting,
|
|
119
|
+
prebidConfig: Object.assign(this.prebidConfig, {
|
|
120
|
+
bidders: adConfig.biddersConfig.bidders,
|
|
121
|
+
bucketSize: adConfig.biddersConfig.bucketSize,
|
|
122
|
+
maxBid: adConfig.biddersConfig.maxBid,
|
|
123
|
+
minPrice: adConfig.biddersConfig.minPrice,
|
|
124
|
+
timeout: adConfig.biddersConfig.timeout
|
|
125
|
+
}),
|
|
126
|
+
section,
|
|
127
|
+
sizingMap: config.mappings,
|
|
128
|
+
slotName,
|
|
129
|
+
slots: this.slots,
|
|
130
|
+
slotTargeting: adConfig.slotTargeting
|
|
131
|
+
};
|
|
132
|
+
const sizeProps = !isAdReady ? {
|
|
133
|
+
height: 0,
|
|
134
|
+
width: 0
|
|
135
|
+
} : {
|
|
136
|
+
height: config.maxSizes.height,
|
|
137
|
+
width: config.maxSizes.width
|
|
138
|
+
};
|
|
139
|
+
|
|
140
|
+
const adView = /*#__PURE__*/_react.default.createElement(_utils.TcView, {
|
|
141
|
+
style: { ..._styles.default.container,
|
|
142
|
+
...style
|
|
143
|
+
}
|
|
144
|
+
}, isLoading ? null : /*#__PURE__*/_react.default.createElement(_domContext.default, _extends({
|
|
145
|
+
baseUrl: baseUrl,
|
|
146
|
+
data: data,
|
|
147
|
+
init: _adInit.default,
|
|
148
|
+
onRenderComplete: this.setAdReady,
|
|
149
|
+
onRenderError: this.setAdError
|
|
150
|
+
}, sizeProps)));
|
|
151
|
+
|
|
152
|
+
return /*#__PURE__*/_react.default.createElement(_utils.ServerClientRender, {
|
|
153
|
+
client: () => adView,
|
|
154
|
+
server: null
|
|
155
|
+
});
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
render() {
|
|
159
|
+
const {
|
|
160
|
+
adConfig: propAdConfig
|
|
161
|
+
} = this.props;
|
|
162
|
+
|
|
163
|
+
if (propAdConfig) {
|
|
164
|
+
return this.renderAd(propAdConfig);
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
return /*#__PURE__*/_react.default.createElement(_reactBroadcast.Subscriber, {
|
|
168
|
+
channel: "adConfig"
|
|
169
|
+
}, adConfig => this.renderAd(adConfig));
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
Ad.propTypes = _adPropTypes.propTypes;
|
|
175
|
+
Ad.defaultProps = _adPropTypes.defaultProps;
|
|
176
|
+
var _default = Ad;
|
|
177
|
+
exports.default = _default;
|
|
@@ -1 +1,27 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.defaultProps = exports.propTypes = void 0;
|
|
7
|
+
|
|
8
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
9
|
+
|
|
10
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
|
+
|
|
12
|
+
const propTypes = {
|
|
13
|
+
data: _propTypes.default.shape({}),
|
|
14
|
+
height: _propTypes.default.number.isRequired,
|
|
15
|
+
init: _propTypes.default.func.isRequired,
|
|
16
|
+
onRenderComplete: _propTypes.default.func,
|
|
17
|
+
onRenderError: _propTypes.default.func,
|
|
18
|
+
width: _propTypes.default.number.isRequired
|
|
19
|
+
};
|
|
20
|
+
exports.propTypes = propTypes;
|
|
21
|
+
const defaultProps = {
|
|
22
|
+
data: {},
|
|
23
|
+
height: 0,
|
|
24
|
+
onRenderComplete: () => {},
|
|
25
|
+
onRenderError: () => {}
|
|
26
|
+
};
|
|
27
|
+
exports.defaultProps = defaultProps;
|
|
@@ -1 +1,21 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.defaultProps = exports.propTypes = void 0;
|
|
7
|
+
|
|
8
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
9
|
+
|
|
10
|
+
var _domContextPropTypesBase = require("./dom-context-prop-types-base");
|
|
11
|
+
|
|
12
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
13
|
+
|
|
14
|
+
const propTypes = { ..._domContextPropTypesBase.propTypes,
|
|
15
|
+
height: _propTypes.default.number
|
|
16
|
+
};
|
|
17
|
+
exports.propTypes = propTypes;
|
|
18
|
+
const defaultProps = { ..._domContextPropTypesBase.defaultProps,
|
|
19
|
+
height: 0
|
|
20
|
+
};
|
|
21
|
+
exports.defaultProps = defaultProps;
|