prebid.js 7.34.0 → 7.35.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/devcontainer.json +2 -1
- package/.github/workflows/issue_tracker.yml +1 -1
- package/dist/33acrossBidAdapter.js +1 -1
- package/dist/33acrossIdSystem.js +1 -1
- 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/adyoulikeBidAdapter.js +1 -1
- package/dist/ajaBidAdapter.js +1 -1
- package/dist/amxBidAdapter.js +1 -1
- package/dist/amxIdSystem.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/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/carodaBidAdapter.js +1 -1
- package/dist/chtnwBidAdapter.js +1 -1
- package/dist/concertBidAdapter.js +1 -1
- package/dist/connectadBidAdapter.js +1 -1
- package/dist/consentManagement.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/cwireBidAdapter.js +1 -1
- package/dist/dspxBidAdapter.js +1 -1
- package/dist/eplanningBidAdapter.js +1 -1
- package/dist/feedadBidAdapter.js +1 -1
- package/dist/finativeBidAdapter.js +1 -1
- package/dist/glimpseBidAdapter.js +1 -1
- package/dist/gmosspBidAdapter.js +1 -1
- package/dist/goldbachBidAdapter.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/hadronIdSystem.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/ixBidAdapter.js +1 -1
- package/dist/justpremiumBidAdapter.js +1 -1
- package/dist/konduitAnalyticsAdapter.js +1 -1
- package/dist/kueezBidAdapter.js +1 -1
- package/dist/kueezRtbBidAdapter.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/nexx360BidAdapter.js +1 -1
- package/dist/not-for-prod/prebid.js +127 -137
- package/dist/oguryBidAdapter.js +1 -1
- package/dist/onetagBidAdapter.js +1 -1
- package/dist/ooloAnalyticsAdapter.js +1 -1
- package/dist/outbrainBidAdapter.js +1 -1
- package/dist/parrableIdSystem.js +1 -1
- package/dist/permutiveRtdProvider.js +1 -1
- package/dist/pixfutureBidAdapter.js +1 -1
- package/dist/prebid-core.js +1 -1
- package/dist/priceFloors.js +1 -1
- package/dist/publinkIdSystem.js +1 -1
- package/dist/pubmaticBidAdapter.js +1 -1
- package/dist/pubwiseAnalyticsAdapter.js +1 -1
- package/dist/pulsepointBidAdapter.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/rubiconAnalyticsAdapter.js +1 -1
- package/dist/rubiconBidAdapter.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/smartytechBidAdapter.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/sspBCBidAdapter.js +1 -1
- package/dist/sublimeBidAdapter.js +1 -1
- package/dist/synacormediaBidAdapter.js +1 -1
- package/dist/taboolaBidAdapter.js +1 -1
- package/dist/targetVideoBidAdapter.js +1 -1
- package/dist/teadsBidAdapter.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/uid2IdSystem.js +1 -1
- package/dist/underdogmediaBidAdapter.js +1 -1
- package/dist/undertoneBidAdapter.js +1 -1
- package/dist/vidazooBidAdapter.js +1 -1
- package/dist/videobyteBidAdapter.js +1 -1
- 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/dist/zeta_global_sspBidAdapter.js +1 -1
- package/dist/zeusPrimeRtdProvider.js +4 -14
- package/integrationExamples/gpt/hello_world.html +0 -0
- package/modules/adyoulikeBidAdapter.js +2 -0
- package/modules/consentManagement.js +33 -5
- package/modules/cwireBidAdapter.js +169 -242
- package/modules/cwireBidAdapter.md +15 -14
- package/modules/hadronIdSystem.js +37 -32
- package/modules/nexx360BidAdapter.js +1 -2
- package/modules/onetagBidAdapter.js +12 -1
- package/modules/outbrainBidAdapter.js +103 -6
- package/modules/permutiveRtdProvider.js +17 -12
- package/modules/priceFloors.js +7 -8
- package/modules/pulsepointBidAdapter.js +2 -0
- package/modules/smartadserverBidAdapter.js +39 -28
- package/modules/smartyadsBidAdapter.md +9 -0
- package/modules/smartytechBidAdapter.js +67 -10
- package/modules/smartytechBidAdapter.md +44 -33
- package/modules/sonobiBidAdapter.js +17 -10
- package/modules/taboolaBidAdapter.js +2 -1
- package/modules/vidazooBidAdapter.js +56 -22
- package/modules/zeta_global_sspBidAdapter.js +15 -0
- package/modules/zeusPrimeRtdProvider.js +3 -323
- package/modules/zeusPrimeRtdProvider.md +3 -0
- package/package.json +1 -1
- package/src/auction.js +2 -11
- package/src/prebid.js +8 -0
- package/src/utils/cpm.js +17 -0
- package/test/spec/modules/adyoulikeBidAdapter_spec.js +3 -0
- package/test/spec/modules/consentManagement_spec.js +49 -1
- package/test/spec/modules/cwireBidAdapter_spec.js +249 -335
- package/test/spec/modules/hadronIdSystem_spec.js +4 -6
- package/test/spec/modules/nexx360BidAdapter_spec.js +0 -4
- package/test/spec/modules/onetagBidAdapter_spec.js +43 -0
- package/test/spec/modules/outbrainBidAdapter_spec.js +182 -18
- package/test/spec/modules/pulsepointBidAdapter_spec.js +11 -1
- package/test/spec/modules/smartadserverBidAdapter_spec.js +116 -5
- package/test/spec/modules/smartytechBidAdapter_spec.js +172 -14
- package/test/spec/modules/sonobiBidAdapter_spec.js +2 -1
- package/test/spec/modules/taboolaBidAdapter_spec.js +12 -3
- package/test/spec/modules/userId_spec.js +19 -14
- package/test/spec/modules/vidazooBidAdapter_spec.js +61 -22
- package/test/spec/modules/zeta_global_sspBidAdapter_spec.js +8 -0
- package/test/spec/unit/pbjs_api_spec.js +14 -0
- package/test/spec/unit/utils/cpm_spec.js +64 -0
- package/test/spec/modules/zeusPrimeRtdProvider_spec.js +0 -410
|
@@ -1,382 +1,296 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
RENDERER_URL,
|
|
9
|
-
} from '../../../modules/cwireBidAdapter.js';
|
|
10
|
-
import * as prebidGlobal from 'src/prebidGlobal.js';
|
|
11
|
-
|
|
12
|
-
// ------------------------------------
|
|
13
|
-
// Bid Request Builder
|
|
14
|
-
// ------------------------------------
|
|
15
|
-
|
|
16
|
-
const BID_DEFAULTS = {
|
|
17
|
-
request: {
|
|
18
|
-
bidder: 'cwire',
|
|
19
|
-
auctionId: 'aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee',
|
|
20
|
-
transactionId: 'txaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee',
|
|
21
|
-
bidId: 'bid123445',
|
|
22
|
-
bidderRequestId: 'brid12345',
|
|
23
|
-
code: 'original-div',
|
|
24
|
-
},
|
|
25
|
-
params: {
|
|
26
|
-
placementId: 123456,
|
|
27
|
-
pageId: 777,
|
|
28
|
-
},
|
|
29
|
-
sizes: [[300, 250], [1, 1]],
|
|
30
|
-
};
|
|
31
|
-
|
|
32
|
-
const BidderRequestBuilder = function BidderRequestBuilder(options) {
|
|
33
|
-
const defaults = {
|
|
34
|
-
bidderCode: 'cwire',
|
|
35
|
-
auctionId: BID_DEFAULTS.request.auctionId,
|
|
36
|
-
bidderRequestId: BID_DEFAULTS.request.bidderRequestId,
|
|
37
|
-
transactionId: BID_DEFAULTS.request.transactionId,
|
|
38
|
-
timeout: 3000,
|
|
39
|
-
};
|
|
40
|
-
|
|
41
|
-
const request = {
|
|
42
|
-
...defaults,
|
|
43
|
-
...options
|
|
44
|
-
};
|
|
45
|
-
|
|
46
|
-
this.build = () => request;
|
|
47
|
-
};
|
|
48
|
-
|
|
49
|
-
const BidRequestBuilder = function BidRequestBuilder(options, deleteKeys) {
|
|
50
|
-
const defaults = JSON.parse(JSON.stringify(BID_DEFAULTS));
|
|
51
|
-
|
|
52
|
-
const request = {
|
|
53
|
-
...defaults.request,
|
|
54
|
-
...options
|
|
55
|
-
};
|
|
56
|
-
|
|
57
|
-
if (request && utils.isArray(deleteKeys)) {
|
|
58
|
-
deleteKeys.forEach((k) => {
|
|
59
|
-
delete request[k];
|
|
60
|
-
})
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
this.withParams = (options, deleteKeys) => {
|
|
64
|
-
request.params = {
|
|
65
|
-
...defaults.params,
|
|
66
|
-
...options
|
|
67
|
-
};
|
|
68
|
-
if (request && utils.isArray(deleteKeys)) {
|
|
69
|
-
deleteKeys.forEach((k) => {
|
|
70
|
-
delete request.params[k];
|
|
71
|
-
})
|
|
72
|
-
}
|
|
73
|
-
return this;
|
|
74
|
-
};
|
|
75
|
-
|
|
76
|
-
this.build = () => request;
|
|
77
|
-
};
|
|
1
|
+
import {expect} from 'chai';
|
|
2
|
+
import {newBidder} from '../../../src/adapters/bidderFactory';
|
|
3
|
+
import {BID_ENDPOINT, spec, storage} from '../../../modules/cwireBidAdapter';
|
|
4
|
+
import {deepClone, logInfo} from '../../../src/utils';
|
|
5
|
+
import * as utils from 'src/utils.js';
|
|
6
|
+
import {sandbox, stub} from 'sinon';
|
|
7
|
+
import {config} from '../../../src/config';
|
|
78
8
|
|
|
79
9
|
describe('C-WIRE bid adapter', () => {
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
10
|
+
config.setConfig({debug: true});
|
|
11
|
+
const adapter = newBidder(spec);
|
|
12
|
+
let bidRequests = [
|
|
13
|
+
{
|
|
14
|
+
'bidder': 'cwire',
|
|
15
|
+
'params': {
|
|
16
|
+
'pageId': '4057',
|
|
17
|
+
'placementId': 'ad-slot-bla'
|
|
18
|
+
},
|
|
19
|
+
'adUnitCode': 'adunit-code',
|
|
20
|
+
'sizes': [[300, 250], [300, 600]],
|
|
21
|
+
'bidId': '30b31c1838de1e',
|
|
22
|
+
'bidderRequestId': '22edbae2733bf6',
|
|
23
|
+
'auctionId': '1d1a030790a475',
|
|
24
|
+
'transactionId': '04f2659e-c005-4eb1-a57c-fa93145e3843'
|
|
25
|
+
}
|
|
26
|
+
];
|
|
27
|
+
const response = {
|
|
28
|
+
body: {
|
|
29
|
+
'cwid': '2ef90743-7936-4a82-8acf-e73382a64e94',
|
|
30
|
+
'hash': '17112D98BBF55D3A',
|
|
31
|
+
'bids': [{
|
|
32
|
+
'html': '<h1>Hello world</h1>',
|
|
33
|
+
'cpm': 100,
|
|
34
|
+
'currency': 'CHF',
|
|
35
|
+
'dimensions': [1, 1],
|
|
36
|
+
'netRevenue': true,
|
|
37
|
+
'creativeId': '3454',
|
|
38
|
+
'requestId': '2c634d4ca5ccfb',
|
|
39
|
+
'placementId': 177,
|
|
40
|
+
'transactionId': 'b4b32618-1350-4828-b6f0-fbb5c329e9a4',
|
|
41
|
+
'ttl': 360
|
|
42
|
+
}]
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
describe('inherited functions', function () {
|
|
46
|
+
it('exists and is a function', function () {
|
|
47
|
+
expect(adapter.callBids).to.exist.and.to.be.a('function');
|
|
48
|
+
expect(spec.isBidRequestValid).to.exist.and.to.be.a('function');
|
|
49
|
+
expect(spec.buildRequests).to.exist.and.to.be.a('function');
|
|
50
|
+
expect(spec.interpretResponse).to.exist.and.to.be.a('function');
|
|
51
|
+
});
|
|
84
52
|
});
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
53
|
+
describe('buildRequests', function () {
|
|
54
|
+
it('sends bid request to ENDPOINT via POST', function () {
|
|
55
|
+
const request = spec.buildRequests(bidRequests);
|
|
56
|
+
expect(request.url).to.equal(BID_ENDPOINT);
|
|
57
|
+
expect(request.method).to.equal('POST');
|
|
58
|
+
});
|
|
89
59
|
});
|
|
60
|
+
describe('buildRequests with given creative', function () {
|
|
61
|
+
let utilsStub;
|
|
90
62
|
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
expect(spec.isBidRequestValid(bid01)).to.equal(true);
|
|
63
|
+
before(function () {
|
|
64
|
+
utilsStub = stub(utils, 'getParameterByName').callsFake(function () {
|
|
65
|
+
return 'str-str'
|
|
66
|
+
});
|
|
96
67
|
});
|
|
97
68
|
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
delete bid01.params.placementId
|
|
101
|
-
expect(spec.isBidRequestValid(bid01)).to.equal(false);
|
|
69
|
+
after(function () {
|
|
70
|
+
utilsStub.restore();
|
|
102
71
|
});
|
|
103
72
|
|
|
104
|
-
it('should
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
73
|
+
it('should add creativeId if url parameter given', function () {
|
|
74
|
+
// set from bid.params
|
|
75
|
+
let bidRequest = deepClone(bidRequests[0]);
|
|
76
|
+
|
|
77
|
+
const request = spec.buildRequests([bidRequest]);
|
|
78
|
+
const payload = JSON.parse(request.data);
|
|
79
|
+
expect(payload.cwcreative).to.exist;
|
|
80
|
+
expect(payload.cwcreative).to.deep.equal('str-str');
|
|
81
|
+
});
|
|
82
|
+
})
|
|
83
|
+
|
|
84
|
+
describe('buildRequests reads adUnit offsetWidth and offsetHeight', function () {
|
|
85
|
+
before(function () {
|
|
86
|
+
const documentStub = sandbox.stub(document, 'getElementById');
|
|
87
|
+
documentStub.withArgs(`${bidRequests[0].adUnitCode}`).returns({
|
|
88
|
+
offsetWidth: 200,
|
|
89
|
+
offsetHeight: 250
|
|
90
|
+
});
|
|
109
91
|
});
|
|
92
|
+
it('width and height should be set', function () {
|
|
93
|
+
let bidRequest = deepClone(bidRequests[0]);
|
|
110
94
|
|
|
111
|
-
|
|
112
|
-
const
|
|
113
|
-
|
|
114
|
-
|
|
95
|
+
const request = spec.buildRequests([bidRequest]);
|
|
96
|
+
const payload = JSON.parse(request.data);
|
|
97
|
+
const el = document.getElementById(`${bidRequest.adUnitCode}`)
|
|
98
|
+
|
|
99
|
+
logInfo(JSON.stringify(payload))
|
|
100
|
+
|
|
101
|
+
expect(el).to.exist;
|
|
102
|
+
expect(payload.slots[0].cwExt.dimensions.width).to.equal(200);
|
|
103
|
+
expect(payload.slots[0].cwExt.dimensions.height).to.equal(250);
|
|
104
|
+
expect(payload.slots[0].cwExt.style.maxHeight).to.not.exist;
|
|
105
|
+
expect(payload.slots[0].cwExt.style.maxWidth).to.not.exist;
|
|
106
|
+
});
|
|
107
|
+
after(function () {
|
|
108
|
+
sandbox.restore()
|
|
109
|
+
});
|
|
110
|
+
});
|
|
111
|
+
describe('buildRequests reads style attributes', function () {
|
|
112
|
+
before(function () {
|
|
113
|
+
const documentStub = sandbox.stub(document, 'getElementById');
|
|
114
|
+
documentStub.withArgs(`${bidRequests[0].adUnitCode}`).returns({
|
|
115
|
+
style: {
|
|
116
|
+
maxWidth: '400px',
|
|
117
|
+
maxHeight: '350px',
|
|
118
|
+
}
|
|
119
|
+
});
|
|
115
120
|
});
|
|
121
|
+
it('css maxWidth should be set', function () {
|
|
122
|
+
let bidRequest = deepClone(bidRequests[0]);
|
|
123
|
+
|
|
124
|
+
const request = spec.buildRequests([bidRequest]);
|
|
125
|
+
const payload = JSON.parse(request.data);
|
|
126
|
+
const el = document.getElementById(`${bidRequest.adUnitCode}`)
|
|
127
|
+
|
|
128
|
+
logInfo(JSON.stringify(payload))
|
|
116
129
|
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
bid01.params.pageId = '3320';
|
|
121
|
-
expect(spec.isBidRequestValid(bid01)).to.equal(false);
|
|
130
|
+
expect(el).to.exist;
|
|
131
|
+
expect(payload.slots[0].cwExt.style.maxWidth).to.eq('400px');
|
|
132
|
+
!expect(payload.slots[0].cwExt.style.maxHeight).to.eq('350px');
|
|
122
133
|
});
|
|
134
|
+
after(function () {
|
|
135
|
+
sandbox.restore()
|
|
136
|
+
});
|
|
137
|
+
});
|
|
123
138
|
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
139
|
+
describe('buildRequests reads feature flags', function () {
|
|
140
|
+
before(function () {
|
|
141
|
+
sandbox.stub(utils, 'getParameterByName').callsFake(function () {
|
|
142
|
+
return 'feature1,feature2'
|
|
143
|
+
});
|
|
129
144
|
});
|
|
130
145
|
|
|
131
|
-
it('
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
146
|
+
it('read from url parameter', function () {
|
|
147
|
+
let bidRequest = deepClone(bidRequests[0]);
|
|
148
|
+
|
|
149
|
+
const request = spec.buildRequests([bidRequest]);
|
|
150
|
+
const payload = JSON.parse(request.data);
|
|
151
|
+
|
|
152
|
+
logInfo(JSON.stringify(payload))
|
|
153
|
+
|
|
154
|
+
expect(payload.featureFlags).to.exist;
|
|
155
|
+
expect(payload.featureFlags).to.include.members(['feature1', 'feature2']);
|
|
156
|
+
});
|
|
157
|
+
after(function () {
|
|
158
|
+
sandbox.restore()
|
|
135
159
|
});
|
|
136
160
|
});
|
|
137
161
|
|
|
138
|
-
describe('
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
sizes: [[1, 1]],
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
}).withParams({
|
|
147
|
-
cwcreative: '54321',
|
|
148
|
-
cwapikey: 'xxx-xxx-yyy-zzz-uuid',
|
|
149
|
-
refgroups: 'group_1',
|
|
150
|
-
}).build();
|
|
151
|
-
|
|
152
|
-
const bidderRequest01 = new BidderRequestBuilder().build();
|
|
153
|
-
|
|
154
|
-
const requests = spec.buildRequests([bid01], bidderRequest01);
|
|
155
|
-
|
|
156
|
-
expect(requests.data.slots.length).to.equal(1);
|
|
157
|
-
expect(requests.data.cwid).to.be.null;
|
|
158
|
-
expect(requests.data.cwid).to.be.null;
|
|
159
|
-
expect(requests.data.slots[0].sizes[0]).to.equal('1x1');
|
|
160
|
-
expect(requests.data.cwcreative).to.equal('54321');
|
|
161
|
-
expect(requests.data.cwapikey).to.equal('xxx-xxx-yyy-zzz-uuid');
|
|
162
|
-
expect(requests.data.refgroups[0]).to.equal('group_1');
|
|
162
|
+
describe('buildRequests reads cwgroups flag', function () {
|
|
163
|
+
before(function () {
|
|
164
|
+
sandbox.stub(utils, 'getParameterByName').callsFake(function () {
|
|
165
|
+
return 'group1,group2'
|
|
166
|
+
});
|
|
163
167
|
});
|
|
164
168
|
|
|
165
|
-
it('
|
|
166
|
-
|
|
169
|
+
it('read from url parameter', function () {
|
|
170
|
+
let bidRequest = deepClone(bidRequests[0]);
|
|
167
171
|
|
|
168
|
-
const
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
}).build();
|
|
179
|
-
|
|
180
|
-
const bidderRequest01 = new BidderRequestBuilder().build();
|
|
181
|
-
|
|
182
|
-
const requests = spec.buildRequests([bid01, bid02], bidderRequest01);
|
|
183
|
-
|
|
184
|
-
expect(requests.data.slots.length).to.equal(2);
|
|
185
|
-
expect(requests.data.cwid).to.be.null;
|
|
186
|
-
expect(requests.data.cwid).to.be.null;
|
|
187
|
-
expect(requests.data.cwcreative).to.equal('1234');
|
|
188
|
-
expect(requests.data.cwapikey).to.equal('api_key_5');
|
|
189
|
-
expect(requests.data.refgroups[0]).to.equal('group_5');
|
|
172
|
+
const request = spec.buildRequests([bidRequest]);
|
|
173
|
+
const payload = JSON.parse(request.data);
|
|
174
|
+
|
|
175
|
+
logInfo(JSON.stringify(payload))
|
|
176
|
+
|
|
177
|
+
expect(payload.refgroups).to.exist;
|
|
178
|
+
expect(payload.refgroups).to.include.members(['group1', 'group2']);
|
|
179
|
+
});
|
|
180
|
+
after(function () {
|
|
181
|
+
sandbox.restore()
|
|
190
182
|
});
|
|
183
|
+
})
|
|
191
184
|
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
refgroups: 'group_33',
|
|
198
|
-
}).build();
|
|
199
|
-
|
|
200
|
-
const bid02 = new BidRequestBuilder()
|
|
201
|
-
.withParams({
|
|
202
|
-
cwcreative: '1234',
|
|
203
|
-
cwapikey: 'api_key_5',
|
|
204
|
-
refgroups: 'group_5',
|
|
205
|
-
}).build();
|
|
206
|
-
|
|
207
|
-
const bidderRequest01 = new BidderRequestBuilder().build();
|
|
208
|
-
|
|
209
|
-
const requests = spec.buildRequests([bid01, bid02], bidderRequest01);
|
|
210
|
-
|
|
211
|
-
expect(requests.data.slots.length).to.equal(2);
|
|
212
|
-
expect(requests.data.cwid).to.be.null;
|
|
213
|
-
expect(requests.data.cwid).to.be.null;
|
|
214
|
-
expect(requests.data.cwcreative).to.equal('33');
|
|
215
|
-
expect(requests.data.cwapikey).to.equal('api_key_33');
|
|
216
|
-
expect(requests.data.refgroups[0]).to.equal('group_33');
|
|
185
|
+
describe('buildRequests reads debug flag', function () {
|
|
186
|
+
before(function () {
|
|
187
|
+
sandbox.stub(utils, 'getParameterByName').callsFake(function () {
|
|
188
|
+
return 'true'
|
|
189
|
+
});
|
|
217
190
|
});
|
|
218
191
|
|
|
219
|
-
it('
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
refgroups: 'group_5',
|
|
233
|
-
}).build();
|
|
234
|
-
const bidderRequest01 = new BidderRequestBuilder().build();
|
|
235
|
-
|
|
236
|
-
const requests = spec.buildRequests([bid01, bid02, bid03], bidderRequest01);
|
|
237
|
-
|
|
238
|
-
expect(requests.data.slots.length).to.equal(3);
|
|
239
|
-
expect(requests.data.cwid).to.be.null;
|
|
240
|
-
expect(requests.data.cwid).to.be.null;
|
|
241
|
-
expect(requests.data.cwcreative).to.equal('33');
|
|
242
|
-
expect(requests.data.cwapikey).to.equal('api_key_5');
|
|
243
|
-
expect(requests.data.refgroups[0]).to.equal('group_5');
|
|
192
|
+
it('read from url parameter', function () {
|
|
193
|
+
let bidRequest = deepClone(bidRequests[0]);
|
|
194
|
+
|
|
195
|
+
const request = spec.buildRequests([bidRequest]);
|
|
196
|
+
const payload = JSON.parse(request.data);
|
|
197
|
+
|
|
198
|
+
logInfo(JSON.stringify(payload))
|
|
199
|
+
|
|
200
|
+
expect(payload.debug).to.exist;
|
|
201
|
+
expect(payload.debug).to.equal(true);
|
|
202
|
+
});
|
|
203
|
+
after(function () {
|
|
204
|
+
sandbox.restore()
|
|
244
205
|
});
|
|
206
|
+
})
|
|
245
207
|
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
params.withArgs('cwcreative').returns('654321');
|
|
252
|
-
|
|
253
|
-
const bid01 = new BidRequestBuilder({
|
|
254
|
-
mediaTypes: {
|
|
255
|
-
banner: {
|
|
256
|
-
sizes: [[1, 1]],
|
|
257
|
-
}
|
|
258
|
-
}
|
|
259
|
-
}).withParams({
|
|
260
|
-
cwcreative: '54321',
|
|
261
|
-
cwapikey: 'xxx-xxx-yyy-zzz',
|
|
262
|
-
refgroups: 'group_1',
|
|
263
|
-
}).build();
|
|
264
|
-
|
|
265
|
-
const bidderRequest01 = new BidderRequestBuilder().build();
|
|
266
|
-
|
|
267
|
-
const requests = spec.buildRequests([bid01], bidderRequest01);
|
|
268
|
-
|
|
269
|
-
expect(requests.data.slots.length).to.equal(1);
|
|
270
|
-
expect(requests.data.cwid).to.be.null;
|
|
271
|
-
expect(requests.data.cwid).to.be.null;
|
|
272
|
-
expect(requests.data.slots[0].sizes[0]).to.equal('1x1');
|
|
273
|
-
expect(requests.data.cwcreative).to.equal('654321');
|
|
274
|
-
expect(requests.data.cwapikey).to.equal('xxx-xxx-yyy-zzz');
|
|
275
|
-
expect(requests.data.refgroups[0]).to.equal('group_2');
|
|
208
|
+
describe('buildRequests reads cw_id from Localstorage', function () {
|
|
209
|
+
before(function () {
|
|
210
|
+
sandbox.stub(storage, 'localStorageIsEnabled').callsFake(() => true);
|
|
211
|
+
sandbox.stub(storage, 'setDataInLocalStorage');
|
|
212
|
+
sandbox.stub(storage, 'getDataFromLocalStorage').callsFake((key) => 'taerfagerg');
|
|
276
213
|
});
|
|
277
214
|
|
|
278
|
-
it('
|
|
279
|
-
|
|
280
|
-
mediaTypes: {
|
|
281
|
-
banner: {
|
|
282
|
-
sizes: [[1, 1]],
|
|
283
|
-
}
|
|
284
|
-
}
|
|
285
|
-
}).withParams().build();
|
|
215
|
+
it('cw_id is set', function () {
|
|
216
|
+
let bidRequest = deepClone(bidRequests[0]);
|
|
286
217
|
|
|
287
|
-
const
|
|
218
|
+
const request = spec.buildRequests([bidRequest]);
|
|
219
|
+
const payload = JSON.parse(request.data);
|
|
288
220
|
|
|
289
|
-
|
|
221
|
+
logInfo(JSON.stringify(payload))
|
|
290
222
|
|
|
291
|
-
expect(
|
|
292
|
-
expect(
|
|
293
|
-
expect(requests.data.cwid).to.be.null;
|
|
294
|
-
expect(requests.data.slots[0].sizes[0]).to.equal('1x1');
|
|
295
|
-
expect(requests.data.cwcreative).to.equal(null);
|
|
296
|
-
expect(requests.data.cwapikey).to.equal(null);
|
|
297
|
-
expect(requests.data.refgroups.length).to.equal(0);
|
|
223
|
+
expect(payload.cwid).to.exist;
|
|
224
|
+
expect(payload.cwid).to.equal('taerfagerg');
|
|
298
225
|
});
|
|
299
|
-
|
|
226
|
+
after(function () {
|
|
227
|
+
sandbox.restore()
|
|
228
|
+
});
|
|
229
|
+
})
|
|
300
230
|
|
|
301
|
-
describe('
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
dimensions: [1, 1],
|
|
309
|
-
netRevenue: true,
|
|
310
|
-
creativeId: '1337',
|
|
311
|
-
requestId: BID_DEFAULTS.request.bidId,
|
|
312
|
-
ttl: 3500,
|
|
313
|
-
}],
|
|
314
|
-
}
|
|
315
|
-
};
|
|
316
|
-
|
|
317
|
-
const expectedResponse = [{
|
|
318
|
-
ad: JSON.parse(JSON.stringify(serverResponse.body.bids[0].html)),
|
|
319
|
-
bidderCode: BID_DEFAULTS.request.bidder,
|
|
320
|
-
cpm: JSON.parse(JSON.stringify(serverResponse.body.bids[0].cpm)),
|
|
321
|
-
creativeId: JSON.parse(JSON.stringify(serverResponse.body.bids[0].creativeId)),
|
|
322
|
-
currency: JSON.parse(JSON.stringify(serverResponse.body.bids[0].currency)),
|
|
323
|
-
height: JSON.parse(JSON.stringify(serverResponse.body.bids[0].dimensions[0])),
|
|
324
|
-
width: JSON.parse(JSON.stringify(serverResponse.body.bids[0].dimensions[1])),
|
|
325
|
-
netRevenue: JSON.parse(JSON.stringify(serverResponse.body.bids[0].netRevenue)),
|
|
326
|
-
requestId: JSON.parse(JSON.stringify(serverResponse.body.bids[0].requestId)),
|
|
327
|
-
ttl: JSON.parse(JSON.stringify(serverResponse.body.bids[0].ttl)),
|
|
328
|
-
meta: {
|
|
329
|
-
advertiserDomains: [],
|
|
330
|
-
},
|
|
331
|
-
mediaType: 'banner',
|
|
332
|
-
}]
|
|
333
|
-
|
|
334
|
-
it('correctly parses response', function () {
|
|
335
|
-
const bid01 = new BidRequestBuilder({
|
|
336
|
-
mediaTypes: {
|
|
337
|
-
banner: {
|
|
338
|
-
sizes: [[1, 1]],
|
|
339
|
-
}
|
|
340
|
-
}
|
|
341
|
-
}).withParams().build();
|
|
231
|
+
describe('buildRequests maps flattens params for legacy compat', function () {
|
|
232
|
+
before(function () {
|
|
233
|
+
const documentStub = sandbox.stub(document, 'getElementById');
|
|
234
|
+
documentStub.withArgs(`${bidRequests[0].adUnitCode}`).returns({});
|
|
235
|
+
});
|
|
236
|
+
it('pageId flattened', function () {
|
|
237
|
+
let bidRequest = deepClone(bidRequests[0]);
|
|
342
238
|
|
|
343
|
-
const
|
|
344
|
-
const
|
|
239
|
+
const request = spec.buildRequests([bidRequest]);
|
|
240
|
+
const payload = JSON.parse(request.data);
|
|
345
241
|
|
|
346
|
-
|
|
347
|
-
|
|
242
|
+
logInfo(JSON.stringify(payload))
|
|
243
|
+
|
|
244
|
+
expect(payload.slots[0].pageId).to.exist;
|
|
245
|
+
});
|
|
246
|
+
after(function () {
|
|
247
|
+
sandbox.restore()
|
|
348
248
|
});
|
|
249
|
+
})
|
|
349
250
|
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
}).withParams().build();
|
|
359
|
-
const bidderRequest01 = new BidderRequestBuilder().build();
|
|
251
|
+
describe('pageId and placementId are required params', function () {
|
|
252
|
+
it('invalid request', function () {
|
|
253
|
+
let bidRequest = deepClone(bidRequests[0]);
|
|
254
|
+
delete bidRequest.params
|
|
255
|
+
|
|
256
|
+
const valid = spec.isBidRequestValid(bidRequest);
|
|
257
|
+
expect(valid).to.be.false;
|
|
258
|
+
})
|
|
360
259
|
|
|
361
|
-
|
|
362
|
-
|
|
260
|
+
it('valid request', function () {
|
|
261
|
+
let bidRequest = deepClone(bidRequests[0]);
|
|
262
|
+
bidRequest.params.pageId = 42
|
|
263
|
+
bidRequest.params.placementId = 42
|
|
363
264
|
|
|
364
|
-
const
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
_expectedResponse[0].vastXml = JSON.parse(JSON.stringify(_serverResponse.body.bids[0].vastXml));
|
|
368
|
-
delete _expectedResponse[0].ad;
|
|
265
|
+
const valid = spec.isBidRequestValid(bidRequest);
|
|
266
|
+
expect(valid).to.be.true;
|
|
267
|
+
})
|
|
369
268
|
|
|
370
|
-
|
|
371
|
-
|
|
269
|
+
it('cwcreative must be of type string', function () {
|
|
270
|
+
let bidRequest = deepClone(bidRequests[0]);
|
|
271
|
+
bidRequest.params.pageId = 42
|
|
272
|
+
bidRequest.params.placementId = 42
|
|
372
273
|
|
|
373
|
-
const
|
|
374
|
-
expect(
|
|
375
|
-
|
|
376
|
-
expect(response[0].renderer.loaded).to.equals(false);
|
|
274
|
+
const valid = spec.isBidRequestValid(bidRequest);
|
|
275
|
+
expect(valid).to.be.true;
|
|
276
|
+
})
|
|
377
277
|
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
278
|
+
it('build request adds pageId', function () {
|
|
279
|
+
let bidRequest = deepClone(bidRequests[0]);
|
|
280
|
+
|
|
281
|
+
const request = spec.buildRequests([bidRequest]);
|
|
282
|
+
const payload = JSON.parse(request.data);
|
|
283
|
+
|
|
284
|
+
expect(payload.slots[0].pageId).to.exist;
|
|
285
|
+
})
|
|
286
|
+
});
|
|
287
|
+
|
|
288
|
+
describe('process serverResponse', function () {
|
|
289
|
+
it('html to ad mapping', function () {
|
|
290
|
+
let bidResponse = deepClone(response);
|
|
291
|
+
const bids = spec.interpretResponse(bidResponse, {});
|
|
292
|
+
|
|
293
|
+
expect(bids[0].ad).to.exist;
|
|
294
|
+
})
|
|
381
295
|
});
|
|
382
296
|
});
|
|
@@ -24,7 +24,7 @@ describe('HadronIdSystem', function () {
|
|
|
24
24
|
const request = server.requests[0];
|
|
25
25
|
expect(request.url).to.eq(`https://id.hadron.ad.gt/api/v1/pbhid?partner_id=0&_it=prebid`);
|
|
26
26
|
request.respond(200, { 'Content-Type': 'application/json' }, JSON.stringify({ hadronId: 'testHadronId1' }));
|
|
27
|
-
expect(callbackSpy.lastCall.lastArg).to.deep.equal({hadronId: 'testHadronId1'});
|
|
27
|
+
expect(callbackSpy.lastCall.lastArg).to.deep.equal({ id: { hadronId: 'testHadronId1' } });
|
|
28
28
|
});
|
|
29
29
|
|
|
30
30
|
it('gets a cached hadronid', function() {
|
|
@@ -33,10 +33,8 @@ describe('HadronIdSystem', function () {
|
|
|
33
33
|
};
|
|
34
34
|
getDataFromLocalStorageStub.withArgs('auHadronId').returns('tstCachedHadronId1');
|
|
35
35
|
|
|
36
|
-
const
|
|
37
|
-
|
|
38
|
-
callback(callbackSpy);
|
|
39
|
-
expect(callbackSpy.lastCall.lastArg).to.deep.equal({hadronId: 'tstCachedHadronId1'});
|
|
36
|
+
const result = hadronIdSubmodule.getId(config);
|
|
37
|
+
expect(result).to.deep.equal({ id: { hadronId: 'tstCachedHadronId1' } });
|
|
40
38
|
});
|
|
41
39
|
|
|
42
40
|
it('allows configurable id url', function() {
|
|
@@ -51,7 +49,7 @@ describe('HadronIdSystem', function () {
|
|
|
51
49
|
const request = server.requests[0];
|
|
52
50
|
expect(request.url).to.eq('https://hadronid.publync.com?partner_id=0&_it=prebid');
|
|
53
51
|
request.respond(200, { 'Content-Type': 'application/json' }, JSON.stringify({ hadronId: 'testHadronId1' }));
|
|
54
|
-
expect(callbackSpy.lastCall.lastArg).to.deep.equal({hadronId: 'testHadronId1'});
|
|
52
|
+
expect(callbackSpy.lastCall.lastArg).to.deep.equal({ id: { hadronId: 'testHadronId1' } });
|
|
55
53
|
});
|
|
56
54
|
});
|
|
57
55
|
});
|