prebid.js 6.6.0 → 6.10.0
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/.eslintrc.js +8 -1
- package/allowedModules.js +4 -7
- package/integrationExamples/gpt/amp/creative.html +11 -33
- package/integrationExamples/gpt/{haloRtdProvider_example.html → hadronRtdProvider_example.html} +9 -9
- package/integrationExamples/gpt/idImportLibrary_example.html +2 -2
- package/integrationExamples/gpt/userId_example.html +2 -2
- package/integrationExamples/gpt/weboramaRtdProvider_example.html +154 -115
- package/integrationExamples/gpt/x-domain/creative.html +63 -29
- package/modules/.submodules.json +3 -0
- package/modules/adagioBidAdapter.js +1 -9
- package/modules/adagioBidAdapter.md +1 -1
- package/modules/adbookpspBidAdapter.js +29 -12
- package/modules/adhashBidAdapter.js +4 -4
- package/modules/adkernelBidAdapter.js +2 -2
- package/modules/adlooxAnalyticsAdapter.js +1 -1
- package/modules/adlooxRtdProvider.js +1 -1
- package/modules/adnowBidAdapter.js +1 -1
- package/modules/adnuntiusRtdProvider.js +96 -0
- package/modules/adnuntiusRtdProvider.md +41 -0
- package/modules/adomikAnalyticsAdapter.js +2 -2
- package/modules/adotBidAdapter.js +1 -1
- package/modules/adpod.js +14 -17
- package/modules/adrelevantisBidAdapter.js +2 -2
- package/modules/adtargetBidAdapter.js +1 -1
- package/modules/adtelligentBidAdapter.js +1 -1
- package/modules/advangelistsBidAdapter.js +2 -2
- package/modules/adxpremiumAnalyticsAdapter.js +1 -1
- package/modules/adyoulikeBidAdapter.js +1 -1
- package/modules/afpBidAdapter.js +1 -1
- package/modules/appnexusBidAdapter.js +16 -4
- package/modules/asealBidAdapter.js +58 -0
- package/modules/asealBidAdapter.md +52 -0
- package/modules/beachfrontBidAdapter.js +2 -2
- package/modules/betweenBidAdapter.js +1 -1
- package/modules/bidViewability.js +1 -1
- package/modules/bluebillywigBidAdapter.js +1 -1
- package/modules/brandmetricsRtdProvider.js +168 -0
- package/modules/brandmetricsRtdProvider.md +40 -0
- package/modules/bridgewellBidAdapter.js +1 -1
- package/modules/browsiRtdProvider.js +2 -2
- package/modules/cleanmedianetBidAdapter.js +1 -1
- package/modules/colossussspBidAdapter.js +12 -8
- package/modules/colossussspBidAdapter.md +15 -1
- package/modules/compassBidAdapter.js +1 -1
- package/modules/connectIdSystem.js +1 -1
- package/modules/consentManagement.js +2 -3
- package/modules/consumableBidAdapter.md +1 -1
- package/modules/conversantBidAdapter.js +7 -0
- package/modules/craftBidAdapter.js +2 -2
- package/modules/criteoBidAdapter.js +10 -1
- package/modules/currency.js +27 -5
- package/modules/cwireBidAdapter.js +1 -1
- package/modules/dailyhuntBidAdapter.js +1 -1
- package/modules/dchain.js +1 -1
- package/modules/displayioBidAdapter.js +157 -0
- package/modules/displayioBidAdapter.md +148 -0
- package/modules/dspxBidAdapter.js +69 -29
- package/modules/dspxBidAdapter.md +2 -1
- package/modules/e_volutionBidAdapter.js +158 -0
- package/modules/emx_digitalBidAdapter.js +2 -2
- package/modules/fluctBidAdapter.js +0 -1
- package/modules/gamoshiBidAdapter.js +1 -1
- package/modules/gdprEnforcement.js +2 -2
- package/modules/glomexBidAdapter.js +1 -1
- package/modules/gnetBidAdapter.js +3 -3
- package/modules/gnetBidAdapter.md +4 -4
- package/modules/goldbachBidAdapter.js +2 -2
- package/modules/gptPreAuction.js +1 -1
- package/modules/gridBidAdapter.js +15 -1
- package/modules/gumgumBidAdapter.js +57 -43
- package/modules/hadronIdSystem.js +96 -0
- package/modules/hadronIdSystem.md +35 -0
- package/modules/hadronRtdProvider.js +254 -0
- package/modules/hadronRtdProvider.md +126 -0
- package/modules/haloIdSystem.md +4 -35
- package/modules/haloRtdProvider.md +3 -126
- package/modules/hybridBidAdapter.js +1 -1
- package/modules/improvedigitalBidAdapter.js +6 -1
- package/modules/insticatorBidAdapter.js +1 -1
- package/modules/interactiveOffersBidAdapter.js +9 -6
- package/modules/intersectionRtdProvider.js +1 -1
- package/modules/ixBidAdapter.js +2 -2
- package/modules/jwplayerRtdProvider.js +72 -7
- package/modules/jwplayerRtdProvider.md +27 -11
- package/modules/kargoBidAdapter.js +2 -2
- package/modules/livewrappedBidAdapter.js +1 -1
- package/modules/lunamediahbBidAdapter.js +32 -4
- package/modules/malltvBidAdapter.js +7 -3
- package/modules/malltvBidAdapter.md +64 -51
- package/modules/mass.js +3 -5
- package/modules/mediakeysBidAdapter.js +2 -2
- package/modules/medianetAnalyticsAdapter.js +2 -2
- package/modules/medianetRtdProvider.js +1 -1
- package/modules/mediasquareBidAdapter.js +1 -0
- package/modules/nextMillenniumBidAdapter.js +1 -0
- package/modules/nextrollBidAdapter.js +1 -1
- package/modules/oguryBidAdapter.js +7 -14
- package/modules/onetagBidAdapter.js +1 -1
- package/modules/openwebBidAdapter.js +1 -1
- package/modules/openxAnalyticsAdapter.js +2 -2
- package/modules/openxBidAdapter.js +1 -1
- package/modules/parrableIdSystem.js +1 -1
- package/modules/permutiveRtdProvider.js +1 -1
- package/modules/pilotxBidAdapter.js +147 -0
- package/modules/pilotxBidAdapter.md +50 -0
- package/modules/pixfutureBidAdapter.js +2 -2
- package/modules/prebidServerBidAdapter/index.js +63 -41
- package/modules/priceFloors.js +15 -14
- package/modules/pubmaticBidAdapter.js +1 -1
- package/modules/quantcastBidAdapter.js +1 -1
- package/modules/reconciliationRtdProvider.js +1 -1
- package/modules/richaudienceBidAdapter.js +7 -2
- package/modules/riseBidAdapter.js +17 -6
- package/modules/roxotAnalyticsAdapter.js +1 -1
- package/modules/rtbhouseBidAdapter.js +1 -1
- package/modules/rtdModule/index.js +9 -11
- package/modules/rubiconAnalyticsAdapter.js +8 -2
- package/modules/rubiconBidAdapter.js +1 -1
- package/modules/saambaaBidAdapter.js +420 -420
- package/modules/seedingAllianceBidAdapter.js +3 -3
- package/modules/sharethroughBidAdapter.js +12 -17
- package/modules/sigmoidAnalyticsAdapter.js +1 -1
- package/modules/sirdataRtdProvider.js +1 -1
- package/modules/sizeMappingV2.js +2 -9
- package/modules/smarticoBidAdapter.js +1 -1
- package/modules/sortableAnalyticsAdapter.js +5 -4
- package/modules/sovrnAnalyticsAdapter.js +2 -2
- package/modules/sovrnBidAdapter.js +93 -18
- package/modules/sovrnBidAdapter.md +80 -2
- package/modules/sspBCBidAdapter.js +54 -21
- package/modules/synacormediaBidAdapter.js +32 -11
- package/modules/targetVideoBidAdapter.js +1 -1
- package/modules/telariaBidAdapter.js +22 -29
- package/modules/trustpidSystem.js +197 -0
- package/modules/trustpidSystem.md +45 -0
- package/modules/undertoneBidAdapter.js +17 -1
- package/modules/userId/eids.js +16 -1
- package/modules/userId/eids.md +10 -2
- package/modules/userId/index.js +2 -2
- package/modules/userId/userId.md +17 -2
- package/modules/ventesBidAdapter.js +1 -1
- package/modules/verizonMediaIdSystem.js +1 -1
- package/modules/vibrantmediaBidAdapter.js +220 -0
- package/modules/vibrantmediaBidAdapter.md +92 -0
- package/modules/viewability.js +177 -0
- package/modules/viewability.md +87 -0
- package/modules/viewdeosDXBidAdapter.js +1 -1
- package/modules/voxBidAdapter.js +1 -1
- package/modules/waardexBidAdapter.js +1 -1
- package/modules/weboramaRtdProvider.js +264 -34
- package/modules/weboramaRtdProvider.md +110 -40
- package/modules/widespaceBidAdapter.js +2 -2
- package/modules/winrBidAdapter.js +7 -7
- package/modules/yahoosspBidAdapter.js +3 -1
- package/modules/yieldlabBidAdapter.js +1 -1
- package/modules/yieldmoBidAdapter.js +2 -2
- package/modules/yieldoneBidAdapter.js +6 -0
- package/modules/yuktamediaAnalyticsAdapter.js +1 -1
- package/package.json +3 -1
- package/plugins/poly/arrayFrom.js +3 -0
- package/plugins/poly/find.js +3 -0
- package/plugins/poly/findIndex.js +3 -0
- package/plugins/poly/includes.js +3 -0
- package/plugins/poly/package.json +8 -0
- package/src/Renderer.js +1 -1
- package/src/adRendering.js +38 -0
- package/src/adapterManager.js +33 -28
- package/src/adapters/bidderFactory.js +13 -11
- package/src/adloader.js +3 -2
- package/src/auction.js +140 -117
- package/src/auctionIndex.js +85 -0
- package/src/auctionManager.js +4 -1
- package/src/bidderSettings.js +69 -0
- package/src/bidfactory.js +18 -6
- package/src/config.js +3 -4
- package/src/cpmBucketManager.js +1 -1
- package/src/native.js +30 -22
- package/src/prebid.js +4 -20
- package/src/secureCreatives.js +133 -49
- package/src/sizeMapping.js +1 -1
- package/src/storageManager.js +1 -1
- package/src/targeting.js +13 -4
- package/src/userSync.js +1 -1
- package/src/utils.js +16 -19
- package/src/video.js +11 -12
- package/src/videoCache.js +10 -9
- package/test/fixtures/fixtures.js +2 -1
- package/test/helpers/indexStub.js +28 -0
- package/test/helpers/syncPromise.js +71 -0
- package/test/spec/auctionmanager_spec.js +269 -90
- package/test/spec/config_spec.js +24 -1
- package/test/spec/e2e/longform/basic_w_bidderSettings.spec.js +1 -1
- package/test/spec/e2e/longform/basic_w_custom_adserver_translation.spec.js +1 -1
- package/test/spec/e2e/longform/basic_w_priceGran.spec.js +1 -1
- package/test/spec/e2e/longform/basic_w_requireExactDuration.spec.js +1 -1
- package/test/spec/e2e/longform/basic_wo_brandCategoryExclusion.spec.js +1 -1
- package/test/spec/e2e/longform/basic_wo_requireExactDuration.spec.js +1 -1
- package/test/spec/modules/adagioBidAdapter_spec.js +0 -10
- package/test/spec/modules/adbookpspBidAdapter_spec.js +17 -3
- package/test/spec/modules/adhashBidAdapter_spec.js +2 -2
- package/test/spec/modules/adnuntiusRtdProvider_spec.js +145 -0
- package/test/spec/modules/adpod_spec.js +91 -156
- package/test/spec/modules/afpBidAdapter_spec.js +1 -1
- package/test/spec/modules/appnexusBidAdapter_spec.js +27 -0
- package/test/spec/modules/asealBidAdapter_spec.js +144 -0
- package/test/spec/modules/brandmetricsRtdProvider_spec.js +191 -0
- package/test/spec/modules/colossussspBidAdapter_spec.js +5 -2
- package/test/spec/modules/conversantBidAdapter_spec.js +54 -2
- package/test/spec/modules/criteoBidAdapter_spec.js +21 -0
- package/test/spec/modules/currency_spec.js +36 -15
- package/test/spec/modules/deepintentDpesIdsystem_spec.js +1 -1
- package/test/spec/modules/displayioBidAdapter_spec.js +239 -0
- package/test/spec/modules/dspxBidAdapter_spec.js +20 -15
- package/test/spec/modules/e_volutionBidAdapter_spec.js +242 -0
- package/test/spec/modules/eids_spec.js +2 -2
- package/test/spec/modules/eplanningAnalyticsAdapter_spec.js +1 -1
- package/test/spec/modules/fintezaAnalyticsAdapter_spec.js +1 -1
- package/test/spec/modules/gnetBidAdapter_spec.js +6 -6
- package/test/spec/modules/gridBidAdapter_spec.js +18 -0
- package/test/spec/modules/gumgumBidAdapter_spec.js +49 -3
- package/test/spec/modules/hadronIdSystem_spec.js +57 -0
- package/test/spec/modules/hadronRtdProvider_spec.js +762 -0
- package/test/spec/modules/idxIdSystem_spec.js +1 -1
- package/test/spec/modules/improvedigitalBidAdapter_spec.js +19 -0
- package/test/spec/modules/jwplayerRtdProvider_spec.js +195 -2
- package/test/spec/modules/kargoBidAdapter_spec.js +1 -1
- package/test/spec/modules/lunamediahbBidAdapter_spec.js +27 -1
- package/test/spec/modules/mass_spec.js +2 -14
- package/test/spec/modules/mediakeysBidAdapter_spec.js +1 -1
- package/test/spec/modules/multibid_spec.js +1 -1
- package/test/spec/modules/oguryBidAdapter_spec.js +63 -5
- package/test/spec/modules/onetagBidAdapter_spec.js +1 -1
- package/test/spec/modules/openxAnalyticsAdapter_spec.js +1 -1
- package/test/spec/modules/parrableIdSystem_spec.js +1 -1
- package/test/spec/modules/pilotxBidAdapter_spec.js +244 -0
- package/test/spec/modules/prebidServerBidAdapter_spec.js +43 -6
- package/test/spec/modules/priceFloors_spec.js +37 -24
- package/test/spec/modules/pubmaticBidAdapter_spec.js +40 -0
- package/test/spec/modules/realTimeDataModule_spec.js +51 -2
- package/test/spec/modules/riseBidAdapter_spec.js +30 -4
- package/test/spec/modules/rubiconAnalyticsAdapter_spec.js +61 -1
- package/test/spec/modules/rubiconBidAdapter_spec.js +1 -1
- package/test/spec/modules/sharethroughBidAdapter_spec.js +91 -6
- package/test/spec/modules/sortableAnalyticsAdapter_spec.js +2 -3
- package/test/spec/modules/sovrnBidAdapter_spec.js +413 -333
- package/test/spec/modules/sspBCBidAdapter_spec.js +7 -7
- package/test/spec/modules/stroeerCoreBidAdapter_spec.js +1 -1
- package/test/spec/modules/synacormediaBidAdapter_spec.js +70 -0
- package/test/spec/modules/telariaBidAdapter_spec.js +1 -3
- package/test/spec/modules/trustpidSystem_spec.js +232 -0
- package/test/spec/modules/undertoneBidAdapter_spec.js +55 -2
- package/test/spec/modules/userId_spec.js +40 -40
- package/test/spec/modules/vibrantmediaBidAdapter_spec.js +1237 -0
- package/test/spec/modules/viewability_spec.js +280 -0
- package/test/spec/modules/weboramaRtdProvider_spec.js +536 -20
- package/test/spec/modules/widespaceBidAdapter_spec.js +1 -1
- package/test/spec/modules/yahoosspBidAdapter_spec.js +10 -0
- package/test/spec/modules/yieldoneBidAdapter_spec.js +33 -0
- package/test/spec/modules/zeotapIdPlusIdSystem_spec.js +1 -1
- package/test/spec/native_spec.js +62 -40
- package/test/spec/sizeMapping_spec.js +1 -1
- package/test/spec/unit/core/adapterManager_spec.js +24 -2
- package/test/spec/unit/core/auctionIndex_spec.js +129 -0
- package/test/spec/unit/core/bidderFactory_spec.js +65 -12
- package/test/spec/unit/core/bidderSettings_spec.js +123 -0
- package/test/spec/unit/core/targeting_spec.js +93 -0
- package/test/spec/unit/pbjs_api_spec.js +81 -43
- package/test/spec/unit/secureCreatives_spec.js +143 -24
- package/test/spec/videoCache_spec.js +18 -19
- package/test/spec/video_spec.js +51 -61
- package/webpack.conf.js +1 -1
package/src/bidfactory.js
CHANGED
|
@@ -14,16 +14,18 @@ import { getUniqueIdentifierStr } from './utils.js';
|
|
|
14
14
|
dealId,
|
|
15
15
|
priceKeyString;
|
|
16
16
|
*/
|
|
17
|
-
function Bid(statusCode,
|
|
18
|
-
var _bidSrc =
|
|
17
|
+
function Bid(statusCode, {src = 'client', bidder = '', bidId, transactionId, auctionId} = {}) {
|
|
18
|
+
var _bidSrc = src;
|
|
19
19
|
var _statusCode = statusCode || 0;
|
|
20
20
|
|
|
21
|
-
this.bidderCode =
|
|
21
|
+
this.bidderCode = bidder;
|
|
22
22
|
this.width = 0;
|
|
23
23
|
this.height = 0;
|
|
24
24
|
this.statusMessage = _getStatus();
|
|
25
25
|
this.adId = getUniqueIdentifierStr();
|
|
26
|
-
this.requestId =
|
|
26
|
+
this.requestId = bidId;
|
|
27
|
+
this.transactionId = transactionId;
|
|
28
|
+
this.auctionId = auctionId;
|
|
27
29
|
this.mediaType = 'banner';
|
|
28
30
|
this.source = _bidSrc;
|
|
29
31
|
|
|
@@ -48,9 +50,19 @@ function Bid(statusCode, bidRequest) {
|
|
|
48
50
|
this.getSize = function () {
|
|
49
51
|
return this.width + 'x' + this.height;
|
|
50
52
|
};
|
|
53
|
+
|
|
54
|
+
this.getIdentifiers = function () {
|
|
55
|
+
return {
|
|
56
|
+
src: this.source,
|
|
57
|
+
bidder: this.bidderCode,
|
|
58
|
+
bidId: this.requestId,
|
|
59
|
+
transactionId: this.transactionId,
|
|
60
|
+
auctionId: this.auctionId
|
|
61
|
+
}
|
|
62
|
+
}
|
|
51
63
|
}
|
|
52
64
|
|
|
53
65
|
// Bid factory function.
|
|
54
|
-
export function createBid(statusCode,
|
|
55
|
-
return new Bid(statusCode,
|
|
66
|
+
export function createBid(statusCode, identifiers) {
|
|
67
|
+
return new Bid(statusCode, identifiers);
|
|
56
68
|
}
|
package/src/config.js
CHANGED
|
@@ -13,15 +13,14 @@
|
|
|
13
13
|
*/
|
|
14
14
|
|
|
15
15
|
import { isValidPriceConfig } from './cpmBucketManager.js';
|
|
16
|
-
import find from '
|
|
17
|
-
import includes from '
|
|
18
|
-
import Set from 'core-js-pure/features/set';
|
|
16
|
+
import find from 'prebidjs-polyfill/find.js';
|
|
17
|
+
import includes from 'prebidjs-polyfill/includes.js';
|
|
19
18
|
import {
|
|
20
19
|
mergeDeep, deepClone, getParameterByName, isPlainObject, logMessage, logWarn, logError,
|
|
21
20
|
isArray, isStr, isBoolean, deepAccess, bind
|
|
22
21
|
} from './utils.js';
|
|
23
22
|
|
|
24
|
-
const from = require('
|
|
23
|
+
const from = require('prebidjs-polyfill/arrayFrom.js');
|
|
25
24
|
const CONSTANTS = require('./constants.json');
|
|
26
25
|
|
|
27
26
|
const DEFAULT_DEBUG = getParameterByName(CONSTANTS.DEBUG_MODE).toUpperCase() === 'TRUE';
|
package/src/cpmBucketManager.js
CHANGED
package/src/native.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { deepAccess,
|
|
2
|
-
import includes from '
|
|
1
|
+
import { deepAccess, getKeyByValue, insertHtmlIntoIframe, logError, triggerPixel } from './utils.js';
|
|
2
|
+
import includes from 'prebidjs-polyfill/includes.js';
|
|
3
|
+
import {auctionManager} from './auctionManager.js';
|
|
3
4
|
|
|
4
5
|
const CONSTANTS = require('./constants.json');
|
|
5
6
|
|
|
@@ -35,6 +36,16 @@ export function processNativeAdUnitParams(params) {
|
|
|
35
36
|
return params;
|
|
36
37
|
}
|
|
37
38
|
|
|
39
|
+
export function decorateAdUnitsWithNativeParams(adUnits) {
|
|
40
|
+
adUnits.forEach(adUnit => {
|
|
41
|
+
const nativeParams =
|
|
42
|
+
adUnit.nativeParams || deepAccess(adUnit, 'mediaTypes.native');
|
|
43
|
+
if (nativeParams) {
|
|
44
|
+
adUnit.nativeParams = processNativeAdUnitParams(nativeParams);
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
|
|
38
49
|
/**
|
|
39
50
|
* Check if the native type specified in the adUnit is supported by Prebid.
|
|
40
51
|
*/
|
|
@@ -68,16 +79,13 @@ export const hasNonNativeBidder = adUnit =>
|
|
|
68
79
|
* @param {BidRequest[]} bidRequests All bid requests for an auction
|
|
69
80
|
* @return {Boolean} If object is valid
|
|
70
81
|
*/
|
|
71
|
-
export function nativeBidIsValid(bid,
|
|
72
|
-
const bidRequest = getBidRequest(bid.requestId, bidRequests);
|
|
73
|
-
if (!bidRequest) { return false; }
|
|
74
|
-
|
|
82
|
+
export function nativeBidIsValid(bid, {index = auctionManager.index} = {}) {
|
|
75
83
|
// all native bid responses must define a landing page url
|
|
76
84
|
if (!deepAccess(bid, 'native.clickUrl')) {
|
|
77
85
|
return false;
|
|
78
86
|
}
|
|
79
87
|
|
|
80
|
-
const requestedAssets =
|
|
88
|
+
const requestedAssets = index.getAdUnit(bid).nativeParams;
|
|
81
89
|
if (!requestedAssets) {
|
|
82
90
|
return true;
|
|
83
91
|
}
|
|
@@ -139,21 +147,21 @@ export function fireNativeTrackers(message, adObject) {
|
|
|
139
147
|
* @param {Object} bid
|
|
140
148
|
* @return {Object} targeting
|
|
141
149
|
*/
|
|
142
|
-
export function getNativeTargeting(bid,
|
|
150
|
+
export function getNativeTargeting(bid, {index = auctionManager.index} = {}) {
|
|
143
151
|
let keyValues = {};
|
|
144
|
-
|
|
145
|
-
if (deepAccess(
|
|
146
|
-
bid['native']['rendererUrl'] = getAssetValue(
|
|
147
|
-
} else if (deepAccess(
|
|
148
|
-
bid['native']['adTemplate'] = getAssetValue(
|
|
152
|
+
const adUnit = index.getAdUnit(bid);
|
|
153
|
+
if (deepAccess(adUnit, 'nativeParams.rendererUrl')) {
|
|
154
|
+
bid['native']['rendererUrl'] = getAssetValue(adUnit.nativeParams['rendererUrl']);
|
|
155
|
+
} else if (deepAccess(adUnit, 'nativeParams.adTemplate')) {
|
|
156
|
+
bid['native']['adTemplate'] = getAssetValue(adUnit.nativeParams['adTemplate']);
|
|
149
157
|
}
|
|
150
158
|
|
|
151
159
|
const globalSendTargetingKeys = deepAccess(
|
|
152
|
-
|
|
160
|
+
adUnit,
|
|
153
161
|
`nativeParams.sendTargetingKeys`
|
|
154
162
|
) !== false;
|
|
155
163
|
|
|
156
|
-
const nativeKeys = getNativeKeys(
|
|
164
|
+
const nativeKeys = getNativeKeys(adUnit);
|
|
157
165
|
|
|
158
166
|
const flatBidNativeKeys = { ...bid.native, ...bid.native.ext };
|
|
159
167
|
delete flatBidNativeKeys.ext;
|
|
@@ -166,9 +174,9 @@ export function getNativeTargeting(bid, bidReq) {
|
|
|
166
174
|
return;
|
|
167
175
|
}
|
|
168
176
|
|
|
169
|
-
let sendPlaceholder = deepAccess(
|
|
177
|
+
let sendPlaceholder = deepAccess(adUnit, `nativeParams.${asset}.sendId`);
|
|
170
178
|
if (typeof sendPlaceholder !== 'boolean') {
|
|
171
|
-
sendPlaceholder = deepAccess(
|
|
179
|
+
sendPlaceholder = deepAccess(adUnit, `nativeParams.ext.${asset}.sendId`);
|
|
172
180
|
}
|
|
173
181
|
|
|
174
182
|
if (sendPlaceholder) {
|
|
@@ -176,9 +184,9 @@ export function getNativeTargeting(bid, bidReq) {
|
|
|
176
184
|
value = placeholder;
|
|
177
185
|
}
|
|
178
186
|
|
|
179
|
-
let assetSendTargetingKeys = deepAccess(
|
|
187
|
+
let assetSendTargetingKeys = deepAccess(adUnit, `nativeParams.${asset}.sendTargetingKeys`)
|
|
180
188
|
if (typeof assetSendTargetingKeys !== 'boolean') {
|
|
181
|
-
assetSendTargetingKeys = deepAccess(
|
|
189
|
+
assetSendTargetingKeys = deepAccess(adUnit, `nativeParams.ext.${asset}.sendTargetingKeys`);
|
|
182
190
|
}
|
|
183
191
|
|
|
184
192
|
const sendTargeting = typeof assetSendTargetingKeys === 'boolean' ? assetSendTargetingKeys : globalSendTargetingKeys;
|
|
@@ -259,11 +267,11 @@ function getAssetValue(value) {
|
|
|
259
267
|
return value;
|
|
260
268
|
}
|
|
261
269
|
|
|
262
|
-
function getNativeKeys(
|
|
270
|
+
function getNativeKeys(adUnit) {
|
|
263
271
|
const extraNativeKeys = {}
|
|
264
272
|
|
|
265
|
-
if (deepAccess(
|
|
266
|
-
Object.keys(
|
|
273
|
+
if (deepAccess(adUnit, 'nativeParams.ext')) {
|
|
274
|
+
Object.keys(adUnit.nativeParams.ext).forEach(extKey => {
|
|
267
275
|
extraNativeKeys[extKey] = `hb_native_${extKey}`;
|
|
268
276
|
})
|
|
269
277
|
}
|
package/src/prebid.js
CHANGED
|
@@ -14,11 +14,12 @@ import { auctionManager } from './auctionManager.js';
|
|
|
14
14
|
import { filters, targeting } from './targeting.js';
|
|
15
15
|
import { hook } from './hook.js';
|
|
16
16
|
import { sessionLoader } from './debugging.js';
|
|
17
|
-
import includes from '
|
|
17
|
+
import includes from 'prebidjs-polyfill/includes.js';
|
|
18
18
|
import { adunitCounter } from './adUnits.js';
|
|
19
19
|
import { executeRenderer, isRendererRequired } from './Renderer.js';
|
|
20
20
|
import { createBid } from './bidfactory.js';
|
|
21
21
|
import { storageCallbacks } from './storageManager.js';
|
|
22
|
+
import { emitAdRenderSucceeded, emitAdRenderFail } from './adRendering.js';
|
|
22
23
|
|
|
23
24
|
const $$PREBID_GLOBAL$$ = getGlobal();
|
|
24
25
|
const CONSTANTS = require('./constants.json');
|
|
@@ -27,7 +28,7 @@ const events = require('./events.js');
|
|
|
27
28
|
const { triggerUserSyncs } = userSync;
|
|
28
29
|
|
|
29
30
|
/* private variables */
|
|
30
|
-
const { ADD_AD_UNITS, BID_WON, REQUEST_BIDS, SET_TARGETING,
|
|
31
|
+
const { ADD_AD_UNITS, BID_WON, REQUEST_BIDS, SET_TARGETING, STALE_RENDER } = CONSTANTS.EVENTS;
|
|
31
32
|
const { PREVENT_WRITING_ON_MAIN_DOCUMENT, NO_AD, EXCEPTION, CANNOT_FIND_AD, MISSING_DOC_OR_ADID } = CONSTANTS.AD_RENDER_FAILED_REASON;
|
|
32
33
|
|
|
33
34
|
const eventValidators = {
|
|
@@ -146,7 +147,7 @@ function validateNativeMediaType(adUnit) {
|
|
|
146
147
|
function validateAdUnitPos(adUnit, mediaType) {
|
|
147
148
|
let pos = deepAccess(adUnit, `mediaTypes.${mediaType}.pos`);
|
|
148
149
|
|
|
149
|
-
if (!pos ||
|
|
150
|
+
if (!isNumber(pos) || isNaN(pos) || !isFinite(pos)) {
|
|
150
151
|
let warning = `Value of property 'pos' on ad unit ${adUnit.code} should be of type: Number`;
|
|
151
152
|
|
|
152
153
|
logWarn(warning);
|
|
@@ -385,23 +386,6 @@ $$PREBID_GLOBAL$$.setTargetingForAst = function (adUnitCodes) {
|
|
|
385
386
|
events.emit(SET_TARGETING, targeting.getAllTargeting());
|
|
386
387
|
};
|
|
387
388
|
|
|
388
|
-
function emitAdRenderFail({ reason, message, bid, id }) {
|
|
389
|
-
const data = { reason, message };
|
|
390
|
-
if (bid) data.bid = bid;
|
|
391
|
-
if (id) data.adId = id;
|
|
392
|
-
|
|
393
|
-
logError(message);
|
|
394
|
-
events.emit(AD_RENDER_FAILED, data);
|
|
395
|
-
}
|
|
396
|
-
|
|
397
|
-
function emitAdRenderSucceeded({ doc, bid, id }) {
|
|
398
|
-
const data = { doc };
|
|
399
|
-
if (bid) data.bid = bid;
|
|
400
|
-
if (id) data.adId = id;
|
|
401
|
-
|
|
402
|
-
events.emit(AD_RENDER_SUCCEEDED, data);
|
|
403
|
-
}
|
|
404
|
-
|
|
405
389
|
/**
|
|
406
390
|
* This function will check for presence of given node in given parent. If not present - will inject it.
|
|
407
391
|
* @param {Node} node node, whose existance is in question
|
package/src/secureCreatives.js
CHANGED
|
@@ -4,22 +4,47 @@
|
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
import events from './events.js';
|
|
7
|
-
import {
|
|
7
|
+
import {fireNativeTrackers, getAllAssetsMessage, getAssetMessage} from './native.js';
|
|
8
8
|
import constants from './constants.json';
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import find from '
|
|
12
|
-
import { isRendererRequired
|
|
13
|
-
import includes from '
|
|
14
|
-
import {
|
|
9
|
+
import {deepAccess, isApnGetTagDefined, isGptPubadsDefined, logError, logWarn, replaceAuctionPrice} from './utils.js';
|
|
10
|
+
import {auctionManager} from './auctionManager.js';
|
|
11
|
+
import find from 'prebidjs-polyfill/find.js';
|
|
12
|
+
import {executeRenderer, isRendererRequired} from './Renderer.js';
|
|
13
|
+
import includes from 'prebidjs-polyfill/includes.js';
|
|
14
|
+
import {config} from './config.js';
|
|
15
|
+
import {emitAdRenderFail, emitAdRenderSucceeded} from './adRendering.js';
|
|
15
16
|
|
|
16
17
|
const BID_WON = constants.EVENTS.BID_WON;
|
|
17
18
|
const STALE_RENDER = constants.EVENTS.STALE_RENDER;
|
|
18
19
|
|
|
20
|
+
const HANDLER_MAP = {
|
|
21
|
+
'Prebid Request': handleRenderRequest,
|
|
22
|
+
'Prebid Native': handleNativeRequest,
|
|
23
|
+
'Prebid Event': handleEventRequest,
|
|
24
|
+
}
|
|
25
|
+
|
|
19
26
|
export function listenMessagesFromCreative() {
|
|
20
27
|
window.addEventListener('message', receiveMessage, false);
|
|
21
28
|
}
|
|
22
29
|
|
|
30
|
+
export function getReplier(ev) {
|
|
31
|
+
if (ev.origin == null && ev.ports.length === 0) {
|
|
32
|
+
return function () {
|
|
33
|
+
const msg = 'Cannot post message to a frame with null origin. Please update creatives to use MessageChannel, see https://github.com/prebid/Prebid.js/issues/7870'
|
|
34
|
+
logError(msg)
|
|
35
|
+
throw new Error(msg);
|
|
36
|
+
}
|
|
37
|
+
} else if (ev.ports.length > 0) {
|
|
38
|
+
return function (message) {
|
|
39
|
+
ev.ports[0].postMessage(JSON.stringify(message));
|
|
40
|
+
}
|
|
41
|
+
} else {
|
|
42
|
+
return function (message) {
|
|
43
|
+
ev.source.postMessage(JSON.stringify(message), ev.origin);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
23
48
|
export function receiveMessage(ev) {
|
|
24
49
|
var key = ev.message ? 'message' : 'data';
|
|
25
50
|
var data = {};
|
|
@@ -29,70 +54,128 @@ export function receiveMessage(ev) {
|
|
|
29
54
|
return;
|
|
30
55
|
}
|
|
31
56
|
|
|
32
|
-
if (data && data.adId) {
|
|
57
|
+
if (data && data.adId && data.message) {
|
|
33
58
|
const adObject = find(auctionManager.getBidsReceived(), function (bid) {
|
|
34
59
|
return bid.adId === data.adId;
|
|
35
60
|
});
|
|
61
|
+
if (HANDLER_MAP.hasOwnProperty(data.message)) {
|
|
62
|
+
HANDLER_MAP[data.message](getReplier(ev), data, adObject);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
36
66
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
67
|
+
function handleRenderRequest(reply, data, adObject) {
|
|
68
|
+
if (adObject == null) {
|
|
69
|
+
emitAdRenderFail({
|
|
70
|
+
reason: constants.AD_RENDER_FAILED_REASON.CANNOT_FIND_AD,
|
|
71
|
+
message: `Cannot find ad '${data.adId}' for cross-origin render request`,
|
|
72
|
+
id: data.adId
|
|
73
|
+
});
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
if (adObject.status === constants.BID_STATUS.RENDERED) {
|
|
77
|
+
logWarn(`Ad id ${adObject.adId} has been rendered before`);
|
|
78
|
+
events.emit(STALE_RENDER, adObject);
|
|
79
|
+
if (deepAccess(config.getConfig('auctionOptions'), 'suppressStaleRender')) {
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
try {
|
|
85
|
+
_sendAdToCreative(adObject, reply);
|
|
86
|
+
} catch (e) {
|
|
87
|
+
emitAdRenderFail({
|
|
88
|
+
reason: constants.AD_RENDER_FAILED_REASON.EXCEPTION,
|
|
89
|
+
message: e.message,
|
|
90
|
+
id: data.adId,
|
|
91
|
+
bid: adObject
|
|
92
|
+
});
|
|
93
|
+
return;
|
|
94
|
+
}
|
|
45
95
|
|
|
46
|
-
|
|
96
|
+
// save winning bids
|
|
97
|
+
auctionManager.addWinningBid(adObject);
|
|
47
98
|
|
|
48
|
-
|
|
49
|
-
|
|
99
|
+
events.emit(BID_WON, adObject);
|
|
100
|
+
}
|
|
50
101
|
|
|
102
|
+
function handleNativeRequest(reply, data, adObject) {
|
|
103
|
+
// handle this script from native template in an ad server
|
|
104
|
+
// window.parent.postMessage(JSON.stringify({
|
|
105
|
+
// message: 'Prebid Native',
|
|
106
|
+
// adId: '%%PATTERN:hb_adid%%'
|
|
107
|
+
// }), '*');
|
|
108
|
+
if (adObject == null) {
|
|
109
|
+
logError(`Cannot find ad '${data.adId}' for x-origin event request`);
|
|
110
|
+
return;
|
|
111
|
+
}
|
|
112
|
+
switch (data.action) {
|
|
113
|
+
case 'assetRequest':
|
|
114
|
+
reply(getAssetMessage(data, adObject));
|
|
115
|
+
break;
|
|
116
|
+
case 'allAssetRequest':
|
|
117
|
+
reply(getAllAssetsMessage(data, adObject));
|
|
118
|
+
break;
|
|
119
|
+
case 'resizeNativeHeight':
|
|
120
|
+
adObject.height = data.height;
|
|
121
|
+
adObject.width = data.width;
|
|
122
|
+
resizeRemoteCreative(adObject);
|
|
123
|
+
break;
|
|
124
|
+
default:
|
|
125
|
+
const trackerType = fireNativeTrackers(data, adObject);
|
|
126
|
+
if (trackerType === 'click') {
|
|
127
|
+
return;
|
|
128
|
+
}
|
|
129
|
+
auctionManager.addWinningBid(adObject);
|
|
51
130
|
events.emit(BID_WON, adObject);
|
|
52
|
-
|
|
131
|
+
}
|
|
132
|
+
}
|
|
53
133
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
134
|
+
function handleEventRequest(reply, data, adObject) {
|
|
135
|
+
if (adObject == null) {
|
|
136
|
+
logError(`Cannot find ad '${data.adId}' for x-origin event request`);
|
|
137
|
+
return;
|
|
138
|
+
}
|
|
139
|
+
if (adObject.status !== constants.BID_STATUS.RENDERED) {
|
|
140
|
+
logWarn(`Received x-origin event request without corresponding render request for ad '${data.adId}'`);
|
|
141
|
+
return;
|
|
142
|
+
}
|
|
143
|
+
switch (data.event) {
|
|
144
|
+
case constants.EVENTS.AD_RENDER_FAILED:
|
|
145
|
+
emitAdRenderFail({
|
|
146
|
+
bid: adObject,
|
|
147
|
+
id: data.adId,
|
|
148
|
+
reason: data.info.reason,
|
|
149
|
+
message: data.info.message
|
|
150
|
+
});
|
|
151
|
+
break;
|
|
152
|
+
case constants.EVENTS.AD_RENDER_SUCCEEDED:
|
|
153
|
+
emitAdRenderSucceeded({
|
|
154
|
+
doc: null,
|
|
155
|
+
bid: adObject,
|
|
156
|
+
id: data.adId
|
|
157
|
+
});
|
|
158
|
+
break;
|
|
159
|
+
default:
|
|
160
|
+
logError(`Received x-origin event request for unsupported event: '${data.event}' (adId: '${data.adId}')`)
|
|
78
161
|
}
|
|
79
162
|
}
|
|
80
163
|
|
|
81
|
-
export function _sendAdToCreative(adObject,
|
|
164
|
+
export function _sendAdToCreative(adObject, reply) {
|
|
82
165
|
const { adId, ad, adUrl, width, height, renderer, cpm } = adObject;
|
|
83
166
|
// rendering for outstream safeframe
|
|
84
167
|
if (isRendererRequired(renderer)) {
|
|
85
168
|
executeRenderer(renderer, adObject);
|
|
86
169
|
} else if (adId) {
|
|
87
170
|
resizeRemoteCreative(adObject);
|
|
88
|
-
|
|
171
|
+
reply({
|
|
89
172
|
message: 'Prebid Response',
|
|
90
173
|
ad: replaceAuctionPrice(ad, cpm),
|
|
91
174
|
adUrl: replaceAuctionPrice(adUrl, cpm),
|
|
92
175
|
adId,
|
|
93
176
|
width,
|
|
94
177
|
height
|
|
95
|
-
})
|
|
178
|
+
});
|
|
96
179
|
}
|
|
97
180
|
}
|
|
98
181
|
|
|
@@ -127,11 +210,12 @@ function resizeRemoteCreative({ adId, adUnitCode, width, height }) {
|
|
|
127
210
|
}
|
|
128
211
|
|
|
129
212
|
function getDfpElementId(adId) {
|
|
130
|
-
|
|
213
|
+
const slot = find(window.googletag.pubads().getSlots(), slot => {
|
|
131
214
|
return find(slot.getTargetingKeys(), key => {
|
|
132
215
|
return includes(slot.getTargeting(key), adId);
|
|
133
216
|
});
|
|
134
|
-
})
|
|
217
|
+
});
|
|
218
|
+
return slot ? slot.getSlotElementId() : null;
|
|
135
219
|
}
|
|
136
220
|
|
|
137
221
|
function getAstElementId(adUnitCode) {
|
package/src/sizeMapping.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { config } from './config.js';
|
|
2
2
|
import {logWarn, isPlainObject, deepAccess, deepClone, getWindowTop} from './utils.js';
|
|
3
|
-
import includes from '
|
|
3
|
+
import includes from 'prebidjs-polyfill/includes.js';
|
|
4
4
|
|
|
5
5
|
let sizeConfig = [];
|
|
6
6
|
|
package/src/storageManager.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {hook} from './hook.js';
|
|
2
2
|
import { hasDeviceAccess, checkCookieSupport, logError } from './utils.js';
|
|
3
|
-
import includes from '
|
|
3
|
+
import includes from 'prebidjs-polyfill/includes.js';
|
|
4
4
|
|
|
5
5
|
const moduleTypeWhiteList = ['core', 'prebid-module'];
|
|
6
6
|
|
package/src/targeting.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
uniques, isGptPubadsDefined, getHighestCpm, getOldestHighestCpmBid, groupBy, isAdUnitCodeMatchingSlot, timestamp,
|
|
3
|
-
deepAccess, deepClone, logError, logWarn, logInfo, isFn, isArray, logMessage, isStr,
|
|
3
|
+
deepAccess, deepClone, logError, logWarn, logInfo, isFn, isArray, logMessage, isStr,
|
|
4
4
|
} from './utils.js';
|
|
5
5
|
import { config } from './config.js';
|
|
6
6
|
import { NATIVE_TARGETING_KEYS } from './native.js';
|
|
@@ -8,8 +8,9 @@ import { auctionManager } from './auctionManager.js';
|
|
|
8
8
|
import { sizeSupported } from './sizeMapping.js';
|
|
9
9
|
import { ADPOD } from './mediaTypes.js';
|
|
10
10
|
import { hook } from './hook.js';
|
|
11
|
-
import
|
|
12
|
-
import
|
|
11
|
+
import { bidderSettings } from './bidderSettings.js';
|
|
12
|
+
import includes from 'prebidjs-polyfill/includes.js';
|
|
13
|
+
import find from 'prebidjs-polyfill/find.js';
|
|
13
14
|
|
|
14
15
|
var CONSTANTS = require('./constants.json');
|
|
15
16
|
|
|
@@ -437,7 +438,15 @@ export function newTargeting(auctionManager) {
|
|
|
437
438
|
let bidsReceived = auctionManager.getBidsReceived();
|
|
438
439
|
|
|
439
440
|
if (!config.getConfig('useBidCache')) {
|
|
441
|
+
// don't use bid cache (i.e. filter out bids not in the latest auction)
|
|
440
442
|
bidsReceived = bidsReceived.filter(bid => latestAuctionForAdUnit[bid.adUnitCode] === bid.auctionId)
|
|
443
|
+
} else {
|
|
444
|
+
// if custom bid cache filter function exists, run for each bid from
|
|
445
|
+
// previous auctions. If it returns true, include bid in bid pool
|
|
446
|
+
const filterFunction = config.getConfig('bidCacheFilterFunction');
|
|
447
|
+
if (typeof filterFunction === 'function') {
|
|
448
|
+
bidsReceived = bidsReceived.filter(bid => latestAuctionForAdUnit[bid.adUnitCode] === bid.auctionId || !!filterFunction(bid))
|
|
449
|
+
}
|
|
441
450
|
}
|
|
442
451
|
|
|
443
452
|
bidsReceived = bidsReceived
|
|
@@ -459,7 +468,7 @@ export function newTargeting(auctionManager) {
|
|
|
459
468
|
const adUnitCodes = getAdUnitCodes(adUnitCode);
|
|
460
469
|
return bidsReceived
|
|
461
470
|
.filter(bid => includes(adUnitCodes, bid.adUnitCode))
|
|
462
|
-
.filter(bid => (
|
|
471
|
+
.filter(bid => (bidderSettings.get(bid.bidderCode, 'allowZeroCpmBids') === true) ? bid.cpm >= 0 : bid.cpm > 0)
|
|
463
472
|
.map(bid => bid.adUnitCode)
|
|
464
473
|
.filter(uniques)
|
|
465
474
|
.map(adUnitCode => bidsReceived
|
package/src/userSync.js
CHANGED
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
logWarn, isStr, isSafariBrowser
|
|
4
4
|
} from './utils.js';
|
|
5
5
|
import { config } from './config.js';
|
|
6
|
-
import includes from '
|
|
6
|
+
import includes from 'prebidjs-polyfill/includes.js';
|
|
7
7
|
import { getCoreStorageManager } from './storageManager.js';
|
|
8
8
|
|
|
9
9
|
export const USERSYNC_DEFAULT_CONFIG = {
|
package/src/utils.js
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
/* eslint-disable no-console */
|
|
2
2
|
import { config } from './config.js';
|
|
3
|
-
import { getGlobal } from './prebidGlobal.js';
|
|
4
3
|
import clone from 'just-clone';
|
|
5
|
-
import find from '
|
|
6
|
-
import includes from '
|
|
4
|
+
import find from 'prebidjs-polyfill/find.js';
|
|
5
|
+
import includes from 'prebidjs-polyfill/includes.js';
|
|
7
6
|
|
|
8
7
|
const CONSTANTS = require('./constants.json');
|
|
9
8
|
|
|
@@ -22,7 +21,17 @@ let consoleLogExists = Boolean(consoleExists && window.console.log);
|
|
|
22
21
|
let consoleInfoExists = Boolean(consoleExists && window.console.info);
|
|
23
22
|
let consoleWarnExists = Boolean(consoleExists && window.console.warn);
|
|
24
23
|
let consoleErrorExists = Boolean(consoleExists && window.console.error);
|
|
25
|
-
|
|
24
|
+
|
|
25
|
+
const emitEvent = (function () {
|
|
26
|
+
// lazy load events to avoid circular import
|
|
27
|
+
let ev;
|
|
28
|
+
return function() {
|
|
29
|
+
if (ev == null) {
|
|
30
|
+
ev = require('./events.js');
|
|
31
|
+
}
|
|
32
|
+
return ev.emit.apply(ev, arguments);
|
|
33
|
+
}
|
|
34
|
+
})();
|
|
26
35
|
|
|
27
36
|
// this allows stubbing of utility functions that are used internally by other utility functions
|
|
28
37
|
export const internal = {
|
|
@@ -265,14 +274,14 @@ export function logWarn() {
|
|
|
265
274
|
if (debugTurnedOn() && consoleWarnExists) {
|
|
266
275
|
console.warn.apply(console, decorateLog(arguments, 'WARNING:'));
|
|
267
276
|
}
|
|
268
|
-
|
|
277
|
+
emitEvent(CONSTANTS.EVENTS.AUCTION_DEBUG, {type: 'WARNING', arguments: arguments});
|
|
269
278
|
}
|
|
270
279
|
|
|
271
280
|
export function logError() {
|
|
272
281
|
if (debugTurnedOn() && consoleErrorExists) {
|
|
273
282
|
console.error.apply(console, decorateLog(arguments, 'ERROR:'));
|
|
274
283
|
}
|
|
275
|
-
|
|
284
|
+
emitEvent(CONSTANTS.EVENTS.AUCTION_DEBUG, {type: 'ERROR', arguments: arguments});
|
|
276
285
|
}
|
|
277
286
|
|
|
278
287
|
function decorateLog(args, prefix) {
|
|
@@ -885,12 +894,6 @@ export function isValidMediaTypes(mediaTypes) {
|
|
|
885
894
|
return true;
|
|
886
895
|
}
|
|
887
896
|
|
|
888
|
-
export function getBidderRequest(bidRequests, bidder, adUnitCode) {
|
|
889
|
-
return find(bidRequests, request => {
|
|
890
|
-
return request.bids
|
|
891
|
-
.filter(bid => bid.bidder === bidder && bid.adUnitCode === adUnitCode).length > 0;
|
|
892
|
-
}) || { start: null, auctionId: null };
|
|
893
|
-
}
|
|
894
897
|
/**
|
|
895
898
|
* Returns user configured bidder params from adunit
|
|
896
899
|
* @param {Object} adUnits
|
|
@@ -1270,7 +1273,7 @@ export function mergeDeep(target, ...sources) {
|
|
|
1270
1273
|
mergeDeep(target[key], source[key]);
|
|
1271
1274
|
} else if (isArray(source[key])) {
|
|
1272
1275
|
if (!target[key]) {
|
|
1273
|
-
Object.assign(target, { [key]: source[key] });
|
|
1276
|
+
Object.assign(target, { [key]: [...source[key]] });
|
|
1274
1277
|
} else if (isArray(target[key])) {
|
|
1275
1278
|
source[key].forEach(obj => {
|
|
1276
1279
|
let addItFlag = 1;
|
|
@@ -1333,9 +1336,3 @@ export function cyrb53Hash(str, seed = 0) {
|
|
|
1333
1336
|
h2 = imul(h2 ^ (h2 >>> 16), 2246822507) ^ imul(h1 ^ (h1 >>> 13), 3266489909);
|
|
1334
1337
|
return (4294967296 * (2097151 & h2) + (h1 >>> 0)).toString();
|
|
1335
1338
|
}
|
|
1336
|
-
|
|
1337
|
-
export function isAllowZeroCpmBidsEnabled(bidderCode) {
|
|
1338
|
-
const bidderSettings = getGlobal().bidderSettings;
|
|
1339
|
-
return ((bidderSettings[bidderCode] && bidderSettings[bidderCode].allowZeroCpmBids === true) ||
|
|
1340
|
-
(bidderSettings.standard && bidderSettings.standard.allowZeroCpmBids === true));
|
|
1341
|
-
}
|