prebid.js 7.22.0 → 7.24.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/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/admaticBidAdapter.js +1 -0
- package/dist/adrelevantisBidAdapter.js +1 -1
- package/dist/adtrgtmeBidAdapter.js +1 -1
- package/dist/adxcgBidAdapter.js +1 -1
- package/dist/adyoulikeBidAdapter.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/audiencerunBidAdapter.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/bluebillywigBidAdapter.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/connectIdSystem.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/growthCodeIdSystem.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/impactifyBidAdapter.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/jixieBidAdapter.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/kueezRtbBidAdapter.js +1 -0
- 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/mediakeysBidAdapter.js +1 -1
- package/dist/mediasquareBidAdapter.js +1 -1
- package/dist/mgidBidAdapter.js +1 -1
- package/dist/mgidRtdProvider.js +1 -0
- package/dist/minutemediaBidAdapter.js +1 -1
- package/dist/multibid.js +1 -1
- package/dist/not-for-prod/prebid.js +153 -141
- 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/permutiveRtdProvider.js +1 -1
- 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/gpt/mgidRtdProvider_example.html +143 -0
- 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 +7 -1
- package/modules/aaxBlockmeterRtdProvider.js +59 -0
- package/modules/aaxBlockmeterRtdProvider.md +48 -0
- package/modules/admaticBidAdapter.js +147 -0
- package/modules/admaticBidAdapter.md +48 -0
- package/modules/amxBidAdapter.js +1 -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/connectIdSystem.js +36 -23
- package/modules/connectIdSystem.md +3 -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/growthCodeIdSystem.js +9 -5
- package/modules/gumgumBidAdapter.js +4 -0
- package/modules/improvedigitalBidAdapter.js +191 -470
- package/modules/ixBidAdapter.js +54 -71
- package/modules/jwplayerVideoProvider.js +929 -0
- package/modules/jwplayerVideoProvider.md +25 -0
- package/modules/kargoBidAdapter.js +1 -1
- package/modules/kueezRtbBidAdapter.js +278 -0
- package/modules/kueezRtbBidAdapter.md +35 -0
- package/modules/magniteAnalyticsAdapter.js +6 -1
- package/modules/mgidRtdProvider.js +190 -0
- package/modules/mgidRtdProvider.md +51 -0
- 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/permutiveRtdProvider.js +2 -1
- package/modules/permutiveRtdProvider.md +36 -1
- package/modules/prebidServerBidAdapter/index.js +19 -716
- package/modules/prebidServerBidAdapter/ortbConverter.js +274 -0
- package/modules/priceFloors.js +73 -1
- package/modules/pubmaticBidAdapter.js +21 -29
- 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/tripleliftBidAdapter.js +1 -1
- package/modules/userId/eids.js +3 -10
- 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 +12 -8
- package/src/adRendering.js +1 -1
- package/src/adapterManager.js +56 -7
- package/src/adloader.js +3 -1
- package/src/auction.js +6 -1
- 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 +15 -0
- package/test/spec/modules/aaxBlockmeter_spec.js +58 -0
- package/test/spec/modules/admaticBidAdapter_spec.js +46 -0
- package/test/spec/modules/chtnwBidAdapter_spec.js +105 -0
- package/test/spec/modules/concertBidAdapter_spec.js +56 -0
- package/test/spec/modules/connectIdSystem_spec.js +175 -5
- 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/eids_spec.js +10 -7
- package/test/spec/modules/ftrackIdSystem_spec.js +34 -22
- package/test/spec/modules/gumgumBidAdapter_spec.js +15 -0
- package/test/spec/modules/improvedigitalBidAdapter_spec.js +231 -211
- package/test/spec/modules/ixBidAdapter_spec.js +412 -350
- package/test/spec/modules/kueezRtbBidAdapter_spec.js +396 -0
- package/test/spec/modules/magniteAnalyticsAdapter_spec.js +26 -0
- package/test/spec/modules/mgidRtdProvider_spec.js +366 -0
- package/test/spec/modules/openxOrtbBidAdapter_spec.js +77 -49
- package/test/spec/modules/oxxionRtdProvider_spec.js +142 -0
- package/test/spec/modules/permutiveRtdProvider_spec.js +64 -5
- package/test/spec/modules/prebidServerBidAdapter_spec.js +139 -137
- package/test/spec/modules/realTimeDataModule_spec.js +65 -0
- package/test/spec/modules/tripleliftBidAdapter_spec.js +14 -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,95 @@
|
|
|
1
|
+
import {fillNativeImp, fillNativeResponse} from '../../../libraries/ortbConverter/processors/native.js';
|
|
2
|
+
import {BANNER, NATIVE} from '../../../src/mediaTypes.js';
|
|
3
|
+
|
|
4
|
+
describe('pbjs -> ortb native requests', () => {
|
|
5
|
+
function toNative(bidRequest, context) {
|
|
6
|
+
const imp = {};
|
|
7
|
+
fillNativeImp(imp, bidRequest, context);
|
|
8
|
+
return imp;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
it('should do nothing if request has no nativeOrtbRequest', () => {
|
|
12
|
+
expect(toNative({}, {})).to.eql({});
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
it('should set imp.native according to nativeOrtbRequest', () => {
|
|
16
|
+
const nativeOrtbRequest = {ver: 'version', prop: 'value', assets: [{}]};
|
|
17
|
+
const imp = toNative({nativeOrtbRequest}, {});
|
|
18
|
+
expect(imp.native.ver).to.eql('version');
|
|
19
|
+
expect(JSON.parse(imp.native.request)).to.eql(nativeOrtbRequest);
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
it('should do nothing if context.mediaType is set but is not NATIVE', () => {
|
|
23
|
+
expect(toNative({nativeOrtbRequest: {ver: 'version'}}, {mediaType: BANNER})).to.eql({})
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
it('should merge context.nativeRequest', () => {
|
|
27
|
+
const nativeOrtbRequest = {ver: 'version', eventtrackers: [{tracker: 'req'}], assets: [{}]};
|
|
28
|
+
const nativeDefaults = {eventtrackers: [{tracker: 'default'}], other: 'other'};
|
|
29
|
+
const imp = toNative({nativeOrtbRequest}, {nativeRequest: nativeDefaults});
|
|
30
|
+
expect(imp.native.ver).to.eql('version');
|
|
31
|
+
expect(JSON.parse(imp.native.request)).to.eql({
|
|
32
|
+
assets: [{}],
|
|
33
|
+
ver: 'version',
|
|
34
|
+
eventtrackers: [{tracker: 'req'}],
|
|
35
|
+
other: 'other'
|
|
36
|
+
});
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
it('should keep ortb2Imp.native', () => {
|
|
40
|
+
const imp = {
|
|
41
|
+
native: {
|
|
42
|
+
something: 'orother'
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
fillNativeImp(imp, {nativeOrtbRequest: {ver: 'version'}}, {});
|
|
46
|
+
expect(imp.native.something).to.eql('orother')
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
it('should do nothing if there are no assets', () => {
|
|
50
|
+
const imp = {};
|
|
51
|
+
fillNativeImp(imp, {nativeOrtbRequest: {assets: []}}, {});
|
|
52
|
+
expect(imp).to.eql({});
|
|
53
|
+
})
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
describe('ortb -> ortb native response', () => {
|
|
57
|
+
const MOCK_NATIVE_RESPONSE = {
|
|
58
|
+
property: 'value',
|
|
59
|
+
assets: [
|
|
60
|
+
{
|
|
61
|
+
id: 0
|
|
62
|
+
}
|
|
63
|
+
]
|
|
64
|
+
}
|
|
65
|
+
Object.entries({
|
|
66
|
+
'serialized': JSON.stringify(MOCK_NATIVE_RESPONSE),
|
|
67
|
+
'an object': MOCK_NATIVE_RESPONSE
|
|
68
|
+
}).forEach(([t, adm]) => {
|
|
69
|
+
describe(`when adm is ${t}`, () => {
|
|
70
|
+
let bid;
|
|
71
|
+
beforeEach(() => {
|
|
72
|
+
bid = {adm};
|
|
73
|
+
})
|
|
74
|
+
it('should set bidResponse.native', () => {
|
|
75
|
+
const bidResponse = {
|
|
76
|
+
mediaType: NATIVE
|
|
77
|
+
};
|
|
78
|
+
fillNativeResponse(bidResponse, bid, {});
|
|
79
|
+
expect(bidResponse.native).to.eql({ortb: MOCK_NATIVE_RESPONSE});
|
|
80
|
+
});
|
|
81
|
+
});
|
|
82
|
+
it('should throw if response has no assets', () => {
|
|
83
|
+
expect(() => fillNativeResponse({mediaType: NATIVE}, {adm: {...MOCK_NATIVE_RESPONSE, assets: null}}, {})).to.throw;
|
|
84
|
+
})
|
|
85
|
+
it('should do nothing if bidResponse.mediaType is not NATIVE', () => {
|
|
86
|
+
const bidResponse = {
|
|
87
|
+
mediaType: BANNER
|
|
88
|
+
};
|
|
89
|
+
fillNativeResponse(bidResponse, {adm: MOCK_NATIVE_RESPONSE}, {});
|
|
90
|
+
expect(bidResponse).to.eql({
|
|
91
|
+
mediaType: BANNER
|
|
92
|
+
})
|
|
93
|
+
})
|
|
94
|
+
})
|
|
95
|
+
});
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import {
|
|
2
|
+
DEFAULT,
|
|
3
|
+
PBS,
|
|
4
|
+
PROCESSOR_TYPES,
|
|
5
|
+
processorRegistry,
|
|
6
|
+
REQUEST
|
|
7
|
+
} from '../../../src/pbjsORTB.js';
|
|
8
|
+
|
|
9
|
+
describe('pbjsORTB register / get processors', () => {
|
|
10
|
+
let registerOrtbProcessor, getProcessors;
|
|
11
|
+
beforeEach(() => {
|
|
12
|
+
({registerOrtbProcessor, getProcessors} = processorRegistry());
|
|
13
|
+
})
|
|
14
|
+
PROCESSOR_TYPES.forEach(type => {
|
|
15
|
+
it(`can get and set ${type} processors`, () => {
|
|
16
|
+
const proc = function () {};
|
|
17
|
+
registerOrtbProcessor({
|
|
18
|
+
type,
|
|
19
|
+
name: 'test',
|
|
20
|
+
fn: proc
|
|
21
|
+
});
|
|
22
|
+
expect(getProcessors(DEFAULT)).to.eql({
|
|
23
|
+
[type]: {
|
|
24
|
+
test: {
|
|
25
|
+
priority: 0,
|
|
26
|
+
fn: proc
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
});
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
it('throws on wrong type', () => {
|
|
34
|
+
expect(() => registerOrtbProcessor({
|
|
35
|
+
type: 'incorrect',
|
|
36
|
+
name: 'test',
|
|
37
|
+
fn: function () {}
|
|
38
|
+
})).to.throw();
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
it('can set priority', () => {
|
|
42
|
+
const proc = function () {};
|
|
43
|
+
registerOrtbProcessor({type: REQUEST, name: 'test', fn: proc, priority: 10});
|
|
44
|
+
expect(getProcessors(DEFAULT)).to.eql({
|
|
45
|
+
[REQUEST]: {
|
|
46
|
+
test: {
|
|
47
|
+
priority: 10,
|
|
48
|
+
fn: proc
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
})
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
it('can assign processors to specific dialects', () => {
|
|
55
|
+
const proc = function () {};
|
|
56
|
+
registerOrtbProcessor({type: REQUEST, name: 'test', fn: proc, dialects: [PBS]});
|
|
57
|
+
expect(getProcessors(DEFAULT)).to.eql({});
|
|
58
|
+
expect(getProcessors(PBS)).to.eql({
|
|
59
|
+
[REQUEST]: {
|
|
60
|
+
test: {
|
|
61
|
+
priority: 0,
|
|
62
|
+
fn: proc
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
})
|
|
66
|
+
});
|
|
67
|
+
});
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import {setRequestExtPrebidAliases} from '../../../../libraries/pbsExtensions/processors/aliases.js';
|
|
2
|
+
|
|
3
|
+
describe('PBS - ortb ext.prebid.aliases', () => {
|
|
4
|
+
let aliasRegistry, bidderRegistry;
|
|
5
|
+
|
|
6
|
+
function setAliases(bidderRequest) {
|
|
7
|
+
const req = {}
|
|
8
|
+
setRequestExtPrebidAliases(req, bidderRequest, {}, {
|
|
9
|
+
am: {
|
|
10
|
+
bidderRegistry,
|
|
11
|
+
aliasRegistry
|
|
12
|
+
}
|
|
13
|
+
});
|
|
14
|
+
return req;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
beforeEach(() => {
|
|
18
|
+
aliasRegistry = {};
|
|
19
|
+
bidderRegistry = {};
|
|
20
|
+
})
|
|
21
|
+
|
|
22
|
+
describe('has no effect if', () => {
|
|
23
|
+
it('bidder is not an alias', () => {
|
|
24
|
+
expect(setAliases({bidderCode: 'not-an-alias'})).to.eql({});
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
it('bidder sets skipPbsAliasing', () => {
|
|
28
|
+
aliasRegistry['alias'] = 'bidder';
|
|
29
|
+
bidderRegistry['alias'] = {
|
|
30
|
+
getSpec() {
|
|
31
|
+
return {
|
|
32
|
+
skipPbsAliasing: true
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
expect(setAliases({bidderCode: 'alias'})).to.eql({});
|
|
37
|
+
});
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
it('sets ext.prebid.aliases.BIDDER', () => {
|
|
41
|
+
aliasRegistry['alias'] = 'bidder';
|
|
42
|
+
bidderRegistry['alias'] = {
|
|
43
|
+
getSpec() {
|
|
44
|
+
return {}
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
expect(setAliases({bidderCode: 'alias'})).to.eql({
|
|
48
|
+
ext: {
|
|
49
|
+
prebid: {
|
|
50
|
+
aliases: {
|
|
51
|
+
alias: 'bidder'
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
})
|
|
56
|
+
});
|
|
57
|
+
})
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import {setImpBidParams} from '../../../../libraries/pbsExtensions/processors/params.js';
|
|
2
|
+
|
|
3
|
+
describe('pbjs -> ortb bid params to imp[].ext.prebid.BIDDER', () => {
|
|
4
|
+
let bidderRegistry, index, adUnit;
|
|
5
|
+
beforeEach(() => {
|
|
6
|
+
bidderRegistry = {};
|
|
7
|
+
adUnit = {code: 'mockAdUnit'};
|
|
8
|
+
index = {
|
|
9
|
+
getAdUnit() {
|
|
10
|
+
return adUnit;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
function setParams(bidRequest, context, deps = {}) {
|
|
16
|
+
const imp = {};
|
|
17
|
+
setImpBidParams(imp, bidRequest, context, Object.assign({bidderRegistry, index}, deps))
|
|
18
|
+
return imp;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
it('sets params in ext.prebid.bidder.BIDDER', () => {
|
|
22
|
+
expect(setParams({bidder: 'mockBidder', params: {a: 'param'}})).to.eql({
|
|
23
|
+
ext: {
|
|
24
|
+
prebid: {
|
|
25
|
+
bidder: {
|
|
26
|
+
mockBidder: {
|
|
27
|
+
a: 'param'
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
})
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
it('has no effect if bidRequest has no params', () => {
|
|
36
|
+
expect(setParams({bidder: 'mockBidder'})).to.eql({});
|
|
37
|
+
})
|
|
38
|
+
|
|
39
|
+
describe('when adapter provides transformBidParams', () => {
|
|
40
|
+
let transform, bidderRequest;
|
|
41
|
+
beforeEach(() => {
|
|
42
|
+
bidderRequest = {bidderCode: 'mockBidder'};
|
|
43
|
+
transform = sinon.stub().callsFake((p) => Object.assign({transformed: true}, p));
|
|
44
|
+
bidderRegistry.mockBidder = {
|
|
45
|
+
getSpec() {
|
|
46
|
+
return {
|
|
47
|
+
transformBidParams: transform
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
})
|
|
52
|
+
|
|
53
|
+
it('runs params through transform', () => {
|
|
54
|
+
expect(setParams({bidder: 'mockBidder', params: {a: 'param'}}, {bidderRequest})).to.eql({
|
|
55
|
+
ext: {
|
|
56
|
+
prebid: {
|
|
57
|
+
bidder: {
|
|
58
|
+
mockBidder: {
|
|
59
|
+
a: 'param',
|
|
60
|
+
transformed: true
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
it('runs through transform even if bid has no params', () => {
|
|
69
|
+
expect(setParams({bidder: 'mockBidder'}, {bidderRequest})).to.eql({
|
|
70
|
+
ext: {
|
|
71
|
+
prebid: {
|
|
72
|
+
bidder: {
|
|
73
|
+
mockBidder: {
|
|
74
|
+
transformed: true
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
})
|
|
80
|
+
})
|
|
81
|
+
|
|
82
|
+
it('by default, passes adUnit from index, bidderRequest from context', () => {
|
|
83
|
+
const params = {a: 'param'};
|
|
84
|
+
setParams({bidder: 'mockBidder', params}, {bidderRequest});
|
|
85
|
+
sinon.assert.calledWith(transform, params, true, adUnit, [bidderRequest])
|
|
86
|
+
});
|
|
87
|
+
|
|
88
|
+
it('uses provided adUnit, bidderRequests', () => {
|
|
89
|
+
const adUnit = {code: 'other-ad-unit'};
|
|
90
|
+
const bidderRequests = [{bidderCode: 'one'}, {bidderCode: 'two'}];
|
|
91
|
+
const params = {a: 'param'};
|
|
92
|
+
setParams({bidder: 'mockBidder', params}, {}, {adUnit, bidderRequests});
|
|
93
|
+
sinon.assert.calledWith(transform, params, true, adUnit, bidderRequests);
|
|
94
|
+
})
|
|
95
|
+
});
|
|
96
|
+
});
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import {setBidResponseVideoCache} from '../../../../libraries/pbsExtensions/processors/video.js';
|
|
2
|
+
|
|
3
|
+
describe('pbjs - ortb videoCacheKey based on ext.prebid', () => {
|
|
4
|
+
const EXT_PREBID_CACHE = {
|
|
5
|
+
ext: {
|
|
6
|
+
prebid: {
|
|
7
|
+
cache: {
|
|
8
|
+
vastXml: {
|
|
9
|
+
cacheId: 'id',
|
|
10
|
+
url: 'url'
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
function setCache(bid) {
|
|
18
|
+
const bidResponse = {mediaType: 'video'};
|
|
19
|
+
setBidResponseVideoCache(bidResponse, bid);
|
|
20
|
+
return bidResponse;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
it('has no effect if mediaType is not video', () => {
|
|
24
|
+
const resp = {mediaType: 'banner'};
|
|
25
|
+
setBidResponseVideoCache(resp, EXT_PREBID_CACHE);
|
|
26
|
+
expect(resp).to.eql({mediaType: 'banner'});
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
it('sets videoCacheKey, vastUrl from ext.prebid.cache.vastXml', () => {
|
|
30
|
+
sinon.assert.match(setCache(EXT_PREBID_CACHE), {
|
|
31
|
+
videoCacheKey: 'id',
|
|
32
|
+
vastUrl: 'url'
|
|
33
|
+
});
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
it('sets videoCacheKey, vastUrl from ext.prebid.targeting', () => {
|
|
37
|
+
sinon.assert.match(setCache({
|
|
38
|
+
ext: {
|
|
39
|
+
prebid: {
|
|
40
|
+
targeting: {
|
|
41
|
+
hb_uuid: 'id',
|
|
42
|
+
hb_cache_host: 'host',
|
|
43
|
+
hb_cache_path: '/path'
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}), {
|
|
48
|
+
vastUrl: 'https://host/path?uuid=id',
|
|
49
|
+
videoCacheKey: 'id'
|
|
50
|
+
})
|
|
51
|
+
});
|
|
52
|
+
});
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
import {config} from 'src/config.js';
|
|
2
|
+
import {setOrtbExtPrebidFloors, setOrtbImpBidFloor} from '../../../modules/priceFloors.js';
|
|
3
|
+
import 'src/prebid.js';
|
|
4
|
+
|
|
5
|
+
describe('pbjs - ortb imp floor params', () => {
|
|
6
|
+
before(() => {
|
|
7
|
+
config.resetConfig();
|
|
8
|
+
});
|
|
9
|
+
|
|
10
|
+
afterEach(() => {
|
|
11
|
+
config.resetConfig();
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
Object.entries({
|
|
15
|
+
'has no getFloor': {},
|
|
16
|
+
'has getFloor that throws': {
|
|
17
|
+
getFloor: sinon.stub().callsFake(() => { throw new Error() }),
|
|
18
|
+
},
|
|
19
|
+
'returns invalid floor': {
|
|
20
|
+
getFloor: sinon.stub().callsFake(() => ({floor: NaN, currency: null}))
|
|
21
|
+
}
|
|
22
|
+
}).forEach(([t, req]) => {
|
|
23
|
+
it(`has no effect if bid ${t}`, () => {
|
|
24
|
+
const imp = {};
|
|
25
|
+
setOrtbImpBidFloor(imp, {}, {});
|
|
26
|
+
expect(imp).to.eql({});
|
|
27
|
+
})
|
|
28
|
+
})
|
|
29
|
+
|
|
30
|
+
it('sets bidfoor and bidfloorcur according to getFloor', () => {
|
|
31
|
+
const imp = {};
|
|
32
|
+
const req = {
|
|
33
|
+
getFloor() {
|
|
34
|
+
return {
|
|
35
|
+
currency: 'EUR',
|
|
36
|
+
floor: '1.23'
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
setOrtbImpBidFloor(imp, req, {});
|
|
41
|
+
expect(imp).to.eql({
|
|
42
|
+
bidfloor: 1.23,
|
|
43
|
+
bidfloorcur: 'EUR'
|
|
44
|
+
})
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
Object.entries({
|
|
48
|
+
'missing currency': {floor: 1.23},
|
|
49
|
+
'missing floor': {currency: 'USD'},
|
|
50
|
+
'not a number': {floor: 'abc', currency: 'USD'}
|
|
51
|
+
}).forEach(([t, floor]) => {
|
|
52
|
+
it(`should not set bidfloor if floor is ${t}`, () => {
|
|
53
|
+
const imp = {};
|
|
54
|
+
const req = {
|
|
55
|
+
getFloor: () => floor
|
|
56
|
+
}
|
|
57
|
+
setOrtbImpBidFloor(imp, req, {});
|
|
58
|
+
expect(imp).to.eql({});
|
|
59
|
+
})
|
|
60
|
+
})
|
|
61
|
+
|
|
62
|
+
describe('asks for floor in currency', () => {
|
|
63
|
+
let req;
|
|
64
|
+
beforeEach(() => {
|
|
65
|
+
req = {
|
|
66
|
+
getFloor(opts) {
|
|
67
|
+
return {
|
|
68
|
+
floor: 1.23,
|
|
69
|
+
currency: opts.currency
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
})
|
|
74
|
+
|
|
75
|
+
it('from context.currency', () => {
|
|
76
|
+
const imp = {};
|
|
77
|
+
setOrtbImpBidFloor(imp, req, {currency: 'JPY'});
|
|
78
|
+
config.setConfig({
|
|
79
|
+
currency: {
|
|
80
|
+
adServerCurrency: 'EUR'
|
|
81
|
+
}
|
|
82
|
+
})
|
|
83
|
+
expect(imp.bidfloorcur).to.eql('JPY');
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
it('from config', () => {
|
|
87
|
+
const imp = {};
|
|
88
|
+
config.setConfig({
|
|
89
|
+
currency: {
|
|
90
|
+
adServerCurrency: 'EUR'
|
|
91
|
+
}
|
|
92
|
+
});
|
|
93
|
+
setOrtbImpBidFloor(imp, req, {});
|
|
94
|
+
expect(imp.bidfloorcur).to.eql('EUR');
|
|
95
|
+
});
|
|
96
|
+
|
|
97
|
+
it('defaults to USD', () => {
|
|
98
|
+
const imp = {};
|
|
99
|
+
setOrtbImpBidFloor(imp, req, {});
|
|
100
|
+
expect(imp.bidfloorcur).to.eql('USD');
|
|
101
|
+
})
|
|
102
|
+
});
|
|
103
|
+
|
|
104
|
+
it('asks for specific mediaType if context.mediaType is set', () => {
|
|
105
|
+
let reqMediaType;
|
|
106
|
+
const req = {
|
|
107
|
+
getFloor(opts) {
|
|
108
|
+
reqMediaType = opts.mediaType;
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
setOrtbImpBidFloor({}, req, {mediaType: 'banner'});
|
|
112
|
+
expect(reqMediaType).to.eql('banner');
|
|
113
|
+
})
|
|
114
|
+
});
|
|
115
|
+
|
|
116
|
+
describe('setOrtbExtPrebidFloors', () => {
|
|
117
|
+
before(() => {
|
|
118
|
+
config.setConfig({floors: {}});
|
|
119
|
+
})
|
|
120
|
+
after(() => {
|
|
121
|
+
config.setConfig({floors: {enabled: false}});
|
|
122
|
+
});
|
|
123
|
+
|
|
124
|
+
it('should set ext.prebid.floors.enabled to false', () => {
|
|
125
|
+
const req = {};
|
|
126
|
+
setOrtbExtPrebidFloors(req);
|
|
127
|
+
expect(req.ext.prebid.floors.enabled).to.equal(false);
|
|
128
|
+
})
|
|
129
|
+
|
|
130
|
+
it('should respect fpd', () => {
|
|
131
|
+
const req = {
|
|
132
|
+
ext: {
|
|
133
|
+
prebid: {
|
|
134
|
+
floors: {
|
|
135
|
+
enabled: true
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
setOrtbExtPrebidFloors(req);
|
|
141
|
+
expect(req.ext.prebid.floors.enabled).to.equal(true);
|
|
142
|
+
})
|
|
143
|
+
})
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import {setOrtbSourceExtSchain} from '../../../modules/schain.js';
|
|
2
|
+
|
|
3
|
+
describe('pbjs - ortb source.ext.schain', () => {
|
|
4
|
+
it('sets schain from request', () => {
|
|
5
|
+
const req = {};
|
|
6
|
+
setOrtbSourceExtSchain(req, {}, {
|
|
7
|
+
bidRequests: [{schain: {s: 'chain'}}]
|
|
8
|
+
});
|
|
9
|
+
expect(req.source.ext.schain).to.eql({s: 'chain'});
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
it('does not set it if missing', () => {
|
|
13
|
+
const req = {};
|
|
14
|
+
setOrtbSourceExtSchain(req, {}, {bidRequests: [{}]});
|
|
15
|
+
expect(req).to.eql({});
|
|
16
|
+
})
|
|
17
|
+
|
|
18
|
+
it('does not set it if already in request', () => {
|
|
19
|
+
const req = {
|
|
20
|
+
source: {
|
|
21
|
+
ext: {
|
|
22
|
+
schain: {s: 'chain'}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
setOrtbSourceExtSchain(req, {}, {
|
|
27
|
+
bidRequests: [{
|
|
28
|
+
schain: {other: 'chain'}
|
|
29
|
+
}]
|
|
30
|
+
});
|
|
31
|
+
expect(req.source.ext.schain).to.eql({s: 'chain'});
|
|
32
|
+
})
|
|
33
|
+
});
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import {setOrtbUserExtEids} from '../../../modules/userId/index.js';
|
|
2
|
+
|
|
3
|
+
describe('pbjs - ortb user eids', () => {
|
|
4
|
+
it('sets user.ext.eids from request', () => {
|
|
5
|
+
const req = {};
|
|
6
|
+
setOrtbUserExtEids(req, {}, {
|
|
7
|
+
bidRequests: [
|
|
8
|
+
{
|
|
9
|
+
userIdAsEids: {e: 'id'}
|
|
10
|
+
}
|
|
11
|
+
]
|
|
12
|
+
});
|
|
13
|
+
expect(req.user.ext.eids).to.eql({e: 'id'});
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
it('has no effect if requests have no eids', () => {
|
|
17
|
+
const req = {};
|
|
18
|
+
setOrtbUserExtEids(req, {}, [{}]);
|
|
19
|
+
expect(req).to.eql({});
|
|
20
|
+
})
|
|
21
|
+
})
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import {setOrtbUsp} from '../../../modules/consentManagementUsp.js';
|
|
2
|
+
|
|
3
|
+
describe('pbjs - ortb usp', () => {
|
|
4
|
+
it('sets regs.ext.us_privacy from bidderRequest', () => {
|
|
5
|
+
const req = {};
|
|
6
|
+
setOrtbUsp(req, {uspConsent: '1NN'});
|
|
7
|
+
expect(req.regs.ext.us_privacy).to.eql('1NN');
|
|
8
|
+
});
|
|
9
|
+
|
|
10
|
+
it('does not set if missing', () => {
|
|
11
|
+
const req = {};
|
|
12
|
+
setOrtbUsp(req, {});
|
|
13
|
+
expect(req).to.eql({});
|
|
14
|
+
});
|
|
15
|
+
})
|