prebid.js 5.20.0 → 6.3.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/.babelrc.js +1 -10
- package/README.md +4 -2
- package/browsers.json +13 -37
- package/gulpfile.js +1 -8
- package/integrationExamples/gpt/weboramaRtdProvider_example.html +23 -14
- package/karma.conf.maker.js +1 -1
- package/modules/33acrossBidAdapter.js +189 -102
- package/modules/adagioBidAdapter.js +1 -1
- package/modules/addefendBidAdapter.js +1 -0
- package/modules/adheseBidAdapter.js +7 -2
- package/modules/adkernelBidAdapter.js +1 -0
- package/modules/adlivetechBidAdapter.md +61 -0
- package/modules/admanBidAdapter.js +1 -0
- package/modules/admixerBidAdapter.js +3 -2
- package/modules/adnuntiusBidAdapter.js +5 -2
- package/modules/adomikAnalyticsAdapter.js +10 -4
- package/modules/adplusBidAdapter.js +203 -0
- package/modules/adplusBidAdapter.md +39 -0
- package/modules/adxcgBidAdapter.js +311 -359
- package/modules/adxcgBidAdapter.md +22 -21
- package/modules/adyoulikeBidAdapter.js +7 -2
- package/modules/appnexusBidAdapter.js +23 -3
- package/modules/beachfrontBidAdapter.js +14 -17
- package/modules/beopBidAdapter.js +5 -3
- package/modules/codefuelBidAdapter.js +1 -3
- package/modules/codefuelBidAdapter.md +3 -3
- package/modules/colossussspBidAdapter.js +7 -0
- package/modules/craftBidAdapter.js +5 -3
- package/modules/criteoBidAdapter.js +1 -1
- package/modules/cwireBidAdapter.js +3 -0
- package/modules/datablocksBidAdapter.js +3 -3
- package/modules/dchain.js +149 -0
- package/modules/dchain.md +45 -0
- package/modules/deepintentBidAdapter.js +1 -1
- package/modules/dspxBidAdapter.js +1 -1
- package/modules/emx_digitalBidAdapter.js +9 -1
- package/modules/engageyaBidAdapter.js +68 -54
- package/modules/freewheel-sspBidAdapter.js +6 -0
- package/modules/futureads.md +48 -0
- package/modules/glimpseBidAdapter.js +44 -16
- package/modules/goldbachBidAdapter.js +1176 -0
- package/modules/goldbachBidAdapter.md +151 -0
- package/modules/gptPreAuction.js +11 -5
- package/modules/gridBidAdapter.js +1 -1
- package/modules/gumgumBidAdapter.js +7 -3
- package/modules/id5IdSystem.md +6 -6
- package/modules/imRtdProvider.js +31 -0
- package/modules/intersectionRtdProvider.js +114 -0
- package/modules/invibesBidAdapter.js +15 -9
- package/modules/ipromBidAdapter.js +79 -0
- package/modules/ixBidAdapter.js +166 -21
- package/modules/kinessoIdSystem.js +1 -1
- package/modules/limelightDigitalBidAdapter.js +2 -1
- package/modules/lotamePanoramaIdSystem.js +80 -8
- package/modules/luponmediaBidAdapter.js +570 -0
- package/modules/mediasquareBidAdapter.js +1 -9
- package/modules/merkleIdSystem.js +5 -0
- package/modules/missenaBidAdapter.js +89 -0
- package/modules/nativoBidAdapter.js +27 -1
- package/modules/nextMillenniumBidAdapter.js +29 -1
- package/modules/oguryBidAdapter.js +2 -1
- package/modules/openxBidAdapter.js +6 -1
- package/modules/prebidServerBidAdapter/index.js +19 -15
- package/modules/pubmaticBidAdapter.js +5 -3
- package/modules/relaidoBidAdapter.js +86 -65
- package/modules/richaudienceBidAdapter.js +2 -3
- package/modules/rtdModule/index.js +48 -18
- package/modules/rubiconBidAdapter.js +10 -8
- package/modules/saambaaBidAdapter.js +420 -0
- package/modules/saambaaBidAdapter.md +65 -68
- package/modules/seedtagBidAdapter.js +6 -0
- package/modules/sharedIdSystem.js +27 -1
- package/modules/smaatoBidAdapter.js +9 -1
- package/modules/smartxBidAdapter.js +17 -1
- package/modules/sspBCBidAdapter.js +34 -3
- package/modules/tappxBidAdapter.js +3 -1
- package/modules/targetVideoBidAdapter.js +187 -0
- package/modules/targetVideoBidAdapter.md +34 -0
- package/modules/trustxBidAdapter.js +10 -1
- package/modules/undertoneBidAdapter.js +8 -1
- package/modules/userId/index.js +27 -2
- package/modules/ventes.md +71 -0
- package/modules/ventesBidAdapter.js +104 -64
- package/modules/ventesBidAdapter.md +0 -1
- package/modules/vidoomyBidAdapter.js +65 -108
- package/modules/visxBidAdapter.js +20 -3
- package/modules/visxBidAdapter.md +4 -6
- package/modules/weboramaRtdProvider.js +288 -73
- package/modules/weboramaRtdProvider.md +27 -10
- package/modules/yahoosspBidAdapter.js +5 -1
- package/modules/yahoosspBidAdapter.md +1 -1
- package/modules/yieldlabBidAdapter.js +41 -10
- package/modules/yieldlabBidAdapter.md +91 -48
- package/modules/yieldoneBidAdapter.js +115 -11
- package/modules/zetaSspBidAdapter.md +33 -1
- package/modules/zeta_global_sspBidAdapter.js +22 -1
- package/package.json +6 -1
- package/plugins/pbjsGlobals.js +28 -1
- package/src/adapterManager.js +14 -8
- package/src/auction.js +3 -2
- package/src/prebid.js +1 -2
- package/src/targeting.js +24 -3
- package/src/utils.js +41 -7
- package/test/spec/integration/faker/googletag.js +6 -0
- package/test/spec/modules/33acrossBidAdapter_spec.js +300 -78
- package/test/spec/modules/adheseBidAdapter_spec.js +27 -1
- package/test/spec/modules/adnuntiusBidAdapter_spec.js +35 -0
- package/test/spec/modules/adomikAnalyticsAdapter_spec.js +3 -1
- package/test/spec/modules/adplusBidAdapter_spec.js +213 -0
- package/test/spec/modules/adxcgBidAdapter_spec.js +820 -571
- package/test/spec/modules/adyoulikeBidAdapter_spec.js +26 -0
- package/test/spec/modules/appnexusBidAdapter_spec.js +63 -1
- package/test/spec/modules/beachfrontBidAdapter_spec.js +65 -1
- package/test/spec/modules/codefuelBidAdapter_spec.js +1 -1
- package/test/spec/modules/colossussspBidAdapter_spec.js +9 -0
- package/test/spec/modules/cwireBidAdapter_spec.js +10 -8
- package/test/spec/modules/datablocksBidAdapter_spec.js +3 -3
- package/test/spec/modules/dchain_spec.js +329 -0
- package/test/spec/modules/emx_digitalBidAdapter_spec.js +10 -0
- package/test/spec/modules/engageyaBidAdapter_spec.js +231 -95
- package/test/spec/modules/eplanningBidAdapter_spec.js +8 -8
- package/test/spec/modules/freewheel-sspBidAdapter_spec.js +19 -0
- package/test/spec/modules/glimpseBidAdapter_spec.js +33 -0
- package/test/spec/modules/goldbachBidAdapter_spec.js +1359 -0
- package/test/spec/modules/gptPreAuction_spec.js +58 -4
- package/test/spec/modules/gumgumBidAdapter_spec.js +6 -0
- package/test/spec/modules/imRtdProvider_spec.js +25 -0
- package/test/spec/modules/intersectionRtdProvider_spec.js +141 -0
- package/test/spec/modules/invibesBidAdapter_spec.js +29 -4
- package/test/spec/modules/ipromBidAdapter_spec.js +195 -0
- package/test/spec/modules/ixBidAdapter_spec.js +285 -2
- package/test/spec/modules/konduitWrapper_spec.js +0 -1
- package/test/spec/modules/limelightDigitalBidAdapter_spec.js +10 -7
- package/test/spec/modules/lotamePanoramaIdSystem_spec.js +227 -0
- package/test/spec/modules/luponmediaBidAdapter_spec.js +412 -0
- package/test/spec/modules/mediasquareBidAdapter_spec.js +4 -4
- package/test/spec/modules/merkleIdSystem_spec.js +18 -0
- package/test/spec/modules/missenaBidAdapter_spec.js +134 -0
- package/test/spec/modules/nativoBidAdapter_spec.js +35 -18
- package/test/spec/modules/nextMillenniumBidAdapter_spec.js +18 -0
- package/test/spec/modules/oguryBidAdapter_spec.js +13 -11
- package/test/spec/modules/openxBidAdapter_spec.js +5 -0
- package/test/spec/modules/prebidServerBidAdapter_spec.js +62 -2
- package/test/spec/modules/pubmaticBidAdapter_spec.js +1 -1
- package/test/spec/modules/realTimeDataModule_spec.js +135 -49
- package/test/spec/modules/relaidoBidAdapter_spec.js +71 -63
- package/test/spec/modules/richaudienceBidAdapter_spec.js +2 -2
- package/test/spec/modules/rubiconBidAdapter_spec.js +17 -0
- package/test/spec/modules/seedtagBidAdapter_spec.js +3 -0
- package/test/spec/modules/sharedIdSystem_spec.js +52 -6
- package/test/spec/modules/smaatoBidAdapter_spec.js +61 -0
- package/test/spec/modules/smartxBidAdapter_spec.js +9 -0
- package/test/spec/modules/sspBCBidAdapter_spec.js +33 -3
- package/test/spec/modules/tappxBidAdapter_spec.js +4 -0
- package/test/spec/modules/targetVideoBidAdapter_spec.js +96 -0
- package/test/spec/modules/trustxBidAdapter_spec.js +42 -0
- package/test/spec/modules/userId_spec.js +51 -0
- package/test/spec/modules/vidoomyBidAdapter_spec.js +32 -13
- package/test/spec/modules/visxBidAdapter_spec.js +121 -5
- package/test/spec/modules/weboramaRtdProvider_spec.js +408 -214
- package/test/spec/modules/yahoosspBidAdapter_spec.js +28 -1
- package/test/spec/modules/yieldlabBidAdapter_spec.js +81 -0
- package/test/spec/modules/yieldoneBidAdapter_spec.js +299 -53
- package/test/spec/modules/zeta_global_sspBidAdapter_spec.js +33 -1
- package/test/spec/unit/core/adapterManager_spec.js +24 -6
- package/test/spec/unit/core/targeting_spec.js +116 -0
- package/test/spec/utils_spec.js +38 -0
- package/wdio.conf.js +1 -1
package/src/utils.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
/* eslint-disable no-console */
|
|
2
2
|
import { config } from './config.js';
|
|
3
|
+
import { getGlobal } from './prebidGlobal.js';
|
|
3
4
|
import clone from 'just-clone';
|
|
4
5
|
import find from 'core-js-pure/features/array/find.js';
|
|
5
6
|
import includes from 'core-js-pure/features/array/includes.js';
|
|
@@ -481,16 +482,43 @@ export function insertElement(elm, doc, target, asLastChildChild) {
|
|
|
481
482
|
} catch (e) {}
|
|
482
483
|
}
|
|
483
484
|
|
|
485
|
+
/**
|
|
486
|
+
* Returns a promise that completes when the given element triggers a 'load' or 'error' DOM event, or when
|
|
487
|
+
* `timeout` milliseconds have elapsed.
|
|
488
|
+
*
|
|
489
|
+
* @param {HTMLElement} element
|
|
490
|
+
* @param {Number} [timeout]
|
|
491
|
+
* @returns {Promise}
|
|
492
|
+
*/
|
|
493
|
+
export function waitForElementToLoad(element, timeout) {
|
|
494
|
+
let timer = null;
|
|
495
|
+
return new Promise((resolve) => {
|
|
496
|
+
const onLoad = function() {
|
|
497
|
+
element.removeEventListener('load', onLoad);
|
|
498
|
+
element.removeEventListener('error', onLoad);
|
|
499
|
+
if (timer != null) {
|
|
500
|
+
window.clearTimeout(timer);
|
|
501
|
+
}
|
|
502
|
+
resolve();
|
|
503
|
+
};
|
|
504
|
+
element.addEventListener('load', onLoad);
|
|
505
|
+
element.addEventListener('error', onLoad);
|
|
506
|
+
if (timeout != null) {
|
|
507
|
+
timer = window.setTimeout(onLoad, timeout);
|
|
508
|
+
}
|
|
509
|
+
});
|
|
510
|
+
}
|
|
511
|
+
|
|
484
512
|
/**
|
|
485
513
|
* Inserts an image pixel with the specified `url` for cookie sync
|
|
486
514
|
* @param {string} url URL string of the image pixel to load
|
|
487
515
|
* @param {function} [done] an optional exit callback, used when this usersync pixel is added during an async process
|
|
516
|
+
* @param {Number} [timeout] an optional timeout in milliseconds for the image to load before calling `done`
|
|
488
517
|
*/
|
|
489
|
-
export function triggerPixel(url, done) {
|
|
518
|
+
export function triggerPixel(url, done, timeout) {
|
|
490
519
|
const img = new Image();
|
|
491
520
|
if (done && internal.isFn(done)) {
|
|
492
|
-
img.
|
|
493
|
-
img.addEventListener('error', done);
|
|
521
|
+
waitForElementToLoad(img, timeout).then(done);
|
|
494
522
|
}
|
|
495
523
|
img.src = url;
|
|
496
524
|
}
|
|
@@ -538,18 +566,18 @@ export function insertHtmlIntoIframe(htmlCode) {
|
|
|
538
566
|
* @param {string} url URL to be requested
|
|
539
567
|
* @param {string} encodeUri boolean if URL should be encoded before inserted. Defaults to true
|
|
540
568
|
* @param {function} [done] an optional exit callback, used when this usersync pixel is added during an async process
|
|
569
|
+
* @param {Number} [timeout] an optional timeout in milliseconds for the iframe to load before calling `done`
|
|
541
570
|
*/
|
|
542
|
-
export function insertUserSyncIframe(url, done) {
|
|
571
|
+
export function insertUserSyncIframe(url, done, timeout) {
|
|
543
572
|
let iframeHtml = internal.createTrackPixelIframeHtml(url, false, 'allow-scripts allow-same-origin');
|
|
544
573
|
let div = document.createElement('div');
|
|
545
574
|
div.innerHTML = iframeHtml;
|
|
546
575
|
let iframe = div.firstChild;
|
|
547
576
|
if (done && internal.isFn(done)) {
|
|
548
|
-
iframe.
|
|
549
|
-
iframe.addEventListener('error', done);
|
|
577
|
+
waitForElementToLoad(iframe, timeout).then(done);
|
|
550
578
|
}
|
|
551
579
|
internal.insertElement(iframe, document, 'html', true);
|
|
552
|
-
}
|
|
580
|
+
}
|
|
553
581
|
|
|
554
582
|
/**
|
|
555
583
|
* Creates a snippet of HTML that retrieves the specified `url`
|
|
@@ -1294,3 +1322,9 @@ export function cyrb53Hash(str, seed = 0) {
|
|
|
1294
1322
|
h2 = imul(h2 ^ (h2 >>> 16), 2246822507) ^ imul(h1 ^ (h1 >>> 13), 3266489909);
|
|
1295
1323
|
return (4294967296 * (2097151 & h2) + (h1 >>> 0)).toString();
|
|
1296
1324
|
}
|
|
1325
|
+
|
|
1326
|
+
export function isAllowZeroCpmBidsEnabled(bidderCode) {
|
|
1327
|
+
const bidderSettings = getGlobal().bidderSettings;
|
|
1328
|
+
return ((bidderSettings[bidderCode] && bidderSettings[bidderCode].allowZeroCpmBids === true) ||
|
|
1329
|
+
(bidderSettings.standard && bidderSettings.standard.allowZeroCpmBids === true));
|
|
1330
|
+
}
|
|
@@ -51,9 +51,15 @@ export function enable() {
|
|
|
51
51
|
window.googletag = {
|
|
52
52
|
_slots: [],
|
|
53
53
|
_callbackMap: {},
|
|
54
|
+
_ppid: undefined,
|
|
55
|
+
cmd: [],
|
|
54
56
|
pubads: function () {
|
|
55
57
|
var self = this;
|
|
56
58
|
return {
|
|
59
|
+
setPublisherProvidedId: function (ppid) {
|
|
60
|
+
self._ppid = ppid;
|
|
61
|
+
},
|
|
62
|
+
|
|
57
63
|
getSlots: function () {
|
|
58
64
|
return self._slots;
|
|
59
65
|
},
|
|
@@ -16,20 +16,21 @@ function validateBuiltServerRequest(builtReq, expectedReq) {
|
|
|
16
16
|
describe('33acrossBidAdapter:', function () {
|
|
17
17
|
const BIDDER_CODE = '33across';
|
|
18
18
|
const SITE_ID = 'sample33xGUID123456789';
|
|
19
|
-
const PRODUCT_ID = 'siab';
|
|
20
19
|
const END_POINT = 'https://ssc.33across.com/api/v1/hb';
|
|
21
20
|
|
|
22
21
|
let element, win;
|
|
23
22
|
let bidRequests;
|
|
24
23
|
let sandbox;
|
|
25
24
|
|
|
26
|
-
function TtxRequestBuilder() {
|
|
25
|
+
function TtxRequestBuilder(siteId = SITE_ID) {
|
|
27
26
|
const ttxRequest = {
|
|
28
|
-
imp: [{
|
|
27
|
+
imp: [{
|
|
28
|
+
id: 'b1'
|
|
29
|
+
}],
|
|
29
30
|
site: {
|
|
30
|
-
id:
|
|
31
|
+
id: siteId
|
|
31
32
|
},
|
|
32
|
-
id: '
|
|
33
|
+
id: 'r1',
|
|
33
34
|
regs: {
|
|
34
35
|
ext: {
|
|
35
36
|
gdpr: 0
|
|
@@ -46,66 +47,83 @@ describe('33acrossBidAdapter:', function () {
|
|
|
46
47
|
}
|
|
47
48
|
};
|
|
48
49
|
|
|
50
|
+
this.addImp = (id = 'b2') => {
|
|
51
|
+
ttxRequest.imp.push({ id });
|
|
52
|
+
|
|
53
|
+
return this;
|
|
54
|
+
}
|
|
55
|
+
|
|
49
56
|
this.withBanner = () => {
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
57
|
+
ttxRequest.imp.forEach((imp) => {
|
|
58
|
+
Object.assign(imp, {
|
|
59
|
+
banner: {
|
|
60
|
+
format: [
|
|
61
|
+
{
|
|
62
|
+
w: 300,
|
|
63
|
+
h: 250
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
w: 728,
|
|
67
|
+
h: 90
|
|
68
|
+
}
|
|
69
|
+
],
|
|
70
|
+
ext: {
|
|
71
|
+
ttx: {
|
|
72
|
+
viewability: {
|
|
73
|
+
amount: 100
|
|
74
|
+
}
|
|
66
75
|
}
|
|
67
76
|
}
|
|
68
77
|
}
|
|
69
|
-
}
|
|
78
|
+
});
|
|
70
79
|
});
|
|
71
|
-
|
|
72
80
|
return this;
|
|
73
81
|
};
|
|
74
82
|
|
|
75
83
|
this.withBannerSizes = this.withSizes = sizes => {
|
|
76
|
-
|
|
84
|
+
ttxRequest.imp.forEach((imp) => {
|
|
85
|
+
Object.assign(imp.banner, { format: sizes });
|
|
86
|
+
});
|
|
87
|
+
|
|
77
88
|
return this;
|
|
78
89
|
};
|
|
79
90
|
|
|
80
91
|
this.withVideo = (params = {}) => {
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
92
|
+
ttxRequest.imp.forEach((imp) => {
|
|
93
|
+
Object.assign(imp, {
|
|
94
|
+
video: {
|
|
95
|
+
w: 300,
|
|
96
|
+
h: 250,
|
|
97
|
+
placement: 2,
|
|
98
|
+
...params
|
|
99
|
+
}
|
|
100
|
+
});
|
|
88
101
|
});
|
|
89
102
|
|
|
90
103
|
return this;
|
|
91
104
|
};
|
|
92
105
|
|
|
93
106
|
this.withViewability = (viewability, format = 'banner') => {
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
107
|
+
ttxRequest.imp.forEach((imp) => {
|
|
108
|
+
Object.assign(imp[format], {
|
|
109
|
+
ext: {
|
|
110
|
+
ttx: { viewability }
|
|
111
|
+
}
|
|
112
|
+
});
|
|
98
113
|
});
|
|
114
|
+
|
|
99
115
|
return this;
|
|
100
116
|
};
|
|
101
117
|
|
|
102
|
-
this.withProduct = (prod =
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
118
|
+
this.withProduct = (prod = 'siab') => {
|
|
119
|
+
ttxRequest.imp.forEach((imp) => {
|
|
120
|
+
Object.assign(imp, {
|
|
121
|
+
ext: {
|
|
122
|
+
ttx: {
|
|
123
|
+
prod
|
|
124
|
+
}
|
|
107
125
|
}
|
|
108
|
-
}
|
|
126
|
+
});
|
|
109
127
|
});
|
|
110
128
|
|
|
111
129
|
return this;
|
|
@@ -249,7 +267,7 @@ describe('33acrossBidAdapter:', function () {
|
|
|
249
267
|
bidderRequestId: 'b1a',
|
|
250
268
|
params: {
|
|
251
269
|
siteId: SITE_ID,
|
|
252
|
-
productId:
|
|
270
|
+
productId: 'siab'
|
|
253
271
|
},
|
|
254
272
|
adUnitCode: 'div-id',
|
|
255
273
|
auctionId: 'r1',
|
|
@@ -258,35 +276,61 @@ describe('33acrossBidAdapter:', function () {
|
|
|
258
276
|
}
|
|
259
277
|
];
|
|
260
278
|
|
|
279
|
+
this.addBid = (bidParams = {}) => {
|
|
280
|
+
bidRequests.push({
|
|
281
|
+
bidId: 'b2',
|
|
282
|
+
bidder: '33across',
|
|
283
|
+
bidderRequestId: 'b1b',
|
|
284
|
+
params: {
|
|
285
|
+
siteId: SITE_ID,
|
|
286
|
+
productId: 'siab'
|
|
287
|
+
},
|
|
288
|
+
adUnitCode: 'div-id',
|
|
289
|
+
auctionId: 'r1',
|
|
290
|
+
mediaTypes: {},
|
|
291
|
+
transactionId: 't2',
|
|
292
|
+
...bidParams
|
|
293
|
+
});
|
|
294
|
+
|
|
295
|
+
return this;
|
|
296
|
+
};
|
|
297
|
+
|
|
261
298
|
this.withBanner = () => {
|
|
262
|
-
bidRequests
|
|
263
|
-
|
|
264
|
-
[
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
299
|
+
bidRequests.forEach((bid) => {
|
|
300
|
+
bid.mediaTypes.banner = {
|
|
301
|
+
sizes: [
|
|
302
|
+
[300, 250],
|
|
303
|
+
[728, 90]
|
|
304
|
+
]
|
|
305
|
+
};
|
|
306
|
+
});
|
|
268
307
|
|
|
269
308
|
return this;
|
|
270
309
|
};
|
|
271
310
|
|
|
272
311
|
this.withProduct = (prod) => {
|
|
273
|
-
bidRequests
|
|
274
|
-
|
|
312
|
+
bidRequests.forEach((bid) => {
|
|
313
|
+
bid.params.productId = prod;
|
|
314
|
+
});
|
|
275
315
|
return this;
|
|
276
316
|
};
|
|
277
317
|
|
|
278
318
|
this.withVideo = (params) => {
|
|
279
|
-
bidRequests
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
319
|
+
bidRequests.forEach((bid) => {
|
|
320
|
+
bid.mediaTypes.video = {
|
|
321
|
+
playerSize: [[300, 250]],
|
|
322
|
+
context: 'outstream',
|
|
323
|
+
...params
|
|
324
|
+
};
|
|
325
|
+
});
|
|
284
326
|
|
|
285
327
|
return this;
|
|
286
328
|
}
|
|
287
329
|
|
|
288
330
|
this.withUserIds = (eids) => {
|
|
289
|
-
bidRequests
|
|
331
|
+
bidRequests.forEach((bid) => {
|
|
332
|
+
bid.userIdAsEids = eids;
|
|
333
|
+
});
|
|
290
334
|
|
|
291
335
|
return this;
|
|
292
336
|
};
|
|
@@ -315,6 +359,7 @@ describe('33acrossBidAdapter:', function () {
|
|
|
315
359
|
}
|
|
316
360
|
};
|
|
317
361
|
win = {
|
|
362
|
+
parent: null,
|
|
318
363
|
document: {
|
|
319
364
|
visibilityState: 'visible'
|
|
320
365
|
},
|
|
@@ -331,7 +376,7 @@ describe('33acrossBidAdapter:', function () {
|
|
|
331
376
|
|
|
332
377
|
sandbox = sinon.sandbox.create();
|
|
333
378
|
sandbox.stub(Date, 'now').returns(1);
|
|
334
|
-
sandbox.stub(document, 'getElementById').
|
|
379
|
+
sandbox.stub(document, 'getElementById').returns(element);
|
|
335
380
|
sandbox.stub(utils, 'getWindowTop').returns(win);
|
|
336
381
|
sandbox.stub(utils, 'getWindowSelf').returns(win);
|
|
337
382
|
});
|
|
@@ -1376,10 +1421,146 @@ describe('33acrossBidAdapter:', function () {
|
|
|
1376
1421
|
});
|
|
1377
1422
|
});
|
|
1378
1423
|
});
|
|
1424
|
+
|
|
1425
|
+
context('when SRA mode is enabled', function() {
|
|
1426
|
+
it('builds a single request with multiple imps corresponding to each group {siteId, productId}', function() {
|
|
1427
|
+
sandbox.stub(config, 'getConfig').callsFake(() => {
|
|
1428
|
+
return {
|
|
1429
|
+
enableSRAMode: true
|
|
1430
|
+
}
|
|
1431
|
+
});
|
|
1432
|
+
|
|
1433
|
+
const bidRequests = new BidRequestsBuilder()
|
|
1434
|
+
.addBid()
|
|
1435
|
+
.addBid({
|
|
1436
|
+
bidId: 'b3',
|
|
1437
|
+
adUnitCode: 'div-id',
|
|
1438
|
+
params: {
|
|
1439
|
+
siteId: 'sample33xGUID123456780',
|
|
1440
|
+
productId: 'siab'
|
|
1441
|
+
}
|
|
1442
|
+
})
|
|
1443
|
+
.addBid({
|
|
1444
|
+
bidId: 'b4',
|
|
1445
|
+
adUnitCode: 'div-id',
|
|
1446
|
+
params: {
|
|
1447
|
+
siteId: 'sample33xGUID123456780',
|
|
1448
|
+
productId: 'inview'
|
|
1449
|
+
}
|
|
1450
|
+
})
|
|
1451
|
+
.withBanner()
|
|
1452
|
+
.withVideo({context: 'outstream'})
|
|
1453
|
+
.build();
|
|
1454
|
+
|
|
1455
|
+
const req1 = new TtxRequestBuilder()
|
|
1456
|
+
.addImp()
|
|
1457
|
+
.withProduct('siab')
|
|
1458
|
+
.withBanner()
|
|
1459
|
+
.withVideo()
|
|
1460
|
+
.build();
|
|
1461
|
+
|
|
1462
|
+
const req2 = new TtxRequestBuilder('sample33xGUID123456780')
|
|
1463
|
+
.withProduct('siab')
|
|
1464
|
+
.withBanner()
|
|
1465
|
+
.withVideo()
|
|
1466
|
+
.build();
|
|
1467
|
+
|
|
1468
|
+
req2.imp[0].id = 'b3';
|
|
1469
|
+
|
|
1470
|
+
const req3 = new TtxRequestBuilder('sample33xGUID123456780')
|
|
1471
|
+
.withProduct('inview')
|
|
1472
|
+
.withBanner()
|
|
1473
|
+
.withVideo()
|
|
1474
|
+
.build();
|
|
1475
|
+
|
|
1476
|
+
req3.imp[0].id = 'b4';
|
|
1477
|
+
|
|
1478
|
+
const serverReq1 = new ServerRequestBuilder()
|
|
1479
|
+
.withData(req1)
|
|
1480
|
+
.build();
|
|
1481
|
+
|
|
1482
|
+
const serverReq2 = new ServerRequestBuilder()
|
|
1483
|
+
.withData(req2)
|
|
1484
|
+
.withUrl('https://ssc.33across.com/api/v1/hb?guid=sample33xGUID123456780')
|
|
1485
|
+
.build();
|
|
1486
|
+
|
|
1487
|
+
const serverReq3 = new ServerRequestBuilder()
|
|
1488
|
+
.withData(req3)
|
|
1489
|
+
.withUrl('https://ssc.33across.com/api/v1/hb?guid=sample33xGUID123456780')
|
|
1490
|
+
.build();
|
|
1491
|
+
|
|
1492
|
+
const builtServerRequests = spec.buildRequests(bidRequests, {});
|
|
1493
|
+
|
|
1494
|
+
expect(builtServerRequests).to.deep.equal([serverReq1, serverReq2, serverReq3]);
|
|
1495
|
+
});
|
|
1496
|
+
});
|
|
1497
|
+
|
|
1498
|
+
context('when SRA mode is not enabled', function() {
|
|
1499
|
+
it('builds multiple requests, one corresponding to each Ad Unit', function() {
|
|
1500
|
+
const bidRequests = new BidRequestsBuilder()
|
|
1501
|
+
.addBid()
|
|
1502
|
+
.addBid({
|
|
1503
|
+
bidId: 'b3',
|
|
1504
|
+
adUnitCode: 'div-id',
|
|
1505
|
+
params: {
|
|
1506
|
+
siteId: 'sample33xGUID123456780',
|
|
1507
|
+
productId: 'siab'
|
|
1508
|
+
}
|
|
1509
|
+
})
|
|
1510
|
+
.withBanner()
|
|
1511
|
+
.withVideo({context: 'outstream'})
|
|
1512
|
+
.build();
|
|
1513
|
+
|
|
1514
|
+
const req1 = new TtxRequestBuilder()
|
|
1515
|
+
.withProduct('siab')
|
|
1516
|
+
.withBanner()
|
|
1517
|
+
.withVideo()
|
|
1518
|
+
.build();
|
|
1519
|
+
|
|
1520
|
+
const req2 = new TtxRequestBuilder()
|
|
1521
|
+
.withProduct('siab')
|
|
1522
|
+
.withBanner()
|
|
1523
|
+
.withVideo()
|
|
1524
|
+
.build();
|
|
1525
|
+
|
|
1526
|
+
req2.imp[0].id = 'b2';
|
|
1527
|
+
|
|
1528
|
+
const req3 = new TtxRequestBuilder('sample33xGUID123456780')
|
|
1529
|
+
.withProduct('siab')
|
|
1530
|
+
.withBanner()
|
|
1531
|
+
.withVideo()
|
|
1532
|
+
.build();
|
|
1533
|
+
|
|
1534
|
+
req3.imp[0].id = 'b3';
|
|
1535
|
+
|
|
1536
|
+
const serverReq1 = new ServerRequestBuilder()
|
|
1537
|
+
.withData(req1)
|
|
1538
|
+
.build();
|
|
1539
|
+
|
|
1540
|
+
const serverReq2 = new ServerRequestBuilder()
|
|
1541
|
+
.withData(req2)
|
|
1542
|
+
.build();
|
|
1543
|
+
|
|
1544
|
+
const serverReq3 = new ServerRequestBuilder()
|
|
1545
|
+
.withData(req3)
|
|
1546
|
+
.withUrl('https://ssc.33across.com/api/v1/hb?guid=sample33xGUID123456780')
|
|
1547
|
+
.build();
|
|
1548
|
+
|
|
1549
|
+
const builtServerRequests = spec.buildRequests(bidRequests, {});
|
|
1550
|
+
|
|
1551
|
+
expect(builtServerRequests)
|
|
1552
|
+
.to.deep.equal([
|
|
1553
|
+
serverReq1,
|
|
1554
|
+
serverReq2,
|
|
1555
|
+
serverReq3
|
|
1556
|
+
]);
|
|
1557
|
+
});
|
|
1558
|
+
});
|
|
1379
1559
|
});
|
|
1380
1560
|
|
|
1381
1561
|
describe('interpretResponse', function() {
|
|
1382
1562
|
let ttxRequest, serverRequest;
|
|
1563
|
+
const videoBid = '<VAST version="3.0"><Ad></Ad></VAST>';
|
|
1383
1564
|
|
|
1384
1565
|
beforeEach(function() {
|
|
1385
1566
|
ttxRequest = new TtxRequestBuilder()
|
|
@@ -1390,6 +1571,7 @@ describe('33acrossBidAdapter:', function () {
|
|
|
1390
1571
|
page: 'https://test-url.com'
|
|
1391
1572
|
})
|
|
1392
1573
|
.build();
|
|
1574
|
+
|
|
1393
1575
|
serverRequest = new ServerRequestBuilder()
|
|
1394
1576
|
.withUrl('https://staging-ssc.33across.com/api/v1/hb')
|
|
1395
1577
|
.withData(ttxRequest)
|
|
@@ -1405,11 +1587,12 @@ describe('33acrossBidAdapter:', function () {
|
|
|
1405
1587
|
const serverResponse = {
|
|
1406
1588
|
cur: 'USD',
|
|
1407
1589
|
ext: {},
|
|
1408
|
-
id: '
|
|
1590
|
+
id: 'r1',
|
|
1409
1591
|
seatbid: [
|
|
1410
1592
|
{
|
|
1411
1593
|
bid: [{
|
|
1412
1594
|
id: '1',
|
|
1595
|
+
impid: 'b1',
|
|
1413
1596
|
adm: '<html><h3>I am an ad</h3></html>',
|
|
1414
1597
|
crid: 1,
|
|
1415
1598
|
h: 250,
|
|
@@ -1441,15 +1624,15 @@ describe('33acrossBidAdapter:', function () {
|
|
|
1441
1624
|
});
|
|
1442
1625
|
|
|
1443
1626
|
it('interprets and returns the single video bid response', function() {
|
|
1444
|
-
const videoBid = '<VAST version="3.0"><Ad></Ad></VAST>';
|
|
1445
1627
|
const serverResponse = {
|
|
1446
1628
|
cur: 'USD',
|
|
1447
1629
|
ext: {},
|
|
1448
|
-
id: '
|
|
1630
|
+
id: 'r1',
|
|
1449
1631
|
seatbid: [
|
|
1450
1632
|
{
|
|
1451
1633
|
bid: [{
|
|
1452
1634
|
id: '1',
|
|
1635
|
+
impid: 'b1',
|
|
1453
1636
|
adm: videoBid,
|
|
1454
1637
|
ext: {
|
|
1455
1638
|
ttx: {
|
|
@@ -1497,6 +1680,7 @@ describe('33acrossBidAdapter:', function () {
|
|
|
1497
1680
|
{
|
|
1498
1681
|
bid: [{
|
|
1499
1682
|
id: '1',
|
|
1683
|
+
impid: 'b1',
|
|
1500
1684
|
adm: '<html><h3>I am an ad</h3></html>',
|
|
1501
1685
|
crid: 1,
|
|
1502
1686
|
h: 250,
|
|
@@ -1533,7 +1717,7 @@ describe('33acrossBidAdapter:', function () {
|
|
|
1533
1717
|
const serverResponse = {
|
|
1534
1718
|
cur: 'USD',
|
|
1535
1719
|
ext: {},
|
|
1536
|
-
id: '
|
|
1720
|
+
id: 'r1',
|
|
1537
1721
|
seatbid: []
|
|
1538
1722
|
};
|
|
1539
1723
|
|
|
@@ -1542,15 +1726,16 @@ describe('33acrossBidAdapter:', function () {
|
|
|
1542
1726
|
});
|
|
1543
1727
|
|
|
1544
1728
|
context('when more than one bids are returned', function() {
|
|
1545
|
-
it('interprets and returns
|
|
1729
|
+
it('interprets and returns all bids', function() {
|
|
1546
1730
|
const serverResponse = {
|
|
1547
1731
|
cur: 'USD',
|
|
1548
1732
|
ext: {},
|
|
1549
|
-
id: '
|
|
1733
|
+
id: 'r1',
|
|
1550
1734
|
seatbid: [
|
|
1551
1735
|
{
|
|
1552
1736
|
bid: [{
|
|
1553
1737
|
id: '1',
|
|
1738
|
+
impid: 'b1',
|
|
1554
1739
|
adm: '<html><h3>I am an ad</h3></html>',
|
|
1555
1740
|
crid: 1,
|
|
1556
1741
|
h: 250,
|
|
@@ -1559,6 +1744,7 @@ describe('33acrossBidAdapter:', function () {
|
|
|
1559
1744
|
},
|
|
1560
1745
|
{
|
|
1561
1746
|
id: '2',
|
|
1747
|
+
impid: 'b2',
|
|
1562
1748
|
adm: '<html><h3>I am an ad</h3></html>',
|
|
1563
1749
|
crid: 2,
|
|
1564
1750
|
h: 250,
|
|
@@ -1570,7 +1756,14 @@ describe('33acrossBidAdapter:', function () {
|
|
|
1570
1756
|
{
|
|
1571
1757
|
bid: [{
|
|
1572
1758
|
id: '3',
|
|
1573
|
-
|
|
1759
|
+
impid: 'b3',
|
|
1760
|
+
adm: videoBid,
|
|
1761
|
+
ext: {
|
|
1762
|
+
ttx: {
|
|
1763
|
+
mediaType: 'video',
|
|
1764
|
+
vastType: 'xml'
|
|
1765
|
+
}
|
|
1766
|
+
},
|
|
1574
1767
|
crid: 3,
|
|
1575
1768
|
h: 250,
|
|
1576
1769
|
w: 300,
|
|
@@ -1579,21 +1772,50 @@ describe('33acrossBidAdapter:', function () {
|
|
|
1579
1772
|
}
|
|
1580
1773
|
]
|
|
1581
1774
|
};
|
|
1582
|
-
const bidResponse =
|
|
1583
|
-
|
|
1584
|
-
|
|
1585
|
-
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
|
|
1590
|
-
|
|
1591
|
-
|
|
1592
|
-
|
|
1593
|
-
|
|
1594
|
-
|
|
1775
|
+
const bidResponse = [
|
|
1776
|
+
{
|
|
1777
|
+
requestId: 'b1',
|
|
1778
|
+
bidderCode: BIDDER_CODE,
|
|
1779
|
+
cpm: 0.0940,
|
|
1780
|
+
width: 300,
|
|
1781
|
+
height: 250,
|
|
1782
|
+
ad: '<html><h3>I am an ad</h3></html>',
|
|
1783
|
+
ttl: 60,
|
|
1784
|
+
creativeId: 1,
|
|
1785
|
+
mediaType: 'banner',
|
|
1786
|
+
currency: 'USD',
|
|
1787
|
+
netRevenue: true
|
|
1788
|
+
},
|
|
1789
|
+
{
|
|
1790
|
+
requestId: 'b2',
|
|
1791
|
+
bidderCode: BIDDER_CODE,
|
|
1792
|
+
cpm: 0.0938,
|
|
1793
|
+
width: 300,
|
|
1794
|
+
height: 250,
|
|
1795
|
+
ad: '<html><h3>I am an ad</h3></html>',
|
|
1796
|
+
ttl: 60,
|
|
1797
|
+
creativeId: 2,
|
|
1798
|
+
mediaType: 'banner',
|
|
1799
|
+
currency: 'USD',
|
|
1800
|
+
netRevenue: true
|
|
1801
|
+
},
|
|
1802
|
+
{
|
|
1803
|
+
requestId: 'b3',
|
|
1804
|
+
bidderCode: BIDDER_CODE,
|
|
1805
|
+
cpm: 0.0938,
|
|
1806
|
+
width: 300,
|
|
1807
|
+
height: 250,
|
|
1808
|
+
ad: videoBid,
|
|
1809
|
+
vastXml: '<VAST version=\"3.0\"><Ad></Ad></VAST>',
|
|
1810
|
+
ttl: 60,
|
|
1811
|
+
creativeId: 3,
|
|
1812
|
+
mediaType: 'video',
|
|
1813
|
+
currency: 'USD',
|
|
1814
|
+
netRevenue: true
|
|
1815
|
+
}
|
|
1816
|
+
];
|
|
1595
1817
|
|
|
1596
|
-
expect(spec.interpretResponse({ body: serverResponse }, serverRequest)).to.deep.equal(
|
|
1818
|
+
expect(spec.interpretResponse({ body: serverResponse }, serverRequest)).to.deep.equal(bidResponse);
|
|
1597
1819
|
});
|
|
1598
1820
|
});
|
|
1599
1821
|
});
|