prebid.js 5.16.0 → 5.20.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/.devcontainer/Dockerfile +11 -0
- package/.devcontainer/devcontainer.json +27 -0
- package/.devcontainer/postCreate.sh +6 -0
- package/browsers.json +1 -0
- package/integrationExamples/gpt/akamaidap_segments_example.html +132 -0
- package/modules/.submodules.json +1 -0
- package/modules/adfBidAdapter.js +21 -16
- package/modules/adgenerationBidAdapter.js +28 -4
- package/modules/adkernelBidAdapter.js +3 -1
- package/modules/admixerBidAdapter.js +11 -0
- package/modules/adnuntiusBidAdapter.js +1 -0
- package/modules/adtelligentBidAdapter.js +2 -1
- package/modules/airgridRtdProvider.js +1 -1
- package/modules/akamaiDapRtdProvider.js +474 -0
- package/modules/akamaiDapRtdProvider.md +47 -0
- package/modules/aolBidAdapter.js +2 -1
- package/modules/appnexusBidAdapter.js +5 -3
- package/modules/atsAnalyticsAdapter.js +89 -63
- package/modules/atsAnalyticsAdapter.md +1 -0
- package/modules/betweenBidAdapter.js +20 -3
- package/modules/bliinkBidAdapter.js +58 -32
- package/modules/bliinkBidAdapter.md +29 -6
- package/modules/browsiRtdProvider.js +106 -18
- package/modules/cleanioRtdProvider.js +192 -0
- package/modules/cleanioRtdProvider.md +59 -0
- package/modules/codefuelBidAdapter.js +183 -0
- package/modules/codefuelBidAdapter.md +111 -0
- package/modules/connectIdSystem.js +104 -0
- package/modules/connectIdSystem.md +33 -0
- package/modules/cwireBidAdapter.js +272 -0
- package/modules/cwireBidAdapter.md +43 -0
- package/modules/deepintentBidAdapter.js +106 -9
- package/modules/deepintentBidAdapter.md +36 -1
- package/modules/deltaprojectsBidAdapter.js +252 -0
- package/modules/deltaprojectsBidAdapter.md +32 -0
- package/modules/dgkeywordRtdProvider.js +0 -1
- package/modules/engageyaBidAdapter.js +157 -0
- package/modules/glimpseBidAdapter.js +160 -48
- package/modules/glimpseBidAdapter.md +11 -74
- package/modules/gridBidAdapter.js +1 -0
- package/modules/gridNMBidAdapter.js +7 -6
- package/modules/gumgumBidAdapter.js +16 -2
- package/modules/iasRtdProvider.js +83 -67
- package/modules/inskinBidAdapter.js +7 -3
- package/modules/ixBidAdapter.js +8 -1
- package/modules/jixieBidAdapter.js +8 -2
- package/modules/justpremiumBidAdapter.js +6 -1
- package/modules/kargoBidAdapter.js +14 -7
- package/modules/kargoBidAdapter.md +20 -0
- package/modules/limelightDigitalBidAdapter.js +22 -2
- package/modules/livewrappedAnalyticsAdapter.js +53 -3
- package/modules/mediakeysBidAdapter.js +405 -14
- package/modules/mediakeysBidAdapter.md +108 -0
- package/modules/multibid/index.js +3 -3
- package/modules/mytargetBidAdapter.js +112 -0
- package/modules/nativoBidAdapter.js +48 -29
- package/modules/nativoBidAdapter.md +0 -1
- package/modules/nextMillenniumBidAdapter.js +12 -3
- package/modules/nextrollBidAdapter.js +375 -0
- package/modules/nobidBidAdapter.js +2 -1
- package/modules/oguryBidAdapter.js +36 -7
- package/modules/openxBidAdapter.js +34 -22
- package/modules/operaadsBidAdapter.js +21 -1
- package/modules/otmBidAdapter.js +146 -0
- package/modules/otmBidAdapter.md +27 -26
- package/modules/outbrainBidAdapter.js +5 -0
- package/modules/pixfutureBidAdapter.js +24 -4
- package/modules/pixfutureBidAdapter.md +127 -0
- package/modules/playwireBidAdapter.md +61 -0
- package/modules/prebidServerBidAdapter/index.js +1 -1
- package/modules/proxistoreBidAdapter.js +4 -6
- package/modules/publinkIdSystem.js +17 -7
- package/modules/publinkIdSystem.md +7 -2
- package/modules/pubmaticBidAdapter.js +22 -6
- package/modules/pubmaticBidAdapter.md +1 -1
- package/modules/relaidoBidAdapter.js +8 -2
- package/modules/rtdModule/index.js +2 -2
- package/modules/sharethroughBidAdapter.js +12 -19
- package/modules/slimcutBidAdapter.js +121 -0
- package/modules/sonobiBidAdapter.js +7 -0
- package/modules/sortableBidAdapter.js +1 -0
- package/modules/spotxBidAdapter.js +15 -1
- package/modules/sspBCBidAdapter.js +207 -12
- package/modules/sspBCBidAdapter.md +1 -1
- package/modules/talkadsBidAdapter.js +129 -0
- package/modules/talkadsBidAdapter.md +60 -0
- package/modules/tappxBidAdapter.js +6 -5
- package/modules/teadsBidAdapter.js +3 -0
- package/modules/tripleliftBidAdapter.js +22 -5
- package/modules/trustxBidAdapter.js +17 -11
- package/modules/undertoneBidAdapter.js +9 -5
- package/modules/undertoneBidAdapter.md +5 -1
- package/modules/unicornBidAdapter.js +3 -3
- package/modules/userId/eids.js +18 -0
- package/modules/userId/eids.md +7 -0
- package/modules/userId/userId.md +12 -0
- package/modules/ventesBidAdapter.js +370 -0
- package/modules/ventesBidAdapter.md +94 -0
- package/modules/videobyteBidAdapter.js +13 -6
- package/modules/videobyteBidAdapter.md +49 -0
- package/modules/vidoomyBidAdapter.js +20 -12
- package/modules/visxBidAdapter.js +15 -22
- package/modules/yahoosspBidAdapter.js +637 -0
- package/modules/yahoosspBidAdapter.md +795 -0
- package/modules/yieldlabBidAdapter.js +48 -3
- package/modules/yieldlabBidAdapter.md +16 -1
- package/modules/yieldmoBidAdapter.js +20 -6
- package/modules/yieldmoSyntheticInventoryModule.js +46 -0
- package/modules/yieldmoSyntheticInventoryModule.md +68 -0
- package/package.json +1 -1
- package/src/adapterManager.js +5 -0
- package/src/adapters/bidderFactory.js +4 -3
- package/src/auction.js +11 -11
- package/src/constants.json +1 -0
- package/src/secureCreatives.js +6 -7
- package/src/targeting.js +11 -9
- package/test/.eslintrc.js +2 -1
- package/test/spec/modules/adfBidAdapter_spec.js +83 -29
- package/test/spec/modules/adgenerationBidAdapter_spec.js +121 -50
- package/test/spec/modules/adnuntiusBidAdapter_spec.js +68 -0
- package/test/spec/modules/adtelligentBidAdapter_spec.js +1 -0
- package/test/spec/modules/akamaiDapRtdProvider_spec.js +246 -0
- package/test/spec/modules/appnexusBidAdapter_spec.js +2 -1
- package/test/spec/modules/atsAnalyticsAdapter_spec.js +77 -9
- package/test/spec/modules/betweenBidAdapter_spec.js +41 -0
- package/test/spec/modules/bliinkBidAdapter_spec.js +87 -36
- package/test/spec/modules/browsiRtdProvider_spec.js +62 -7
- package/test/spec/modules/cleanioRtdProvider_spec.js +188 -0
- package/test/spec/modules/codefuelBidAdapter_spec.js +316 -0
- package/test/spec/modules/connectIdSystem_spec.js +189 -0
- package/test/spec/modules/cwireBidAdapter_spec.js +246 -0
- package/test/spec/modules/deepintentBidAdapter_spec.js +153 -3
- package/test/spec/modules/deltaprojectsBidAdapter_spec.js +399 -0
- package/test/spec/modules/engageyaBidAdapter_spec.js +286 -0
- package/test/spec/modules/glimpseBidAdapter_spec.js +302 -204
- package/test/spec/modules/gridNMBidAdapter_spec.js +40 -1
- package/test/spec/modules/gumgumBidAdapter_spec.js +23 -6
- package/test/spec/modules/iasRtdProvider_spec.js +71 -6
- package/test/spec/modules/ixBidAdapter_spec.js +13 -3
- package/test/spec/modules/jixieBidAdapter_spec.js +13 -11
- package/test/spec/modules/justpremiumBidAdapter_spec.js +9 -2
- package/test/spec/modules/limelightDigitalBidAdapter_spec.js +155 -1
- package/test/spec/modules/livewrappedAnalyticsAdapter_spec.js +67 -12
- package/test/spec/modules/mediakeysBidAdapter_spec.js +406 -51
- package/test/spec/modules/multibid_spec.js +31 -31
- package/test/spec/modules/mytargetBidAdapter_spec.js +199 -0
- package/test/spec/modules/nativoBidAdapter_spec.js +50 -3
- package/test/spec/modules/nextMillenniumBidAdapter_spec.js +13 -1
- package/test/spec/modules/nextrollBidAdapter_spec.js +290 -0
- package/test/spec/modules/nobidBidAdapter_spec.js +65 -1
- package/test/spec/modules/oguryBidAdapter_spec.js +125 -37
- package/test/spec/modules/openxBidAdapter_spec.js +85 -13
- package/test/spec/modules/operaadsBidAdapter_spec.js +38 -6
- package/test/spec/modules/otmBidAdapter_spec.js +67 -0
- package/test/spec/modules/outbrainBidAdapter_spec.js +18 -0
- package/test/spec/modules/publinkIdSystem_spec.js +34 -15
- package/test/spec/modules/pubmaticBidAdapter_spec.js +217 -1
- package/test/spec/modules/relaidoBidAdapter_spec.js +21 -20
- package/test/spec/modules/sharethroughBidAdapter_spec.js +156 -136
- package/test/spec/modules/slimcutBidAdapter_spec.js +200 -0
- package/test/spec/modules/sonobiBidAdapter_spec.js +34 -1
- package/test/spec/modules/sortableBidAdapter_spec.js +11 -0
- package/test/spec/modules/spotxBidAdapter_spec.js +36 -0
- package/test/spec/modules/sspBCBidAdapter_spec.js +210 -62
- package/test/spec/modules/talkadsBidAdapter_spec.js +231 -0
- package/test/spec/modules/teadsBidAdapter_spec.js +132 -0
- package/test/spec/modules/tripleliftBidAdapter_spec.js +128 -0
- package/test/spec/modules/trustxBidAdapter_spec.js +38 -5
- package/test/spec/modules/undertoneBidAdapter_spec.js +52 -0
- package/test/spec/modules/unicornBidAdapter_spec.js +4 -4
- package/test/spec/modules/ventesBidAdapter_spec.js +845 -0
- package/test/spec/modules/videobyteBidAdapter_spec.js +2 -2
- package/test/spec/modules/visxBidAdapter_spec.js +48 -4
- package/test/spec/modules/yahoosspBidAdapter_spec.js +1332 -0
- package/test/spec/modules/yieldlabBidAdapter_spec.js +65 -1
- package/test/spec/modules/yieldmoBidAdapter_spec.js +30 -9
- package/test/spec/modules/yieldmoSyntheticInventoryModule_spec.js +89 -0
- package/test/spec/unit/core/adapterManager_spec.js +32 -0
- package/test/spec/unit/core/bidderFactory_spec.js +61 -1
- package/test/spec/unit/pbjs_api_spec.js +37 -2
- package/test/spec/unit/secureCreatives_spec.js +54 -25
- package/modules/turktelekomBidAdapter.md +0 -49
|
@@ -6,7 +6,7 @@ import * as utils from 'src/utils';
|
|
|
6
6
|
|
|
7
7
|
const spec = newBidder(sharethroughAdapterSpec).getSpec();
|
|
8
8
|
|
|
9
|
-
describe('sharethrough adapter spec', function() {
|
|
9
|
+
describe('sharethrough adapter spec', function () {
|
|
10
10
|
let protocolStub;
|
|
11
11
|
let inIframeStub;
|
|
12
12
|
|
|
@@ -20,14 +20,14 @@ describe('sharethrough adapter spec', function() {
|
|
|
20
20
|
inIframeStub.restore();
|
|
21
21
|
});
|
|
22
22
|
|
|
23
|
-
describe('code', function() {
|
|
24
|
-
it('should return a bidder code of sharethrough', function() {
|
|
23
|
+
describe('code', function () {
|
|
24
|
+
it('should return a bidder code of sharethrough', function () {
|
|
25
25
|
expect(spec.code).to.eql('sharethrough');
|
|
26
26
|
});
|
|
27
27
|
});
|
|
28
28
|
|
|
29
|
-
describe('isBidRequestValid', function() {
|
|
30
|
-
it('should return false if req has no pkey', function() {
|
|
29
|
+
describe('isBidRequestValid', function () {
|
|
30
|
+
it('should return false if req has no pkey', function () {
|
|
31
31
|
const invalidBidRequest = {
|
|
32
32
|
bidder: 'sharethrough',
|
|
33
33
|
params: {
|
|
@@ -37,17 +37,17 @@ describe('sharethrough adapter spec', function() {
|
|
|
37
37
|
expect(spec.isBidRequestValid(invalidBidRequest)).to.eql(false);
|
|
38
38
|
});
|
|
39
39
|
|
|
40
|
-
it('should return false if req has wrong bidder code', function() {
|
|
40
|
+
it('should return false if req has wrong bidder code', function () {
|
|
41
41
|
const invalidBidRequest = {
|
|
42
42
|
bidder: 'notSharethrough',
|
|
43
43
|
params: {
|
|
44
44
|
pkey: 'abc123',
|
|
45
|
-
}
|
|
45
|
+
},
|
|
46
46
|
};
|
|
47
47
|
expect(spec.isBidRequestValid(invalidBidRequest)).to.eql(false);
|
|
48
48
|
});
|
|
49
49
|
|
|
50
|
-
it('should return true if req is correct', function() {
|
|
50
|
+
it('should return true if req is correct', function () {
|
|
51
51
|
const validBidRequest = {
|
|
52
52
|
bidder: 'sharethrough',
|
|
53
53
|
params: {
|
|
@@ -175,71 +175,82 @@ describe('sharethrough adapter spec', function() {
|
|
|
175
175
|
};
|
|
176
176
|
});
|
|
177
177
|
|
|
178
|
-
describe('buildRequests', function() {
|
|
178
|
+
describe('buildRequests', function () {
|
|
179
179
|
describe('top level object', () => {
|
|
180
180
|
it('should build openRTB request', () => {
|
|
181
|
-
const
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
181
|
+
const builtRequests = spec.buildRequests(bidRequests, bidderRequest);
|
|
182
|
+
|
|
183
|
+
const expectedImpValues = [
|
|
184
|
+
{
|
|
185
|
+
id: 'bidId1',
|
|
186
|
+
tagid: 'aaaa1111',
|
|
187
|
+
secure: 1,
|
|
188
|
+
bidfloor: 42,
|
|
189
|
+
},
|
|
190
|
+
{
|
|
191
|
+
id: 'bidId2',
|
|
192
|
+
tagid: 'bbbb2222',
|
|
193
|
+
secure: 1,
|
|
194
|
+
bidfloor: 42,
|
|
195
|
+
},
|
|
196
|
+
];
|
|
197
|
+
|
|
198
|
+
builtRequests.map((builtRequest, rIndex) => {
|
|
199
|
+
expect(builtRequest.method).to.equal('POST');
|
|
200
|
+
expect(builtRequest.url).not.to.be.undefined;
|
|
201
|
+
expect(builtRequest.options).to.be.undefined;
|
|
202
|
+
|
|
203
|
+
const openRtbReq = builtRequest.data;
|
|
204
|
+
expect(openRtbReq.id).not.to.be.undefined;
|
|
205
|
+
expect(openRtbReq.cur).to.deep.equal(['USD']);
|
|
206
|
+
expect(openRtbReq.tmax).to.equal(242);
|
|
207
|
+
|
|
208
|
+
expect(openRtbReq.site.domain).not.to.be.undefined;
|
|
209
|
+
expect(openRtbReq.site.page).not.to.be.undefined;
|
|
210
|
+
expect(openRtbReq.site.ref).to.equal('https://referer.com');
|
|
211
|
+
|
|
212
|
+
const expectedEids = {
|
|
213
|
+
'liveramp.com': { id: 'fake-identity-link' },
|
|
214
|
+
'id5-sync.com': { id: 'fake-id5id' },
|
|
215
|
+
'pubcid.org': { id: 'fake-pubcid' },
|
|
216
|
+
'adserver.org': { id: 'fake-tdid' },
|
|
217
|
+
'criteo.com': { id: 'fake-criteo' },
|
|
218
|
+
'britepool.com': { id: 'fake-britepool' },
|
|
219
|
+
'liveintent.com': { id: 'fake-lipbid' },
|
|
220
|
+
'intentiq.com': { id: 'fake-intentiq' },
|
|
221
|
+
'crwdcntrl.net': { id: 'fake-lotame' },
|
|
222
|
+
'parrable.com': { id: 'fake-parrable' },
|
|
223
|
+
'netid.de': { id: 'fake-netid' },
|
|
224
|
+
'chrome.com': { id: 'fake-flocid' },
|
|
225
|
+
};
|
|
226
|
+
expect(openRtbReq.user.ext.eids).to.be.an('array').that.have.length(Object.keys(expectedEids).length);
|
|
227
|
+
for (const eid of openRtbReq.user.ext.eids) {
|
|
228
|
+
expect(Object.keys(expectedEids)).to.include(eid.source);
|
|
229
|
+
expect(eid.uids[0].id).to.equal(expectedEids[eid.source].id);
|
|
230
|
+
expect(eid.uids[0].atype).to.be.ok;
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
expect(openRtbReq.device.ua).to.equal(navigator.userAgent);
|
|
234
|
+
expect(openRtbReq.regs.coppa).to.equal(1);
|
|
235
|
+
|
|
236
|
+
expect(openRtbReq.source.ext.version).not.to.be.undefined;
|
|
237
|
+
expect(openRtbReq.source.ext.str).not.to.be.undefined;
|
|
238
|
+
expect(openRtbReq.source.ext.schain).to.deep.equal(bidRequests[0].schain);
|
|
239
|
+
|
|
240
|
+
expect(openRtbReq.bcat).to.deep.equal(bidRequests[0].params.bcat);
|
|
241
|
+
expect(openRtbReq.badv).to.deep.equal(bidRequests[0].params.badv);
|
|
242
|
+
|
|
243
|
+
expect(openRtbReq.imp).to.have.length(1);
|
|
244
|
+
|
|
245
|
+
expect(openRtbReq.imp[0].id).to.equal(expectedImpValues[rIndex].id);
|
|
246
|
+
expect(openRtbReq.imp[0].tagid).to.equal(expectedImpValues[rIndex].tagid);
|
|
247
|
+
expect(openRtbReq.imp[0].secure).to.equal(expectedImpValues[rIndex].secure);
|
|
248
|
+
expect(openRtbReq.imp[0].bidfloor).to.equal(expectedImpValues[rIndex].bidfloor);
|
|
249
|
+
});
|
|
239
250
|
});
|
|
240
251
|
|
|
241
252
|
it('should have empty eid array if no id is provided', () => {
|
|
242
|
-
const openRtbReq = spec.buildRequests([bidRequests[1]], bidderRequest).data;
|
|
253
|
+
const openRtbReq = spec.buildRequests([bidRequests[1]], bidderRequest)[0].data;
|
|
243
254
|
|
|
244
255
|
expect(openRtbReq.user.ext.eids).to.deep.equal([]);
|
|
245
256
|
});
|
|
@@ -253,8 +264,7 @@ describe('sharethrough adapter spec', function() {
|
|
|
253
264
|
consentString: 'consent',
|
|
254
265
|
};
|
|
255
266
|
|
|
256
|
-
const
|
|
257
|
-
const openRtbReq = builtRequest.data;
|
|
267
|
+
const openRtbReq = spec.buildRequests(bidRequests, bidderRequest)[0].data;
|
|
258
268
|
|
|
259
269
|
expect(openRtbReq.regs.ext.gdpr).to.equal(1);
|
|
260
270
|
expect(openRtbReq.user.ext.consent).to.equal('consent');
|
|
@@ -265,8 +275,7 @@ describe('sharethrough adapter spec', function() {
|
|
|
265
275
|
gdprApplies: false,
|
|
266
276
|
};
|
|
267
277
|
|
|
268
|
-
const
|
|
269
|
-
const openRtbReq = builtRequest.data;
|
|
278
|
+
const openRtbReq = spec.buildRequests(bidRequests, bidderRequest)[0].data;
|
|
270
279
|
|
|
271
280
|
expect(openRtbReq.regs.ext.gdpr).to.equal(0);
|
|
272
281
|
expect(openRtbReq.user.ext.consent).to.be.undefined;
|
|
@@ -277,8 +286,7 @@ describe('sharethrough adapter spec', function() {
|
|
|
277
286
|
it('should populate request accordingly when us privacy applies', () => {
|
|
278
287
|
bidderRequest.uspConsent = 'consent';
|
|
279
288
|
|
|
280
|
-
const
|
|
281
|
-
const openRtbReq = builtRequest.data;
|
|
289
|
+
const openRtbReq = spec.buildRequests(bidRequests, bidderRequest)[0].data;
|
|
282
290
|
|
|
283
291
|
expect(openRtbReq.regs.ext.us_privacy).to.equal('consent');
|
|
284
292
|
});
|
|
@@ -288,8 +296,7 @@ describe('sharethrough adapter spec', function() {
|
|
|
288
296
|
it('should populate request accordingly when coppa does not apply', () => {
|
|
289
297
|
config.setConfig({ coppa: false });
|
|
290
298
|
|
|
291
|
-
const
|
|
292
|
-
const openRtbReq = builtRequest.data;
|
|
299
|
+
const openRtbReq = spec.buildRequests(bidRequests, bidderRequest)[0].data;
|
|
293
300
|
|
|
294
301
|
expect(openRtbReq.regs.coppa).to.equal(0);
|
|
295
302
|
});
|
|
@@ -298,46 +305,42 @@ describe('sharethrough adapter spec', function() {
|
|
|
298
305
|
|
|
299
306
|
describe('universal id', () => {
|
|
300
307
|
it('should include gpid when universal id is provided', () => {
|
|
301
|
-
const
|
|
302
|
-
const openRtbReq = builtRequest.data;
|
|
308
|
+
const requests = spec.buildRequests(bidRequests, bidderRequest);
|
|
303
309
|
|
|
304
|
-
expect(
|
|
305
|
-
expect(
|
|
310
|
+
expect(requests[0].data.imp[0].ext.gpid).to.equal('universal-id');
|
|
311
|
+
expect(requests[1].data.imp[0].ext).to.be.undefined;
|
|
306
312
|
});
|
|
307
313
|
});
|
|
308
314
|
|
|
309
315
|
describe('secure flag', () => {
|
|
310
316
|
it('should be positive when protocol is https', () => {
|
|
311
317
|
protocolStub.returns('https');
|
|
312
|
-
const
|
|
313
|
-
const openRtbReq = builtRequest.data;
|
|
318
|
+
const requests = spec.buildRequests(bidRequests, bidderRequest);
|
|
314
319
|
|
|
315
|
-
expect(
|
|
316
|
-
expect(
|
|
320
|
+
expect(requests[0].data.imp[0].secure).to.equal(1);
|
|
321
|
+
expect(requests[1].data.imp[0].secure).to.equal(1);
|
|
317
322
|
});
|
|
318
323
|
|
|
319
324
|
it('should be negative when protocol is http', () => {
|
|
320
325
|
protocolStub.returns('http');
|
|
321
|
-
const
|
|
322
|
-
const openRtbReq = builtRequest.data;
|
|
326
|
+
const requests = spec.buildRequests(bidRequests, bidderRequest);
|
|
323
327
|
|
|
324
|
-
expect(
|
|
325
|
-
expect(
|
|
328
|
+
expect(requests[0].data.imp[0].secure).to.equal(0);
|
|
329
|
+
expect(requests[1].data.imp[0].secure).to.equal(0);
|
|
326
330
|
});
|
|
327
331
|
|
|
328
332
|
it('should be positive when protocol is neither http nor https', () => {
|
|
329
333
|
protocolStub.returns('about');
|
|
330
|
-
const
|
|
331
|
-
const openRtbReq = builtRequest.data;
|
|
334
|
+
const requests = spec.buildRequests(bidRequests, bidderRequest);
|
|
332
335
|
|
|
333
|
-
expect(
|
|
334
|
-
expect(
|
|
336
|
+
expect(requests[0].data.imp[0].secure).to.equal(1);
|
|
337
|
+
expect(requests[1].data.imp[0].secure).to.equal(1);
|
|
335
338
|
});
|
|
336
339
|
});
|
|
337
340
|
|
|
338
341
|
describe('banner imp', () => {
|
|
339
342
|
it('should generate open rtb banner imp', () => {
|
|
340
|
-
const builtRequest = spec.buildRequests(bidRequests, bidderRequest);
|
|
343
|
+
const builtRequest = spec.buildRequests(bidRequests, bidderRequest)[0];
|
|
341
344
|
|
|
342
345
|
const bannerImp = builtRequest.data.imp[0].banner;
|
|
343
346
|
expect(bannerImp.pos).to.equal(1);
|
|
@@ -347,7 +350,7 @@ describe('sharethrough adapter spec', function() {
|
|
|
347
350
|
|
|
348
351
|
it('should default to pos 0 if not provided', () => {
|
|
349
352
|
delete bidRequests[0].mediaTypes;
|
|
350
|
-
const builtRequest = spec.buildRequests(bidRequests, bidderRequest);
|
|
353
|
+
const builtRequest = spec.buildRequests(bidRequests, bidderRequest)[0];
|
|
351
354
|
|
|
352
355
|
const bannerImp = builtRequest.data.imp[0].banner;
|
|
353
356
|
expect(bannerImp.pos).to.equal(0);
|
|
@@ -356,9 +359,9 @@ describe('sharethrough adapter spec', function() {
|
|
|
356
359
|
|
|
357
360
|
describe('video imp', () => {
|
|
358
361
|
it('should generate open rtb video imp', () => {
|
|
359
|
-
const builtRequest = spec.buildRequests(bidRequests, bidderRequest);
|
|
362
|
+
const builtRequest = spec.buildRequests(bidRequests, bidderRequest)[1];
|
|
360
363
|
|
|
361
|
-
const videoImp = builtRequest.data.imp[
|
|
364
|
+
const videoImp = builtRequest.data.imp[0].video;
|
|
362
365
|
expect(videoImp.pos).to.equal(3);
|
|
363
366
|
expect(videoImp.topframe).to.equal(1);
|
|
364
367
|
expect(videoImp.skip).to.equal(1);
|
|
@@ -399,9 +402,9 @@ describe('sharethrough adapter spec', function() {
|
|
|
399
402
|
delete bidRequests[1].mediaTypes.video.companiontype;
|
|
400
403
|
delete bidRequests[1].mediaTypes.video.companionad;
|
|
401
404
|
|
|
402
|
-
const builtRequest = spec.buildRequests(bidRequests, bidderRequest);
|
|
405
|
+
const builtRequest = spec.buildRequests(bidRequests, bidderRequest)[1];
|
|
403
406
|
|
|
404
|
-
const videoImp = builtRequest.data.imp[
|
|
407
|
+
const videoImp = builtRequest.data.imp[0].video;
|
|
405
408
|
expect(videoImp.pos).to.equal(0);
|
|
406
409
|
expect(videoImp.skip).to.equal(0);
|
|
407
410
|
expect(videoImp.linearity).to.equal(1);
|
|
@@ -424,47 +427,46 @@ describe('sharethrough adapter spec', function() {
|
|
|
424
427
|
|
|
425
428
|
it('should not return a video impression if context is outstream', () => {
|
|
426
429
|
bidRequests[1].mediaTypes.video.context = 'outstream';
|
|
427
|
-
const builtRequest = spec.buildRequests(bidRequests, bidderRequest);
|
|
430
|
+
const builtRequest = spec.buildRequests(bidRequests, bidderRequest)[1];
|
|
428
431
|
|
|
429
|
-
|
|
430
|
-
expect(videoImp).to.be.undefined;
|
|
432
|
+
expect(builtRequest).to.be.undefined;
|
|
431
433
|
});
|
|
432
434
|
});
|
|
433
435
|
});
|
|
434
436
|
|
|
435
|
-
describe('interpretResponse', function() {
|
|
437
|
+
describe('interpretResponse', function () {
|
|
436
438
|
let request;
|
|
437
439
|
let response;
|
|
438
440
|
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
441
|
+
describe('banner', () => {
|
|
442
|
+
beforeEach(() => {
|
|
443
|
+
request = spec.buildRequests(bidRequests, bidderRequest)[0];
|
|
444
|
+
response = {
|
|
445
|
+
body: {
|
|
446
|
+
seatbid: [{
|
|
447
|
+
bid: [{
|
|
448
|
+
id: '123',
|
|
449
|
+
impid: 'bidId1',
|
|
450
|
+
w: 300,
|
|
451
|
+
h: 250,
|
|
452
|
+
price: 42,
|
|
453
|
+
crid: 'creative',
|
|
454
|
+
dealid: 'deal',
|
|
455
|
+
adomain: ['domain.com'],
|
|
456
|
+
adm: 'markup',
|
|
457
|
+
}, {
|
|
458
|
+
id: '456',
|
|
459
|
+
impid: 'bidId2',
|
|
460
|
+
w: 640,
|
|
461
|
+
h: 480,
|
|
462
|
+
price: 42,
|
|
463
|
+
adm: 'vastTag',
|
|
464
|
+
}],
|
|
461
465
|
}],
|
|
462
|
-
}
|
|
463
|
-
}
|
|
464
|
-
};
|
|
465
|
-
});
|
|
466
|
+
},
|
|
467
|
+
};
|
|
468
|
+
});
|
|
466
469
|
|
|
467
|
-
describe('banner', () => {
|
|
468
470
|
it('should return a banner bid', () => {
|
|
469
471
|
const resp = spec.interpretResponse(response, request);
|
|
470
472
|
|
|
@@ -486,10 +488,28 @@ describe('sharethrough adapter spec', function() {
|
|
|
486
488
|
});
|
|
487
489
|
|
|
488
490
|
describe('video', () => {
|
|
491
|
+
beforeEach(() => {
|
|
492
|
+
request = spec.buildRequests(bidRequests, bidderRequest)[1];
|
|
493
|
+
response = {
|
|
494
|
+
body: {
|
|
495
|
+
seatbid: [{
|
|
496
|
+
bid: [{
|
|
497
|
+
id: '456',
|
|
498
|
+
impid: 'bidId2',
|
|
499
|
+
w: 640,
|
|
500
|
+
h: 480,
|
|
501
|
+
price: 42,
|
|
502
|
+
adm: 'vastTag',
|
|
503
|
+
}],
|
|
504
|
+
}],
|
|
505
|
+
},
|
|
506
|
+
};
|
|
507
|
+
});
|
|
508
|
+
|
|
489
509
|
it('should return a video bid', () => {
|
|
490
510
|
const resp = spec.interpretResponse(response, request);
|
|
491
511
|
|
|
492
|
-
const bannerBid = resp[
|
|
512
|
+
const bannerBid = resp[0];
|
|
493
513
|
expect(bannerBid.requestId).to.equal('bidId2');
|
|
494
514
|
expect(bannerBid.width).to.equal(640);
|
|
495
515
|
expect(bannerBid.height).to.equal(480);
|
|
@@ -507,11 +527,11 @@ describe('sharethrough adapter spec', function() {
|
|
|
507
527
|
});
|
|
508
528
|
});
|
|
509
529
|
|
|
510
|
-
describe('getUserSyncs', function() {
|
|
530
|
+
describe('getUserSyncs', function () {
|
|
511
531
|
const cookieSyncs = ['cookieUrl1', 'cookieUrl2', 'cookieUrl3'];
|
|
512
532
|
const serverResponses = [{ body: { cookieSyncUrls: cookieSyncs } }];
|
|
513
533
|
|
|
514
|
-
it('returns an array of correctly formatted user syncs', function() {
|
|
534
|
+
it('returns an array of correctly formatted user syncs', function () {
|
|
515
535
|
const syncArray = spec.getUserSyncs({ pixelEnabled: true }, serverResponses, null, 'fake-privacy-signal');
|
|
516
536
|
expect(syncArray).to.deep.equal([
|
|
517
537
|
{ type: 'image', url: 'cookieUrl1&us_privacy=fake-privacy-signal' },
|
|
@@ -520,22 +540,22 @@ describe('sharethrough adapter spec', function() {
|
|
|
520
540
|
);
|
|
521
541
|
});
|
|
522
542
|
|
|
523
|
-
it('returns an empty array if serverResponses is empty', function() {
|
|
543
|
+
it('returns an empty array if serverResponses is empty', function () {
|
|
524
544
|
const syncArray = spec.getUserSyncs({ pixelEnabled: true }, []);
|
|
525
545
|
expect(syncArray).to.be.an('array').that.is.empty;
|
|
526
546
|
});
|
|
527
547
|
|
|
528
|
-
it('returns an empty array if the body is null', function() {
|
|
548
|
+
it('returns an empty array if the body is null', function () {
|
|
529
549
|
const syncArray = spec.getUserSyncs({ pixelEnabled: true }, [{ body: null }]);
|
|
530
550
|
expect(syncArray).to.be.an('array').that.is.empty;
|
|
531
551
|
});
|
|
532
552
|
|
|
533
|
-
it('returns an empty array if the body.cookieSyncUrls is missing', function() {
|
|
553
|
+
it('returns an empty array if the body.cookieSyncUrls is missing', function () {
|
|
534
554
|
const syncArray = spec.getUserSyncs({ pixelEnabled: true }, [{ body: { creatives: ['creative'] } }]);
|
|
535
555
|
expect(syncArray).to.be.an('array').that.is.empty;
|
|
536
556
|
});
|
|
537
557
|
|
|
538
|
-
it('returns an empty array if pixels are not enabled', function() {
|
|
558
|
+
it('returns an empty array if pixels are not enabled', function () {
|
|
539
559
|
const syncArray = spec.getUserSyncs({ pixelEnabled: false }, serverResponses);
|
|
540
560
|
expect(syncArray).to.be.an('array').that.is.empty;
|
|
541
561
|
});
|
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
import {
|
|
2
|
+
expect
|
|
3
|
+
} from 'chai';
|
|
4
|
+
import {
|
|
5
|
+
spec
|
|
6
|
+
} from 'modules/slimcutBidAdapter.js';
|
|
7
|
+
import {
|
|
8
|
+
newBidder
|
|
9
|
+
} from 'src/adapters/bidderFactory.js';
|
|
10
|
+
const ENDPOINT = 'https://sb.freeskreen.com/pbr';
|
|
11
|
+
const AD_SCRIPT = '<script type="text/javascript" class="slimcut" async="true" src="https://static.freeskreen.com/publisher/83/freeskreen.min.js"></script>"';
|
|
12
|
+
describe('slimcutBidAdapter', function() {
|
|
13
|
+
const adapter = newBidder(spec);
|
|
14
|
+
describe('inherited functions', function() {
|
|
15
|
+
it('exists and is a function', function() {
|
|
16
|
+
expect(adapter.callBids).to.exist.and.to.be.a('function');
|
|
17
|
+
});
|
|
18
|
+
});
|
|
19
|
+
describe('isBidRequestValid', function() {
|
|
20
|
+
let bid = {
|
|
21
|
+
'bidder': 'slimcut',
|
|
22
|
+
'params': {
|
|
23
|
+
'placementId': 83
|
|
24
|
+
},
|
|
25
|
+
'adUnitCode': 'adunit-code',
|
|
26
|
+
'sizes': [
|
|
27
|
+
[300, 250],
|
|
28
|
+
[300, 600]
|
|
29
|
+
],
|
|
30
|
+
'bidId': '3c871ffa8ef14c',
|
|
31
|
+
'bidderRequestId': 'b41642f1aee381',
|
|
32
|
+
'auctionId': '4e156668c977d7'
|
|
33
|
+
};
|
|
34
|
+
it('should return true when required params found', function() {
|
|
35
|
+
expect(spec.isBidRequestValid(bid)).to.equal(true);
|
|
36
|
+
});
|
|
37
|
+
it('should return false when placementId is not valid (letters)', function() {
|
|
38
|
+
let bid = Object.assign({}, bid);
|
|
39
|
+
delete bid.params;
|
|
40
|
+
bid.params = {
|
|
41
|
+
'placementId': 'ABCD'
|
|
42
|
+
};
|
|
43
|
+
expect(spec.isBidRequestValid(bid)).to.equal(false);
|
|
44
|
+
});
|
|
45
|
+
it('should return false when placementId < 0', function() {
|
|
46
|
+
let bid = Object.assign({}, bid);
|
|
47
|
+
delete bid.params;
|
|
48
|
+
bid.params = {
|
|
49
|
+
'placementId': -1
|
|
50
|
+
};
|
|
51
|
+
expect(spec.isBidRequestValid(bid)).to.equal(false);
|
|
52
|
+
});
|
|
53
|
+
it('should return false when required params are not passed', function() {
|
|
54
|
+
let bid = Object.assign({}, bid);
|
|
55
|
+
delete bid.params;
|
|
56
|
+
bid.params = {};
|
|
57
|
+
expect(spec.isBidRequestValid(bid)).to.equal(false);
|
|
58
|
+
});
|
|
59
|
+
});
|
|
60
|
+
describe('buildRequests', function() {
|
|
61
|
+
let bidRequests = [{
|
|
62
|
+
'bidder': 'teads',
|
|
63
|
+
'params': {
|
|
64
|
+
'placementId': 10433394
|
|
65
|
+
},
|
|
66
|
+
'adUnitCode': 'adunit-code',
|
|
67
|
+
'sizes': [
|
|
68
|
+
[300, 250],
|
|
69
|
+
[300, 600]
|
|
70
|
+
],
|
|
71
|
+
'bidId': '3c871ffa8ef14c',
|
|
72
|
+
'bidderRequestId': 'b41642f1aee381',
|
|
73
|
+
'auctionId': '4e156668c977d7',
|
|
74
|
+
'deviceWidth': 1680
|
|
75
|
+
}];
|
|
76
|
+
let bidderResquestDefault = {
|
|
77
|
+
'auctionId': '4e156668c977d7',
|
|
78
|
+
'bidderRequestId': 'b41642f1aee381',
|
|
79
|
+
'timeout': 3000
|
|
80
|
+
};
|
|
81
|
+
it('sends bid request to ENDPOINT via POST', function() {
|
|
82
|
+
const request = spec.buildRequests(bidRequests, bidderResquestDefault);
|
|
83
|
+
expect(request.url).to.equal(ENDPOINT);
|
|
84
|
+
expect(request.method).to.equal('POST');
|
|
85
|
+
});
|
|
86
|
+
it('should send GDPR to endpoint', function() {
|
|
87
|
+
let consentString = 'JRJ8RKfDeBNsERRDCSAAZ+A==';
|
|
88
|
+
let bidderRequest = {
|
|
89
|
+
'auctionId': '4e156668c977d7',
|
|
90
|
+
'bidderRequestId': 'b41642f1aee381',
|
|
91
|
+
'timeout': 3000,
|
|
92
|
+
'gdprConsent': {
|
|
93
|
+
'consentString': consentString,
|
|
94
|
+
'gdprApplies': true,
|
|
95
|
+
'vendorData': {
|
|
96
|
+
'hasGlobalConsent': false
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
};
|
|
100
|
+
const request = spec.buildRequests(bidRequests, bidderRequest);
|
|
101
|
+
const payload = JSON.parse(request.data);
|
|
102
|
+
expect(payload.gdpr_iab).to.exist;
|
|
103
|
+
expect(payload.gdpr_iab.consent).to.equal(consentString);
|
|
104
|
+
});
|
|
105
|
+
it('should add referer info to payload', function() {
|
|
106
|
+
const bidRequest = Object.assign({}, bidRequests[0])
|
|
107
|
+
const bidderRequest = {
|
|
108
|
+
refererInfo: {
|
|
109
|
+
referer: 'https://example.com/page.html',
|
|
110
|
+
reachedTop: true,
|
|
111
|
+
numIframes: 2
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
const request = spec.buildRequests([bidRequest], bidderRequest);
|
|
115
|
+
const payload = JSON.parse(request.data);
|
|
116
|
+
expect(payload.referrer).to.exist;
|
|
117
|
+
expect(payload.referrer).to.deep.equal('https://example.com/page.html')
|
|
118
|
+
});
|
|
119
|
+
});
|
|
120
|
+
describe('getUserSyncs', () => {
|
|
121
|
+
let bids = {
|
|
122
|
+
'body': {
|
|
123
|
+
'responses': [{
|
|
124
|
+
'ad': AD_SCRIPT,
|
|
125
|
+
'cpm': 0.5,
|
|
126
|
+
'currency': 'USD',
|
|
127
|
+
'height': 250,
|
|
128
|
+
'netRevenue': true,
|
|
129
|
+
'requestId': '3ede2a3fa0db94',
|
|
130
|
+
'ttl': 360,
|
|
131
|
+
'width': 300,
|
|
132
|
+
'creativeId': 'er2ee',
|
|
133
|
+
'transactionId': 'deadb33f',
|
|
134
|
+
'winUrl': 'https://sb.freeskreen.com/win'
|
|
135
|
+
}]
|
|
136
|
+
}
|
|
137
|
+
};
|
|
138
|
+
it('should get the correct number of sync urls', () => {
|
|
139
|
+
let urls = spec.getUserSyncs({
|
|
140
|
+
iframeEnabled: true
|
|
141
|
+
}, bids);
|
|
142
|
+
expect(urls.length).to.equal(1);
|
|
143
|
+
expect(urls[0].url).to.equal('https://sb.freeskreen.com/async_usersync.html');
|
|
144
|
+
});
|
|
145
|
+
it('should return no url if not iframe enabled', () => {
|
|
146
|
+
let urls = spec.getUserSyncs({
|
|
147
|
+
iframeEnabled: false
|
|
148
|
+
}, bids);
|
|
149
|
+
expect(urls.length).to.equal(0);
|
|
150
|
+
});
|
|
151
|
+
});
|
|
152
|
+
describe('interpretResponse', function() {
|
|
153
|
+
let bids = {
|
|
154
|
+
'body': {
|
|
155
|
+
'responses': [{
|
|
156
|
+
'ad': AD_SCRIPT,
|
|
157
|
+
'cpm': 0.5,
|
|
158
|
+
'currency': 'USD',
|
|
159
|
+
'height': 250,
|
|
160
|
+
'netRevenue': true,
|
|
161
|
+
'requestId': '3ede2a3fa0db94',
|
|
162
|
+
'ttl': 360,
|
|
163
|
+
'width': 300,
|
|
164
|
+
'creativeId': 'er2ee',
|
|
165
|
+
'transactionId': 'deadb33f',
|
|
166
|
+
'winUrl': 'https://sb.freeskreen.com/win'
|
|
167
|
+
}]
|
|
168
|
+
}
|
|
169
|
+
};
|
|
170
|
+
it('should get correct bid response', function() {
|
|
171
|
+
let expectedResponse = [{
|
|
172
|
+
'cpm': 0.5,
|
|
173
|
+
'width': 300,
|
|
174
|
+
'height': 250,
|
|
175
|
+
'currency': 'USD',
|
|
176
|
+
'netRevenue': true,
|
|
177
|
+
'ttl': 360,
|
|
178
|
+
'ad': AD_SCRIPT,
|
|
179
|
+
'requestId': '3ede2a3fa0db94',
|
|
180
|
+
'creativeId': 'er2ee',
|
|
181
|
+
'transactionId': 'deadb33f',
|
|
182
|
+
'winUrl': 'https://sb.freeskreen.com/win',
|
|
183
|
+
'meta': {
|
|
184
|
+
'advertiserDomains': []
|
|
185
|
+
}
|
|
186
|
+
}];
|
|
187
|
+
let result = spec.interpretResponse(bids);
|
|
188
|
+
expect(Object.keys(result[0])).to.deep.equal(Object.keys(expectedResponse[0]));
|
|
189
|
+
});
|
|
190
|
+
it('handles nobid responses', function() {
|
|
191
|
+
let bids = {
|
|
192
|
+
'body': {
|
|
193
|
+
'responses': []
|
|
194
|
+
}
|
|
195
|
+
};
|
|
196
|
+
let result = spec.interpretResponse(bids);
|
|
197
|
+
expect(result.length).to.equal(0);
|
|
198
|
+
});
|
|
199
|
+
});
|
|
200
|
+
});
|