prebid.js 7.22.0 → 7.23.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/33acrossBidAdapter.js +1 -1
- package/dist/aaxBlockmeterRtdProvider.js +1 -0
- package/dist/adagioBidAdapter.js +1 -1
- package/dist/adbookpspBidAdapter.js +1 -1
- package/dist/adgenerationBidAdapter.js +1 -1
- package/dist/adrelevantisBidAdapter.js +1 -1
- package/dist/adtrgtmeBidAdapter.js +1 -1
- package/dist/adxcgBidAdapter.js +1 -1
- package/dist/ajaBidAdapter.js +1 -1
- package/dist/amxBidAdapter.js +1 -1
- package/dist/amxIdSystem.js +1 -1
- package/dist/analyticsAdapter.js +1 -1
- package/dist/appierAnalyticsAdapter.js +1 -1
- package/dist/appnexusBidAdapter.js +1 -1
- package/dist/asoBidAdapter.js +1 -1
- package/dist/axonixBidAdapter.js +1 -1
- package/dist/bidViewability.js +1 -1
- package/dist/bidViewabilityIO.js +1 -1
- package/dist/bidglassBidAdapter.js +1 -1
- package/dist/big-richmediaBidAdapter.js +1 -1
- package/dist/bridgewellBidAdapter.js +1 -1
- package/dist/brightMountainMediaBidAdapter.js +1 -1
- package/dist/browsiRtdProvider.js +1 -1
- package/dist/carodaBidAdapter.js +1 -1
- package/dist/chtnwBidAdapter.js +1 -0
- package/dist/cleanioRtdProvider.js +1 -1
- package/dist/concertBidAdapter.js +1 -1
- package/dist/connectadBidAdapter.js +1 -1
- package/dist/consentManagement.js +1 -1
- package/dist/consentManagementUsp.js +1 -1
- package/dist/consumableBidAdapter.js +1 -1
- package/dist/conversantBidAdapter.js +1 -1
- package/dist/craftBidAdapter.js +1 -1
- package/dist/criteoBidAdapter.js +1 -1
- package/dist/currency.js +1 -1
- package/dist/dependencies.json +19 -0
- package/dist/dfpAdServerVideo.js +1 -1
- package/dist/dgkeywordRtdProvider.js +1 -1
- package/dist/dspxBidAdapter.js +1 -1
- package/dist/eplanningBidAdapter.js +1 -1
- package/dist/finativeBidAdapter.js +1 -1
- package/dist/gdprEnforcement.js +1 -1
- package/dist/glimpseBidAdapter.js +1 -1
- package/dist/gmosspBidAdapter.js +1 -1
- package/dist/goldbachBidAdapter.js +1 -1
- package/dist/googleAnalyticsAdapter.js +1 -1
- package/dist/gridBidAdapter.js +1 -1
- package/dist/gridNMBidAdapter.js +1 -1
- package/dist/gumgumBidAdapter.js +1 -1
- package/dist/h12mediaBidAdapter.js +1 -1
- package/dist/id5AnalyticsAdapter.js +1 -1
- package/dist/id5IdSystem.js +1 -1
- package/dist/improvedigitalBidAdapter.js +1 -1
- package/dist/inmarBidAdapter.js +1 -1
- package/dist/insticatorBidAdapter.js +1 -1
- package/dist/instreamTracking.js +1 -1
- package/dist/ixBidAdapter.js +1 -1
- package/dist/justpremiumBidAdapter.js +1 -1
- package/dist/jwplayerVideoProvider.js +1 -0
- package/dist/kargoBidAdapter.js +1 -1
- package/dist/konduitAnalyticsAdapter.js +1 -1
- package/dist/kueezBidAdapter.js +1 -1
- package/dist/lassoBidAdapter.js +1 -1
- package/dist/lifestreetBidAdapter.js +1 -1
- package/dist/liveyieldAnalyticsAdapter.js +1 -1
- package/dist/logicadBidAdapter.js +1 -1
- package/dist/loglyliftBidAdapter.js +1 -1
- package/dist/magniteAnalyticsAdapter.js +1 -1
- package/dist/malltvAnalyticsAdapter.js +1 -1
- package/dist/marsmediaBidAdapter.js +1 -1
- package/dist/mediafuseBidAdapter.js +1 -1
- package/dist/mediasquareBidAdapter.js +1 -1
- package/dist/mgidBidAdapter.js +1 -1
- package/dist/minutemediaBidAdapter.js +1 -1
- package/dist/multibid.js +1 -1
- package/dist/not-for-prod/prebid.js +141 -132
- package/dist/oguryBidAdapter.js +1 -1
- package/dist/onetagBidAdapter.js +1 -1
- package/dist/ooloAnalyticsAdapter.js +1 -1
- package/dist/openxOrtbBidAdapter.js +1 -1
- package/dist/ortbConverter.js +1 -0
- package/dist/outbrainBidAdapter.js +1 -1
- package/dist/oxxionRtdProvider.js +1 -0
- package/dist/parrableIdSystem.js +1 -1
- package/dist/pbsExtensions.js +1 -0
- package/dist/pixfutureBidAdapter.js +1 -1
- package/dist/prebid-core.js +1 -1
- package/dist/prebidServerBidAdapter.js +1 -1
- package/dist/priceFloors.js +1 -1
- package/dist/pubCommonId.js +1 -1
- package/dist/publinkIdSystem.js +1 -1
- package/dist/pubmaticBidAdapter.js +1 -1
- package/dist/pubwiseAnalyticsAdapter.js +1 -1
- package/dist/pxyzBidAdapter.js +1 -1
- package/dist/quantcastBidAdapter.js +1 -1
- package/dist/readpeakBidAdapter.js +1 -1
- package/dist/relaidoBidAdapter.js +1 -1
- package/dist/rhythmoneBidAdapter.js +1 -1
- package/dist/riseBidAdapter.js +1 -1
- package/dist/rtdModule.js +1 -1
- package/dist/rubiconAnalyticsAdapter.js +1 -1
- package/dist/rubiconBidAdapter.js +1 -1
- package/dist/schain.js +1 -1
- package/dist/seedingAllianceBidAdapter.js +1 -1
- package/dist/seedtagBidAdapter.js +1 -1
- package/dist/sharethroughAnalyticsAdapter.js +1 -1
- package/dist/sharethroughBidAdapter.js +1 -1
- package/dist/shinezBidAdapter.js +1 -1
- package/dist/smaatoBidAdapter.js +1 -1
- package/dist/smartadserverBidAdapter.js +1 -1
- package/dist/smartxBidAdapter.js +1 -1
- package/dist/smilewantedBidAdapter.js +1 -1
- package/dist/sonobiBidAdapter.js +1 -1
- package/dist/sovrnAnalyticsAdapter.js +1 -1
- package/dist/sovrnBidAdapter.js +1 -1
- package/dist/spotxBidAdapter.js +1 -1
- package/dist/sspBCBidAdapter.js +1 -1
- package/dist/sublimeBidAdapter.js +1 -1
- package/dist/synacormediaBidAdapter.js +1 -1
- package/dist/targetVideoBidAdapter.js +1 -1
- package/dist/teadsBidAdapter.js +1 -1
- package/dist/teadsIdSystem.js +1 -1
- package/dist/trionBidAdapter.js +1 -1
- package/dist/tripleliftBidAdapter.js +1 -1
- package/dist/ttdBidAdapter.js +1 -1
- package/dist/ucfunnelAnalyticsAdapter.js +1 -1
- package/dist/underdogmediaBidAdapter.js +1 -1
- package/dist/undertoneBidAdapter.js +1 -1
- package/dist/userId.js +1 -1
- package/dist/vidazooBidAdapter.js +1 -1
- package/dist/video.js +1 -0
- package/dist/videoModule.js +1 -0
- package/dist/videobyteBidAdapter.js +1 -1
- package/dist/videojsVideoProvider.js +1 -0
- package/dist/visxBidAdapter.js +1 -1
- package/dist/vuukleBidAdapter.js +1 -1
- package/dist/widespaceBidAdapter.js +1 -1
- package/dist/winrBidAdapter.js +1 -1
- package/dist/yahoosspBidAdapter.js +1 -1
- package/dist/yieldmoBidAdapter.js +1 -1
- package/dist/yieldoneAnalyticsAdapter.js +1 -1
- package/integrationExamples/videoModule/jwplayer/bidMarkedAsUsed.html +98 -0
- package/integrationExamples/videoModule/jwplayer/bidRequestScheduling.html +89 -0
- package/integrationExamples/videoModule/jwplayer/eventListeners.html +244 -0
- package/integrationExamples/videoModule/jwplayer/gamAdServerMediation.html +122 -0
- package/integrationExamples/videoModule/jwplayer/mediaMetadata.html +80 -0
- package/integrationExamples/videoModule/jwplayer/playlist.html +122 -0
- package/integrationExamples/videoModule/videojs/bidMarkedAsUsed.html +126 -0
- package/integrationExamples/videoModule/videojs/bidRequestScheduling.html +132 -0
- package/integrationExamples/videoModule/videojs/eventListeners.html +238 -0
- package/integrationExamples/videoModule/videojs/gamAdServerMediation.html +138 -0
- package/integrationExamples/videoModule/videojs/mediaMetadata.html +103 -0
- package/integrationExamples/videoModule/videojs/playlist.html +151 -0
- package/libraries/ortbConverter/README.md +378 -0
- package/libraries/ortbConverter/converter.js +135 -0
- package/libraries/ortbConverter/lib/composer.js +43 -0
- package/libraries/ortbConverter/lib/mergeProcessors.js +9 -0
- package/libraries/ortbConverter/lib/sizes.js +14 -0
- package/libraries/ortbConverter/processors/banner.js +40 -0
- package/libraries/ortbConverter/processors/default.js +167 -0
- package/libraries/ortbConverter/processors/mediaType.js +21 -0
- package/libraries/ortbConverter/processors/native.js +37 -0
- package/libraries/ortbConverter/processors/video.js +66 -0
- package/libraries/pbsExtensions/pbsExtensions.js +12 -0
- package/libraries/pbsExtensions/processors/aliases.js +17 -0
- package/libraries/pbsExtensions/processors/mediaType.js +23 -0
- package/libraries/pbsExtensions/processors/params.js +22 -0
- package/libraries/pbsExtensions/processors/pbs.js +99 -0
- package/libraries/pbsExtensions/processors/requestExtPrebid.js +30 -0
- package/libraries/pbsExtensions/processors/video.js +23 -0
- package/libraries/video/constants/enums.js +5 -0
- package/libraries/video/constants/events.js +97 -0
- package/libraries/video/constants/ortb.js +169 -0
- package/libraries/video/constants/vendorCodes.js +6 -0
- package/libraries/video/shared/eventHandler.js +18 -0
- package/libraries/video/shared/parentModule.js +82 -0
- package/libraries/video/shared/state.js +47 -0
- package/libraries/video/shared/vastXmlBuilder.js +77 -0
- package/libraries/video/shared/vastXmlEditor.js +115 -0
- package/modules/.submodules.json +6 -1
- package/modules/aaxBlockmeterRtdProvider.js +59 -0
- package/modules/aaxBlockmeterRtdProvider.md +48 -0
- package/modules/appnexusBidAdapter.js +38 -1
- package/modules/chtnwBidAdapter.js +110 -0
- package/modules/chtnwBidAdapter.md +31 -0
- package/modules/concertBidAdapter.js +44 -2
- package/modules/consentManagement.js +22 -1
- package/modules/consentManagementUsp.js +29 -7
- package/modules/criteoBidAdapter.js +25 -5
- package/modules/currency.js +9 -0
- package/modules/dgkeywordRtdProvider.js +3 -3
- package/modules/gridNMBidAdapter.js +10 -14
- package/modules/improvedigitalBidAdapter.js +191 -470
- package/modules/ixBidAdapter.js +24 -64
- package/modules/jwplayerVideoProvider.js +929 -0
- package/modules/jwplayerVideoProvider.md +25 -0
- package/modules/kargoBidAdapter.js +1 -1
- package/modules/multibid/index.js +12 -0
- package/modules/openxOrtbBidAdapter.js +120 -275
- package/modules/oxxionRtdProvider.js +119 -0
- package/modules/oxxionRtdProvider.md +48 -0
- package/modules/prebidServerBidAdapter/index.js +19 -716
- package/modules/prebidServerBidAdapter/ortbConverter.js +274 -0
- package/modules/priceFloors.js +73 -1
- package/modules/rtdModule/index.js +22 -1
- package/modules/schain.js +24 -1
- package/modules/spotxBidAdapter.js +16 -15
- package/modules/synacormediaBidAdapter.js +1 -1
- package/modules/teadsIdSystem.js +5 -0
- package/modules/userId/index.js +64 -6
- package/modules/videoModule/addingSubmodule.md +521 -0
- package/modules/videoModule/coreVideo.js +234 -0
- package/modules/videoModule/gamAdServerSubmodule.js +27 -0
- package/modules/videoModule/index.js +244 -0
- package/modules/videoModule/videoImpressionVerifier.js +206 -0
- package/modules/videojsVideoProvider.js +854 -0
- package/modules/videojsVideoProvider.md +17 -0
- package/package.json +5 -1
- package/src/adapterManager.js +56 -7
- package/src/adloader.js +2 -1
- package/src/auction.js +5 -0
- package/src/events.js +5 -1
- package/src/pbjsORTB.js +35 -0
- package/src/prebid.js +137 -112
- package/src/targeting.js +10 -2
- package/src/utils/currency.js +16 -0
- package/src/utils.js +21 -0
- package/test/spec/auctionmanager_spec.js +6 -0
- package/test/spec/modules/aaxBlockmeter_spec.js +58 -0
- package/test/spec/modules/chtnwBidAdapter_spec.js +105 -0
- package/test/spec/modules/concertBidAdapter_spec.js +56 -0
- package/test/spec/modules/consentManagementUsp_spec.js +64 -18
- package/test/spec/modules/criteoBidAdapter_spec.js +28 -0
- package/test/spec/modules/dgkeywordRtdProvider_spec.js +3 -3
- package/test/spec/modules/improvedigitalBidAdapter_spec.js +231 -211
- package/test/spec/modules/ixBidAdapter_spec.js +230 -371
- package/test/spec/modules/openxOrtbBidAdapter_spec.js +77 -49
- package/test/spec/modules/oxxionRtdProvider_spec.js +142 -0
- package/test/spec/modules/prebidServerBidAdapter_spec.js +139 -137
- package/test/spec/modules/realTimeDataModule_spec.js +65 -0
- package/test/spec/modules/userId_spec.js +67 -1
- package/test/spec/modules/videoModule/coreVideo_spec.js +98 -0
- package/test/spec/modules/videoModule/pbVideo_spec.js +362 -0
- package/test/spec/modules/videoModule/shared/parentModule_spec.js +73 -0
- package/test/spec/modules/videoModule/shared/state_spec.js +26 -0
- package/test/spec/modules/videoModule/shared/vastXmlBuilder_spec.js +103 -0
- package/test/spec/modules/videoModule/shared/vastXmlEditor_spec.js +209 -0
- package/test/spec/modules/videoModule/submodules/jwplayerVideoProvider_spec.js +846 -0
- package/test/spec/modules/videoModule/submodules/videojsVideoProvider_spec.js +391 -0
- package/test/spec/modules/videoModule/videoImpressionVerifier_spec.js +112 -0
- package/test/spec/ortbConverter/banner_spec.js +203 -0
- package/test/spec/ortbConverter/composer_spec.js +69 -0
- package/test/spec/ortbConverter/converter_spec.js +283 -0
- package/test/spec/ortbConverter/currency_spec.js +40 -0
- package/test/spec/ortbConverter/default_processors_spec.js +61 -0
- package/test/spec/ortbConverter/gdpr_spec.js +38 -0
- package/test/spec/ortbConverter/mediaTypes_spec.js +67 -0
- package/test/spec/ortbConverter/mergeProcessors_spec.js +59 -0
- package/test/spec/ortbConverter/multibid_spec.js +35 -0
- package/test/spec/ortbConverter/native_spec.js +95 -0
- package/test/spec/ortbConverter/pbjsORTB_spec.js +67 -0
- package/test/spec/ortbConverter/pbsExtensions/aliases_spec.js +57 -0
- package/test/spec/ortbConverter/pbsExtensions/params_spec.js +96 -0
- package/test/spec/ortbConverter/pbsExtensions/video_spec.js +52 -0
- package/test/spec/ortbConverter/priceFloors_spec.js +143 -0
- package/test/spec/ortbConverter/schain_spec.js +33 -0
- package/test/spec/ortbConverter/userId_spec.js +21 -0
- package/test/spec/ortbConverter/usp_spec.js +15 -0
- package/test/spec/ortbConverter/video_spec.js +189 -0
- package/test/spec/unit/core/adapterManager_spec.js +102 -0
- package/test/spec/unit/core/targeting_spec.js +34 -0
- package/test/spec/unit/pbjs_api_spec.js +124 -45
- package/test/spec/utils_spec.js +45 -1
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import { expect } from 'chai';
|
|
2
|
+
import { spec } from '../../../modules/chtnwBidAdapter.js';
|
|
3
|
+
import * as utils from '../../../src/utils.js';
|
|
4
|
+
|
|
5
|
+
describe('ChtnwAdapter', function () {
|
|
6
|
+
describe('isBidRequestValid', function () {
|
|
7
|
+
const bid = {
|
|
8
|
+
code: 'adunit-code',
|
|
9
|
+
bidder: 'chtnw',
|
|
10
|
+
params: {
|
|
11
|
+
placementId: '38EL412LO82XR9O6'
|
|
12
|
+
},
|
|
13
|
+
sizes: [
|
|
14
|
+
[300, 250]
|
|
15
|
+
],
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
it('should return true when required params found', function () {
|
|
19
|
+
const bidRequest = utils.deepClone(bid);
|
|
20
|
+
expect(spec.isBidRequestValid(bidRequest)).to.equal(true);
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
it('should return false when required params are missing', function () {
|
|
24
|
+
const bidRequest = utils.deepClone(bid);
|
|
25
|
+
delete bidRequest.params;
|
|
26
|
+
expect(spec.isBidRequestValid(bidRequest)).to.equal(false);
|
|
27
|
+
});
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
describe('buildRequests', function () {
|
|
31
|
+
let bidRequests = [{
|
|
32
|
+
code: 'adunit-code',
|
|
33
|
+
bidder: 'chtnw',
|
|
34
|
+
params: {
|
|
35
|
+
placementId: '38EL412LO82XR9O6'
|
|
36
|
+
},
|
|
37
|
+
sizes: [
|
|
38
|
+
[300, 250]
|
|
39
|
+
],
|
|
40
|
+
}];
|
|
41
|
+
|
|
42
|
+
const request = spec.buildRequests(bidRequests);
|
|
43
|
+
|
|
44
|
+
it('Returns POST method', function () {
|
|
45
|
+
expect(request.method).to.equal('POST');
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
it('Returns general data valid', function () {
|
|
49
|
+
let data = request.data;
|
|
50
|
+
expect(data).to.be.an('object');
|
|
51
|
+
expect(data).to.have.property('bids');
|
|
52
|
+
expect(data).to.have.property('uuid');
|
|
53
|
+
expect(data).to.have.property('device');
|
|
54
|
+
expect(data).to.have.property('site');
|
|
55
|
+
});
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
describe('interpretResponse', function () {
|
|
59
|
+
let responseBody = [{
|
|
60
|
+
'requestId': 'test',
|
|
61
|
+
'cpm': 0.5,
|
|
62
|
+
'currency': 'USD',
|
|
63
|
+
'width': 300,
|
|
64
|
+
'height': 250,
|
|
65
|
+
'netRevenue': true,
|
|
66
|
+
'ttl': 60,
|
|
67
|
+
'creativeId': 'AD',
|
|
68
|
+
'ad': '<h1>AD<h1>',
|
|
69
|
+
'mediaType': 'banner',
|
|
70
|
+
'meta': {
|
|
71
|
+
'advertiserDomains': [
|
|
72
|
+
'www.example.com'
|
|
73
|
+
]
|
|
74
|
+
}
|
|
75
|
+
}];
|
|
76
|
+
|
|
77
|
+
it('handles empty bid response', function () {
|
|
78
|
+
let response = {
|
|
79
|
+
body: responseBody
|
|
80
|
+
};
|
|
81
|
+
let result = spec.interpretResponse(response);
|
|
82
|
+
expect(result.length).to.not.equal(0);
|
|
83
|
+
expect(result[0].meta.advertiserDomains).to.be.an('array');
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
it('handles empty bid response', function () {
|
|
87
|
+
let response = {
|
|
88
|
+
body: []
|
|
89
|
+
};
|
|
90
|
+
let result = spec.interpretResponse(response);
|
|
91
|
+
expect(result.length).to.equal(0);
|
|
92
|
+
});
|
|
93
|
+
});
|
|
94
|
+
|
|
95
|
+
describe('getUserSyncs', function () {
|
|
96
|
+
it('should register type is image', function () {
|
|
97
|
+
const syncOptions = {
|
|
98
|
+
'pixelEnabled': 'true'
|
|
99
|
+
}
|
|
100
|
+
let userSync = spec.getUserSyncs(syncOptions);
|
|
101
|
+
expect(userSync[0].type).to.equal('image');
|
|
102
|
+
expect(userSync[0].url).to.have.string('ssp');
|
|
103
|
+
});
|
|
104
|
+
});
|
|
105
|
+
});
|
|
@@ -7,11 +7,33 @@ describe('ConcertAdapter', function () {
|
|
|
7
7
|
let bidRequests;
|
|
8
8
|
let bidRequest;
|
|
9
9
|
let bidResponse;
|
|
10
|
+
let element;
|
|
11
|
+
let sandbox;
|
|
10
12
|
|
|
11
13
|
afterEach(function () {
|
|
12
14
|
$$PREBID_GLOBAL$$.bidderSettings = {};
|
|
15
|
+
sandbox.restore();
|
|
13
16
|
});
|
|
17
|
+
|
|
14
18
|
beforeEach(function () {
|
|
19
|
+
element = {
|
|
20
|
+
x: 0,
|
|
21
|
+
y: 0,
|
|
22
|
+
width: 0,
|
|
23
|
+
height: 0,
|
|
24
|
+
getBoundingClientRect: () => {
|
|
25
|
+
return {
|
|
26
|
+
width: element.width,
|
|
27
|
+
height: element.height,
|
|
28
|
+
|
|
29
|
+
left: element.x,
|
|
30
|
+
top: element.y,
|
|
31
|
+
right: element.x + element.width,
|
|
32
|
+
bottom: element.y + element.height
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
|
|
15
37
|
$$PREBID_GLOBAL$$.bidderSettings = {
|
|
16
38
|
concert: {
|
|
17
39
|
storageAllowed: true
|
|
@@ -56,6 +78,9 @@ describe('ConcertAdapter', function () {
|
|
|
56
78
|
]
|
|
57
79
|
}
|
|
58
80
|
}
|
|
81
|
+
|
|
82
|
+
sandbox = sinon.sandbox.create();
|
|
83
|
+
sandbox.stub(document, 'getElementById').withArgs('desktop_leaderboard_variable').returns(element)
|
|
59
84
|
});
|
|
60
85
|
|
|
61
86
|
describe('spec.isBidRequestValid', function() {
|
|
@@ -119,6 +144,37 @@ describe('ConcertAdapter', function () {
|
|
|
119
144
|
|
|
120
145
|
expect(payload.meta.uid).to.equal('foo');
|
|
121
146
|
});
|
|
147
|
+
|
|
148
|
+
it('should add uid2 to eids list if available', function() {
|
|
149
|
+
bidRequests[0].userId = { uid2: { id: 'uid123' } }
|
|
150
|
+
|
|
151
|
+
const request = spec.buildRequests(bidRequests, bidRequest);
|
|
152
|
+
const payload = JSON.parse(request.data);
|
|
153
|
+
const meta = payload.meta
|
|
154
|
+
|
|
155
|
+
expect(meta.eids.length).to.equal(1);
|
|
156
|
+
expect(meta.eids[0].uids[0].id).to.equal('uid123')
|
|
157
|
+
expect(meta.eids[0].uids[0].atype).to.equal(3)
|
|
158
|
+
})
|
|
159
|
+
|
|
160
|
+
it('should return empty eids list if none are available', function() {
|
|
161
|
+
bidRequests[0].userId = { testId: { id: 'uid123' } }
|
|
162
|
+
const request = spec.buildRequests(bidRequests, bidRequest);
|
|
163
|
+
const payload = JSON.parse(request.data);
|
|
164
|
+
const meta = payload.meta
|
|
165
|
+
|
|
166
|
+
expect(meta.eids.length).to.equal(0);
|
|
167
|
+
});
|
|
168
|
+
|
|
169
|
+
it('should return x/y offset coordiantes when element is present', function() {
|
|
170
|
+
Object.assign(element, { x: 100, y: 0, width: 400, height: 400 })
|
|
171
|
+
const request = spec.buildRequests(bidRequests, bidRequest);
|
|
172
|
+
const payload = JSON.parse(request.data);
|
|
173
|
+
const slot = payload.slots[0];
|
|
174
|
+
|
|
175
|
+
expect(slot.offsetCoordinates.x).to.equal(100)
|
|
176
|
+
expect(slot.offsetCoordinates.y).to.equal(0)
|
|
177
|
+
})
|
|
122
178
|
});
|
|
123
179
|
|
|
124
180
|
describe('spec.interpretResponse', function() {
|
|
@@ -8,8 +8,9 @@ import {
|
|
|
8
8
|
} from 'modules/consentManagementUsp.js';
|
|
9
9
|
import * as utils from 'src/utils.js';
|
|
10
10
|
import { config } from 'src/config.js';
|
|
11
|
-
import {uspDataHandler} from 'src/adapterManager.js';
|
|
11
|
+
import adapterManager, {uspDataHandler} from 'src/adapterManager.js';
|
|
12
12
|
import 'src/prebid.js';
|
|
13
|
+
import {defer} from '../../../src/utils/promise.js';
|
|
13
14
|
|
|
14
15
|
let expect = require('chai').expect;
|
|
15
16
|
|
|
@@ -23,6 +24,16 @@ function createIFrameMarker() {
|
|
|
23
24
|
}
|
|
24
25
|
|
|
25
26
|
describe('consentManagement', function () {
|
|
27
|
+
let sandbox;
|
|
28
|
+
beforeEach(() => {
|
|
29
|
+
sandbox = sinon.sandbox.create();
|
|
30
|
+
sandbox.stub(adapterManager, 'callDataDeletionRequest');
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
afterEach(() => {
|
|
34
|
+
sandbox.restore();
|
|
35
|
+
});
|
|
36
|
+
|
|
26
37
|
it('should enable itself on requestBids using default values', (done) => {
|
|
27
38
|
requestBidsHook(() => {
|
|
28
39
|
expect(uspDataHandler.enabled).to.be.true;
|
|
@@ -301,8 +312,11 @@ describe('consentManagement', function () {
|
|
|
301
312
|
describe('USPAPI workflow for iframed page', function () {
|
|
302
313
|
let ifr = null;
|
|
303
314
|
let stringifyResponse = false;
|
|
315
|
+
let mockApi, replySent;
|
|
304
316
|
|
|
305
317
|
beforeEach(function () {
|
|
318
|
+
mockApi = sinon.stub();
|
|
319
|
+
replySent = defer();
|
|
306
320
|
sinon.stub(utils, 'logError');
|
|
307
321
|
sinon.stub(utils, 'logWarn');
|
|
308
322
|
ifr = createIFrameMarker();
|
|
@@ -322,17 +336,21 @@ describe('consentManagement', function () {
|
|
|
322
336
|
|
|
323
337
|
function uspapiMessageHandler(event) {
|
|
324
338
|
if (event && event.data) {
|
|
325
|
-
|
|
339
|
+
const data = event.data;
|
|
326
340
|
if (data.__uspapiCall) {
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
341
|
+
const {command, version, callId} = data.__uspapiCall;
|
|
342
|
+
let response = mockApi(command, version, callId);
|
|
343
|
+
if (response) {
|
|
344
|
+
response = {
|
|
345
|
+
__uspapiReturn: {
|
|
346
|
+
callId,
|
|
347
|
+
returnValue: response,
|
|
348
|
+
success: true
|
|
349
|
+
}
|
|
333
350
|
}
|
|
334
|
-
|
|
335
|
-
|
|
351
|
+
event.source.postMessage(stringifyResponse ? JSON.stringify(response) : response, '*');
|
|
352
|
+
replySent.resolve();
|
|
353
|
+
}
|
|
336
354
|
}
|
|
337
355
|
}
|
|
338
356
|
}
|
|
@@ -345,6 +363,11 @@ describe('consentManagement', function () {
|
|
|
345
363
|
function testIFramedPage(testName, messageFormatString) {
|
|
346
364
|
it(`should return the consent string from a postmessage + addEventListener response - ${testName}`, (done) => {
|
|
347
365
|
stringifyResponse = messageFormatString;
|
|
366
|
+
mockApi.callsFake((cmd) => {
|
|
367
|
+
if (cmd === 'getUSPData') {
|
|
368
|
+
return { uspString: '1YY' }
|
|
369
|
+
}
|
|
370
|
+
})
|
|
348
371
|
setConsentConfig(goodConfig);
|
|
349
372
|
requestBidsHook(() => {
|
|
350
373
|
let consent = uspDataHandler.getConsentData();
|
|
@@ -355,6 +378,20 @@ describe('consentManagement', function () {
|
|
|
355
378
|
}, {});
|
|
356
379
|
});
|
|
357
380
|
}
|
|
381
|
+
|
|
382
|
+
it('fires deletion request on registerDeletion', (done) => {
|
|
383
|
+
mockApi.callsFake((cmd) => {
|
|
384
|
+
return cmd === 'registerDeletion'
|
|
385
|
+
})
|
|
386
|
+
sinon.assert.notCalled(adapterManager.callDataDeletionRequest);
|
|
387
|
+
setConsentConfig(goodConfig);
|
|
388
|
+
replySent.promise.then(() => {
|
|
389
|
+
setTimeout(() => { // defer again to give time for the message to get through
|
|
390
|
+
sinon.assert.calledOnce(adapterManager.callDataDeletionRequest);
|
|
391
|
+
done()
|
|
392
|
+
}, 200)
|
|
393
|
+
})
|
|
394
|
+
});
|
|
358
395
|
});
|
|
359
396
|
|
|
360
397
|
describe('test without iframe locater', function() {
|
|
@@ -400,23 +437,19 @@ describe('consentManagement', function () {
|
|
|
400
437
|
});
|
|
401
438
|
|
|
402
439
|
describe('USPAPI workflow for normal pages:', function () {
|
|
403
|
-
let uspapiStub = sinon.stub();
|
|
404
440
|
let ifr = null;
|
|
405
441
|
|
|
406
442
|
beforeEach(function () {
|
|
407
443
|
didHookReturn = false;
|
|
408
444
|
ifr = createIFrameMarker();
|
|
409
|
-
|
|
410
|
-
|
|
445
|
+
sandbox.stub(utils, 'logError');
|
|
446
|
+
sandbox.stub(utils, 'logWarn');
|
|
411
447
|
window.__uspapi = function() {};
|
|
412
448
|
});
|
|
413
449
|
|
|
414
450
|
afterEach(function () {
|
|
415
451
|
config.resetConfig();
|
|
416
452
|
$$PREBID_GLOBAL$$.requestBids.removeAll();
|
|
417
|
-
uspapiStub.restore();
|
|
418
|
-
utils.logError.restore();
|
|
419
|
-
utils.logWarn.restore();
|
|
420
453
|
document.body.removeChild(ifr);
|
|
421
454
|
delete window.__uspapi;
|
|
422
455
|
resetConsentData();
|
|
@@ -427,7 +460,7 @@ describe('consentManagement', function () {
|
|
|
427
460
|
uspString: '1NY'
|
|
428
461
|
};
|
|
429
462
|
|
|
430
|
-
|
|
463
|
+
sandbox.stub(window, '__uspapi').callsFake((...args) => {
|
|
431
464
|
args[2](testConsentData, true);
|
|
432
465
|
});
|
|
433
466
|
|
|
@@ -448,7 +481,7 @@ describe('consentManagement', function () {
|
|
|
448
481
|
uspString: '1NY'
|
|
449
482
|
};
|
|
450
483
|
|
|
451
|
-
|
|
484
|
+
sandbox.stub(window, '__uspapi').callsFake((...args) => {
|
|
452
485
|
args[2](testConsentData, true);
|
|
453
486
|
});
|
|
454
487
|
|
|
@@ -463,6 +496,19 @@ describe('consentManagement', function () {
|
|
|
463
496
|
expect(consentMeta.usp).to.equal(testConsentData.uspString);
|
|
464
497
|
expect(consentMeta.generatedAt).to.be.above(1644367751709);
|
|
465
498
|
});
|
|
499
|
+
|
|
500
|
+
it('registers deletion request event listener', () => {
|
|
501
|
+
let listener;
|
|
502
|
+
sandbox.stub(window, '__uspapi').callsFake((cmd, _, cb) => {
|
|
503
|
+
if (cmd === 'registerDeletion') {
|
|
504
|
+
listener = cb;
|
|
505
|
+
}
|
|
506
|
+
});
|
|
507
|
+
setConsentConfig(goodConfig);
|
|
508
|
+
sinon.assert.notCalled(adapterManager.callDataDeletionRequest);
|
|
509
|
+
listener();
|
|
510
|
+
sinon.assert.calledOnce(adapterManager.callDataDeletionRequest);
|
|
511
|
+
})
|
|
466
512
|
});
|
|
467
513
|
});
|
|
468
514
|
});
|
|
@@ -1279,6 +1279,34 @@ describe('The Criteo bidding adapter', function () {
|
|
|
1279
1279
|
});
|
|
1280
1280
|
});
|
|
1281
1281
|
|
|
1282
|
+
it('should properly build a request with static floors', function () {
|
|
1283
|
+
const bidRequests = [
|
|
1284
|
+
{
|
|
1285
|
+
bidder: 'criteo',
|
|
1286
|
+
adUnitCode: 'bid-123',
|
|
1287
|
+
transactionId: 'transaction-123',
|
|
1288
|
+
mediaTypes: {
|
|
1289
|
+
banner: {
|
|
1290
|
+
sizes: [[300, 250], [728, 90]]
|
|
1291
|
+
}
|
|
1292
|
+
},
|
|
1293
|
+
params: {
|
|
1294
|
+
networkId: 456,
|
|
1295
|
+
bidFloor: 1,
|
|
1296
|
+
bidFloorCur: 'EUR'
|
|
1297
|
+
},
|
|
1298
|
+
},
|
|
1299
|
+
];
|
|
1300
|
+
const bidderRequest = {};
|
|
1301
|
+
const request = spec.buildRequests(bidRequests, bidderRequest);
|
|
1302
|
+
expect(request.data.slots[0].ext.floors).to.deep.equal({
|
|
1303
|
+
'banner': {
|
|
1304
|
+
'300x250': { 'currency': 'EUR', 'floor': 1 },
|
|
1305
|
+
'728x90': { 'currency': 'EUR', 'floor': 1 }
|
|
1306
|
+
}
|
|
1307
|
+
});
|
|
1308
|
+
});
|
|
1309
|
+
|
|
1282
1310
|
it('should properly build a video request with several player sizes with floors', function () {
|
|
1283
1311
|
const bidRequests = [
|
|
1284
1312
|
{
|
|
@@ -383,10 +383,11 @@ describe('Digital Garage Keyword Module', function () {
|
|
|
383
383
|
}
|
|
384
384
|
let moduleConfig = cloneDeep(DEF_CONFIG);
|
|
385
385
|
window.localStorage.setItem('ope_fpid', uuid);
|
|
386
|
+
moduleConfig.params.enableReadFpid = true;
|
|
386
387
|
dgRtd.getDgKeywordsAndSet(
|
|
387
388
|
pbjs,
|
|
388
389
|
() => {
|
|
389
|
-
const url = dgRtd.getProfileApiUrl(null);
|
|
390
|
+
const url = dgRtd.getProfileApiUrl(null, moduleConfig.params.enableReadFpid);
|
|
390
391
|
expect(url.indexOf(uuid) > 0).to.equal(true);
|
|
391
392
|
expect(url).to.equal(server.requests[0].url);
|
|
392
393
|
done();
|
|
@@ -410,11 +411,10 @@ describe('Digital Garage Keyword Module', function () {
|
|
|
410
411
|
}
|
|
411
412
|
let moduleConfig = cloneDeep(DEF_CONFIG);
|
|
412
413
|
window.localStorage.setItem('ope_fpid', uuid);
|
|
413
|
-
moduleConfig.params.disableReadFpid = true;
|
|
414
414
|
dgRtd.getDgKeywordsAndSet(
|
|
415
415
|
pbjs,
|
|
416
416
|
() => {
|
|
417
|
-
const url = dgRtd.getProfileApiUrl(null
|
|
417
|
+
const url = dgRtd.getProfileApiUrl(null);
|
|
418
418
|
expect(url.indexOf(uuid) > 0).to.equal(false);
|
|
419
419
|
expect(url).to.equal(server.requests[0].url);
|
|
420
420
|
done();
|