prebid.js 7.29.0 → 7.31.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.
Files changed (173) hide show
  1. package/dist/33acrossBidAdapter.js +1 -1
  2. package/dist/33acrossIdSystem.js +1 -1
  3. package/dist/adagioBidAdapter.js +1 -1
  4. package/dist/adbookpspBidAdapter.js +1 -1
  5. package/dist/adgenerationBidAdapter.js +1 -1
  6. package/dist/adkernelBidAdapter.js +1 -1
  7. package/dist/adrelevantisBidAdapter.js +1 -1
  8. package/dist/adtrgtmeBidAdapter.js +1 -1
  9. package/dist/adxcgBidAdapter.js +1 -1
  10. package/dist/ajaBidAdapter.js +1 -1
  11. package/dist/amxBidAdapter.js +1 -1
  12. package/dist/amxIdSystem.js +1 -1
  13. package/dist/appierAnalyticsAdapter.js +1 -1
  14. package/dist/appnexusBidAdapter.js +1 -1
  15. package/dist/asoBidAdapter.js +1 -1
  16. package/dist/axonixBidAdapter.js +1 -1
  17. package/dist/bidViewability.js +1 -1
  18. package/dist/bidglassBidAdapter.js +1 -1
  19. package/dist/big-richmediaBidAdapter.js +1 -1
  20. package/dist/bridgewellBidAdapter.js +1 -1
  21. package/dist/brightMountainMediaBidAdapter.js +1 -1
  22. package/dist/byDataAnalyticsAdapter.js +1 -1
  23. package/dist/carodaBidAdapter.js +1 -1
  24. package/dist/ccxBidAdapter.js +1 -1
  25. package/dist/chtnwBidAdapter.js +1 -1
  26. package/dist/colossussspBidAdapter.js +1 -1
  27. package/dist/concertBidAdapter.js +1 -1
  28. package/dist/confiantRtdProvider.js +1 -0
  29. package/dist/connectadBidAdapter.js +1 -1
  30. package/dist/consentManagement.js +1 -1
  31. package/dist/consentManagementGpp.js +1 -0
  32. package/dist/consumableBidAdapter.js +1 -1
  33. package/dist/conversantBidAdapter.js +1 -1
  34. package/dist/craftBidAdapter.js +1 -1
  35. package/dist/criteoBidAdapter.js +1 -1
  36. package/dist/datawrkzBidAdapter.js +1 -1
  37. package/dist/dfpAdServerVideo.js +1 -1
  38. package/dist/dspxBidAdapter.js +1 -1
  39. package/dist/eplanningBidAdapter.js +1 -1
  40. package/dist/feedadBidAdapter.js +1 -1
  41. package/dist/finativeBidAdapter.js +1 -1
  42. package/dist/glimpseBidAdapter.js +1 -1
  43. package/dist/gmosspBidAdapter.js +1 -1
  44. package/dist/goldbachBidAdapter.js +1 -1
  45. package/dist/gridBidAdapter.js +1 -1
  46. package/dist/gridNMBidAdapter.js +1 -1
  47. package/dist/gumgumBidAdapter.js +1 -1
  48. package/dist/h12mediaBidAdapter.js +1 -1
  49. package/dist/id5IdSystem.js +1 -1
  50. package/dist/improvedigitalBidAdapter.js +1 -1
  51. package/dist/inmarBidAdapter.js +1 -1
  52. package/dist/insticatorBidAdapter.js +1 -1
  53. package/dist/ixBidAdapter.js +1 -1
  54. package/dist/justpremiumBidAdapter.js +1 -1
  55. package/dist/konduitAnalyticsAdapter.js +1 -1
  56. package/dist/kueezBidAdapter.js +1 -1
  57. package/dist/kueezRtbBidAdapter.js +1 -1
  58. package/dist/lassoBidAdapter.js +1 -1
  59. package/dist/lifestreetBidAdapter.js +1 -1
  60. package/dist/liveyieldAnalyticsAdapter.js +1 -1
  61. package/dist/logicadBidAdapter.js +1 -1
  62. package/dist/loglyliftBidAdapter.js +1 -1
  63. package/dist/magniteAnalyticsAdapter.js +1 -1
  64. package/dist/malltvAnalyticsAdapter.js +1 -1
  65. package/dist/marsmediaBidAdapter.js +1 -1
  66. package/dist/mediafuseBidAdapter.js +1 -1
  67. package/dist/mediasquareBidAdapter.js +1 -1
  68. package/dist/mgidBidAdapter.js +1 -1
  69. package/dist/minutemediaBidAdapter.js +1 -1
  70. package/dist/nexx360BidAdapter.js +1 -1
  71. package/dist/not-for-prod/prebid.js +127 -124
  72. package/dist/oguryBidAdapter.js +1 -1
  73. package/dist/onetagBidAdapter.js +1 -1
  74. package/dist/ooloAnalyticsAdapter.js +1 -1
  75. package/dist/outbrainBidAdapter.js +1 -1
  76. package/dist/parrableIdSystem.js +1 -1
  77. package/dist/pbsExtensions.js +1 -1
  78. package/dist/pixfutureBidAdapter.js +1 -1
  79. package/dist/prebid-core.js +1 -1
  80. package/dist/prebidServerBidAdapter.js +1 -1
  81. package/dist/publinkIdSystem.js +1 -1
  82. package/dist/pubmaticBidAdapter.js +1 -1
  83. package/dist/pubwiseAnalyticsAdapter.js +1 -1
  84. package/dist/pxyzBidAdapter.js +1 -1
  85. package/dist/quantcastBidAdapter.js +1 -1
  86. package/dist/readpeakBidAdapter.js +1 -1
  87. package/dist/relaidoBidAdapter.js +1 -1
  88. package/dist/rhythmoneBidAdapter.js +1 -1
  89. package/dist/riseBidAdapter.js +1 -1
  90. package/dist/rtdModule.js +1 -1
  91. package/dist/rubiconAnalyticsAdapter.js +1 -1
  92. package/dist/rubiconBidAdapter.js +1 -1
  93. package/dist/seedingAllianceBidAdapter.js +1 -1
  94. package/dist/seedtagBidAdapter.js +1 -1
  95. package/dist/sharethroughAnalyticsAdapter.js +1 -1
  96. package/dist/sharethroughBidAdapter.js +1 -1
  97. package/dist/shinezBidAdapter.js +1 -1
  98. package/dist/smaatoBidAdapter.js +1 -1
  99. package/dist/smartadserverBidAdapter.js +1 -1
  100. package/dist/smartxBidAdapter.js +1 -1
  101. package/dist/smilewantedBidAdapter.js +1 -1
  102. package/dist/sonobiBidAdapter.js +1 -1
  103. package/dist/sovrnAnalyticsAdapter.js +1 -1
  104. package/dist/sovrnBidAdapter.js +1 -1
  105. package/dist/sspBCBidAdapter.js +1 -1
  106. package/dist/sublimeBidAdapter.js +1 -1
  107. package/dist/synacormediaBidAdapter.js +1 -1
  108. package/dist/targetVideoBidAdapter.js +1 -1
  109. package/dist/teadsBidAdapter.js +1 -1
  110. package/dist/trionBidAdapter.js +1 -1
  111. package/dist/tripleliftBidAdapter.js +1 -1
  112. package/dist/ttdBidAdapter.js +1 -1
  113. package/dist/ucfunnelAnalyticsAdapter.js +1 -1
  114. package/dist/uid2IdSystem.js +1 -1
  115. package/dist/underdogmediaBidAdapter.js +1 -1
  116. package/dist/undertoneBidAdapter.js +1 -1
  117. package/dist/vidazooBidAdapter.js +1 -1
  118. package/dist/videobyteBidAdapter.js +1 -1
  119. package/dist/viouslyBidAdapter.js +1 -0
  120. package/dist/visxBidAdapter.js +1 -1
  121. package/dist/vuukleBidAdapter.js +1 -1
  122. package/dist/widespaceBidAdapter.js +1 -1
  123. package/dist/winrBidAdapter.js +1 -1
  124. package/dist/yahoosspBidAdapter.js +1 -1
  125. package/dist/yieldmoBidAdapter.js +1 -1
  126. package/dist/yieldoneAnalyticsAdapter.js +1 -1
  127. package/integrationExamples/gpt/gpp_us_hello_world.html +124 -0
  128. package/integrationExamples/gpt/gpp_us_hello_world_iframe.html +12 -0
  129. package/integrationExamples/gpt/gpp_us_hello_world_iframe_subpage.html +140 -0
  130. package/karma.conf.maker.js +1 -1
  131. package/libraries/pbsExtensions/processors/adUnitCode.js +13 -0
  132. package/libraries/pbsExtensions/processors/pbs.js +5 -0
  133. package/modules/.submodules.json +1 -0
  134. package/modules/adkernelBidAdapter.js +2 -1
  135. package/modules/appnexusBidAdapter.js +23 -2
  136. package/modules/bidViewability.js +6 -1
  137. package/modules/ccxBidAdapter.js +3 -2
  138. package/modules/colossussspBidAdapter.js +8 -0
  139. package/modules/confiantRtdProvider.js +128 -0
  140. package/modules/confiantRtdProvider.md +45 -0
  141. package/modules/consentManagement.js +4 -4
  142. package/modules/consentManagementGpp.js +386 -0
  143. package/modules/datawrkzBidAdapter.js +24 -4
  144. package/modules/dfpAdServerVideo.js +6 -1
  145. package/modules/feedadBidAdapter.js +11 -3
  146. package/modules/gridBidAdapter.js +1 -2
  147. package/modules/lassoBidAdapter.js +2 -2
  148. package/modules/magniteAnalyticsAdapter.js +9 -1
  149. package/modules/onetagBidAdapter.js +20 -29
  150. package/modules/prebidServerBidAdapter/index.js +19 -8
  151. package/modules/prebidServerBidAdapter/ortbConverter.js +1 -0
  152. package/modules/rtdModule/index.js +2 -1
  153. package/modules/viouslyBidAdapter.js +209 -0
  154. package/modules/viouslyBidAdapter.md +35 -0
  155. package/package.json +1 -1
  156. package/src/adapterManager.js +11 -10
  157. package/src/adapters/bidderFactory.js +5 -5
  158. package/src/adloader.js +2 -1
  159. package/src/consentHandler.js +11 -0
  160. package/src/prebid.js +9 -9
  161. package/test/helpers/hookSetup.js +5 -0
  162. package/test/spec/modules/ViouslyBidAdapter_spec.js +378 -0
  163. package/test/spec/modules/appnexusBidAdapter_spec.js +46 -0
  164. package/test/spec/modules/colossussspBidAdapter_spec.js +89 -2
  165. package/test/spec/modules/confiantRtdProvider_spec.js +107 -0
  166. package/test/spec/modules/consentManagementGpp_spec.js +577 -0
  167. package/test/spec/modules/feedadBidAdapter_spec.js +38 -13
  168. package/test/spec/modules/gridBidAdapter_spec.js +0 -18
  169. package/test/spec/modules/magniteAnalyticsAdapter_spec.js +36 -14
  170. package/test/spec/modules/onetagBidAdapter_spec.js +29 -23
  171. package/test/spec/modules/topicsFpdModule_spec.js +41 -22
  172. package/test/spec/ortbConverter/pbsExtensions/adUnitCode_spec.js +23 -0
  173. package/test/spec/unit/pbjs_api_spec.js +11 -0
package/src/adloader.js CHANGED
@@ -20,7 +20,8 @@ const _approvedLoadExternalJSList = [
20
20
  'hadron',
21
21
  'medianet',
22
22
  'improvedigital',
23
- 'aaxBlockmeter'
23
+ 'aaxBlockmeter',
24
+ 'confiant'
24
25
  ]
25
26
 
26
27
  /**
@@ -107,3 +107,14 @@ export class GdprConsentHandler extends ConsentHandler {
107
107
  }
108
108
  }
109
109
  }
110
+
111
+ export class GppConsentHandler extends ConsentHandler {
112
+ getConsentMeta() {
113
+ const consentData = this.getConsentData();
114
+ if (consentData && this.generatedTime) {
115
+ return {
116
+ generatedAt: this.generatedTime,
117
+ }
118
+ }
119
+ }
120
+ }
package/src/prebid.js CHANGED
@@ -45,7 +45,7 @@ import {executeRenderer, isRendererRequired} from './Renderer.js';
45
45
  import {createBid} from './bidfactory.js';
46
46
  import {storageCallbacks} from './storageManager.js';
47
47
  import {emitAdRenderFail, emitAdRenderSucceeded} from './adRendering.js';
48
- import {default as adapterManager, gdprDataHandler, getS2SBidderSet, uspDataHandler} from './adapterManager.js';
48
+ import {default as adapterManager, gdprDataHandler, getS2SBidderSet, gppDataHandler, uspDataHandler} from './adapterManager.js';
49
49
  import CONSTANTS from './constants.json';
50
50
  import * as events from './events.js';
51
51
  import {newMetrics, useMetrics} from './utils/perfMetrics.js';
@@ -336,6 +336,7 @@ function getConsentMetadata() {
336
336
  return {
337
337
  gdpr: gdprDataHandler.getConsentMeta(),
338
338
  usp: uspDataHandler.getConsentMeta(),
339
+ gpp: gppDataHandler.getConsentMeta(),
339
340
  coppa: !!(config.getConfig('coppa'))
340
341
  }
341
342
  }
@@ -628,6 +629,13 @@ $$PREBID_GLOBAL$$.requestBids = (function() {
628
629
  events.emit(REQUEST_BIDS);
629
630
  const cbTimeout = timeout || config.getConfig('bidderTimeout');
630
631
  logInfo('Invoking $$PREBID_GLOBAL$$.requestBids', arguments);
632
+ if (adUnitCodes && adUnitCodes.length) {
633
+ // if specific adUnitCodes supplied filter adUnits for those codes
634
+ adUnits = adUnits.filter(unit => includes(adUnitCodes, unit.code));
635
+ } else {
636
+ // otherwise derive adUnitCodes from adUnits
637
+ adUnitCodes = adUnits && adUnits.map(unit => unit.code);
638
+ }
631
639
  const ortb2Fragments = {
632
640
  global: mergeDeep({}, config.getAnyConfig('ortb2') || {}, ortb2 || {}),
633
641
  bidder: Object.fromEntries(Object.entries(config.getBidderConfig()).map(([bidder, cfg]) => [bidder, cfg.ortb2]).filter(([_, ortb2]) => ortb2 != null))
@@ -660,14 +668,6 @@ export const startAuction = hook('async', function ({ bidsBackHandler, timeout:
660
668
  const s2sBidders = getS2SBidderSet(config.getConfig('s2sConfig') || []);
661
669
  adUnits = useMetrics(metrics).measureTime('requestBids.validate', () => checkAdUnitSetup(adUnits));
662
670
 
663
- if (adUnitCodes && adUnitCodes.length) {
664
- // if specific adUnitCodes supplied filter adUnits for those codes
665
- adUnits = adUnits.filter(unit => includes(adUnitCodes, unit.code));
666
- } else {
667
- // otherwise derive adUnitCodes from adUnits
668
- adUnitCodes = adUnits && adUnits.map(unit => unit.code);
669
- }
670
-
671
671
  function auctionDone(bids, timedOut, auctionId) {
672
672
  if (typeof bidsBackHandler === 'function') {
673
673
  try {
@@ -0,0 +1,5 @@
1
+ import {hook} from '../../src/hook.js';
2
+
3
+ before(() => {
4
+ hook.ready();
5
+ });
@@ -0,0 +1,378 @@
1
+ import {expect} from 'chai';
2
+
3
+ import { deepClone, mergeDeep } from 'src/utils';
4
+ import { createEidsArray } from 'modules/userId/eids.js';
5
+
6
+ import {spec as adapter} from 'modules/viouslyBidAdapter';
7
+
8
+ import sinon from 'sinon';
9
+ import { config } from 'src/config.js';
10
+
11
+ const CURRENCY = 'EUR';
12
+ const TTL = 60;
13
+ const HTTP_METHOD = 'POST';
14
+ const REQUEST_URL = 'https://bidder.viously.com/bid';
15
+
16
+ const VALID_BID_VIDEO = {
17
+ bidder: 'viously',
18
+ bidId: '5e6f7g8h',
19
+ adUnitCode: 'id-5678',
20
+ params: {
21
+ pid: '123e4567-e89b-12d3-a456-426614174001'
22
+ },
23
+ mediaTypes: {
24
+ video: {
25
+ playerSize: [640, 360],
26
+ context: 'instream',
27
+ playbackmethod: [1, 2, 3, 4]
28
+ }
29
+ }
30
+ };
31
+
32
+ const VALID_REQUEST_VIDEO = {
33
+ method: HTTP_METHOD,
34
+ url: REQUEST_URL,
35
+ data: {
36
+ pid: '123e4567-e89b-12d3-a456-426614174001',
37
+ currency_code: CURRENCY,
38
+ placements: [
39
+ {
40
+ id: 'id-5678',
41
+ bid_id: '5e6f7g8h',
42
+ video_params: {
43
+ context: 'instream',
44
+ playbackmethod: [1, 2, 3, 4],
45
+ size: ['640x360']
46
+ }
47
+ }
48
+ ]
49
+ }
50
+ };
51
+
52
+ const VALID_GDPR = {
53
+ gdprApplies: true,
54
+ apiVersion: 2,
55
+ consentString: 'abcdefgh',
56
+ addtlConsent: '1~12345678',
57
+ vendorData: {
58
+ purpose: {
59
+ consents: {
60
+ 1: true
61
+ }
62
+ }
63
+ }
64
+ };
65
+ const US_PRIVACY = '1YNN';
66
+
67
+ describe('ViouslyAdapter', function () {
68
+ describe('isBidRequestValid', function () {
69
+ describe('Check method return', function () {
70
+ it('should return true', function () {
71
+ expect(adapter.isBidRequestValid(VALID_BID_VIDEO)).to.equal(true);
72
+ });
73
+
74
+ it('should return false because the pid is missing', function () {
75
+ let wrongBid = deepClone(VALID_BID_VIDEO);
76
+ delete wrongBid.params.pid;
77
+
78
+ expect(adapter.isBidRequestValid(wrongBid)).to.equal(false);
79
+ });
80
+
81
+ it('should return false because the video context parameter is missing', function () {
82
+ let wrongBid = deepClone(VALID_BID_VIDEO);
83
+
84
+ delete wrongBid.mediaTypes.video.context;
85
+ expect(adapter.isBidRequestValid(wrongBid)).to.equal(false);
86
+ });
87
+ });
88
+ });
89
+
90
+ describe('buildRequests', function () {
91
+ describe('Check method return', function () {
92
+ it('should return the right formatted video requests', function() {
93
+ expect(adapter.buildRequests([VALID_BID_VIDEO])).to.deep.equal(VALID_REQUEST_VIDEO);
94
+ });
95
+
96
+ it('should return the right formatted request with the referer info', function() {
97
+ let bidderRequest = {
98
+ refererInfo: {
99
+ page: 'https://www.example.com/test'
100
+ }
101
+ };
102
+
103
+ let requests = mergeDeep(deepClone(VALID_REQUEST_VIDEO), {
104
+ data: {
105
+ domain: 'www.example.com',
106
+ page_domain: 'https://www.example.com/test'
107
+ }
108
+ });
109
+
110
+ expect(adapter.buildRequests([VALID_BID_VIDEO], bidderRequest)).to.deep.equal(requests);
111
+ });
112
+
113
+ it('should return the right formatted request with the referer info from config', function() {
114
+ /** Mock the config.getConfig method */
115
+ sinon.stub(config, 'getConfig')
116
+ .withArgs('pageUrl')
117
+ .returns('https://www.example.com/page');
118
+
119
+ let requests = mergeDeep(deepClone(VALID_REQUEST_VIDEO), {
120
+ data: {
121
+ domain: 'www.example.com',
122
+ page_domain: 'https://www.example.com/page'
123
+ }
124
+ });
125
+
126
+ expect(adapter.buildRequests([VALID_BID_VIDEO])).to.deep.equal(requests);
127
+
128
+ config.getConfig.restore();
129
+ });
130
+
131
+ it('should return the right formatted request with GDPR Consent info', function() {
132
+ let bidderRequest = {
133
+ gdprConsent: VALID_GDPR
134
+ };
135
+
136
+ let requests = mergeDeep(deepClone(VALID_REQUEST_VIDEO), {
137
+ data: {
138
+ gdpr: true,
139
+ gdpr_consent: 'abcdefgh',
140
+ addtl_consent: '1~12345678'
141
+ }
142
+ });
143
+
144
+ expect(adapter.buildRequests([VALID_BID_VIDEO], bidderRequest)).to.deep.equal(requests);
145
+ });
146
+
147
+ it('should return the right formatted request with US Privacy info', function() {
148
+ let bidderRequest = {
149
+ uspConsent: US_PRIVACY
150
+ };
151
+
152
+ let requests = mergeDeep(deepClone(VALID_REQUEST_VIDEO), {
153
+ data: {
154
+ us_privacy: US_PRIVACY
155
+ }
156
+ });
157
+
158
+ expect(adapter.buildRequests([VALID_BID_VIDEO], bidderRequest)).to.deep.equal(requests);
159
+ });
160
+
161
+ // TODO: Supply chain
162
+ it('should return the right formatted request with Supply Chain info', function() {
163
+ let schain = {
164
+ 'ver': '1.0',
165
+ 'complete': 1,
166
+ 'nodes': [
167
+ {
168
+ 'asi': 'test1.com',
169
+ 'sid': '00001',
170
+ 'hp': 1
171
+ },
172
+ {
173
+ 'asi': 'test2-2.com',
174
+ 'sid': '00002',
175
+ 'hp': 2
176
+ }
177
+ ]
178
+ };
179
+
180
+ let bid = mergeDeep(deepClone(VALID_BID_VIDEO), {
181
+ schain: schain
182
+ });
183
+
184
+ let requests = mergeDeep(deepClone(VALID_REQUEST_VIDEO), {
185
+ data: {
186
+ schain: schain
187
+ }
188
+ });
189
+
190
+ expect(adapter.buildRequests([bid])).to.deep.equal(requests);
191
+ });
192
+
193
+ it('should return the right formatted request with User Ids info', function() {
194
+ let userIds = {
195
+ idl_env: '1234-5678-9012-3456', // Liveramp
196
+ netId: 'testnetid123', // NetId
197
+ IDP: 'userIDP000', // IDP
198
+ fabrickId: 'fabrickId9000', // FabrickId
199
+ uid2: { id: 'testuid2' } // UID 2.0
200
+ };
201
+
202
+ let bid = mergeDeep(deepClone(VALID_BID_VIDEO), {
203
+ userIds: userIds
204
+ }, {
205
+ userIdAsEids: createEidsArray(userIds)
206
+ });
207
+
208
+ let requests = mergeDeep(deepClone(VALID_REQUEST_VIDEO), {
209
+ data: {
210
+ users_uid: createEidsArray(userIds)
211
+ }
212
+ });
213
+
214
+ expect(adapter.buildRequests([bid])).to.deep.equal(requests);
215
+ });
216
+
217
+ it('should return the right formatted request with endpint test', function() {
218
+ let endpoint = 'https://bid-test.viously.com/prebid';
219
+
220
+ let bid = mergeDeep(deepClone(VALID_BID_VIDEO), {
221
+ params: {
222
+ endpoint: endpoint
223
+ }
224
+ });
225
+
226
+ let requests = mergeDeep(deepClone(VALID_REQUEST_VIDEO));
227
+
228
+ requests.url = endpoint;
229
+
230
+ expect(adapter.buildRequests([bid])).to.deep.equal(requests);
231
+ });
232
+
233
+ // TODO: Floor
234
+ });
235
+ });
236
+
237
+ describe('interpretResponse', function() {
238
+ describe('Check method return', function () {
239
+ it('should return the right formatted response', function() {
240
+ let response = {
241
+ body: {
242
+ ads: [
243
+ {
244
+ bid: false,
245
+ id: 'id-0157324f-bee4-5390-a14c-47a7da3eb73c-0',
246
+ bid_id: '1234'
247
+ },
248
+ {
249
+ bid: true,
250
+ creative_id: '2468',
251
+ id: 'id-0157324f-bee4-5390-a14c-47a7da3eb73c-1',
252
+ bid_id: '5678',
253
+ cpm: 8,
254
+ ad: 'vast xml',
255
+ ad_url: 'http://www.example.com/vast',
256
+ type: 'video',
257
+ size: '640x480',
258
+ nurl: [
259
+ 'win.domain.com'
260
+ ]
261
+ },
262
+ {
263
+ bid: true,
264
+ creative_id: '1469',
265
+ id: 'id-0157324f-bee4-5390-a14c-47a7da3eb73c-3',
266
+ bid_id: '2570',
267
+ cpm: 4,
268
+ ad: 'vast xml',
269
+ type: 'video',
270
+ size: '640x480',
271
+ }
272
+ ]
273
+ }
274
+ };
275
+ let requests = {
276
+ data: {
277
+ placements: [
278
+ {
279
+ id: 'id-0157324f-bee4-5390-a14c-47a7da3eb73c-0',
280
+ bid_id: '1234'
281
+ },
282
+ {
283
+ id: 'id-0157324f-bee4-5390-a14c-47a7da3eb73c-1',
284
+ bid_id: '5678'
285
+ },
286
+ {
287
+ id: 'id-0157324f-bee4-5390-a14c-47a7da3eb73c-3',
288
+ bid_id: '2570'
289
+ }
290
+ ]
291
+ }
292
+ };
293
+
294
+ let formattedReponse = [
295
+ {
296
+ requestId: '5678',
297
+ id: 'id-0157324f-bee4-5390-a14c-47a7da3eb73c-1',
298
+ cpm: 8,
299
+ width: '640',
300
+ height: '480',
301
+ creativeId: '2468',
302
+ currency: CURRENCY,
303
+ netRevenue: true,
304
+ ttl: TTL,
305
+ mediaType: 'video',
306
+ meta: {},
307
+ vastUrl: 'http://www.example.com/vast',
308
+ nurl: [
309
+ 'win.domain.com'
310
+ ]
311
+ },
312
+ {
313
+ requestId: '2570',
314
+ id: 'id-0157324f-bee4-5390-a14c-47a7da3eb73c-3',
315
+ cpm: 4,
316
+ width: '640',
317
+ height: '480',
318
+ creativeId: '1469',
319
+ currency: CURRENCY,
320
+ netRevenue: true,
321
+ ttl: TTL,
322
+ mediaType: 'video',
323
+ meta: {},
324
+ vastXml: 'vast xml',
325
+ nurl: []
326
+ }
327
+ ];
328
+
329
+ expect(adapter.interpretResponse(response, requests)).to.deep.equal(formattedReponse);
330
+ });
331
+ });
332
+ });
333
+
334
+ describe('onBidWon', function() {
335
+ describe('Check methods succeed', function () {
336
+ it('should not throw error', function() {
337
+ let bids = [
338
+ {
339
+ requestId: '5678',
340
+ id: 'id-0157324f-bee4-5390-a14c-47a7da3eb73c-1',
341
+ cpm: 8,
342
+ width: '640',
343
+ height: '480',
344
+ creativeId: '2468',
345
+ currency: CURRENCY,
346
+ netRevenue: true,
347
+ ttl: TTL,
348
+ mediaType: 'video',
349
+ meta: {},
350
+ vastUrl: 'http://www.example.com/vast',
351
+ nurl: [
352
+ 'win.domain.com'
353
+ ]
354
+ },
355
+ {
356
+ requestId: '2570',
357
+ id: 'id-0157324f-bee4-5390-a14c-47a7da3eb73c-3',
358
+ cpm: 4,
359
+ width: '640',
360
+ height: '480',
361
+ creativeId: '1469',
362
+ currency: CURRENCY,
363
+ netRevenue: true,
364
+ ttl: TTL,
365
+ mediaType: 'video',
366
+ meta: {},
367
+ vastXml: 'vast xml',
368
+ nurl: []
369
+ }
370
+ ];
371
+
372
+ bids.forEach(function(bid) {
373
+ expect(adapter.onBidWon.bind(adapter, bid)).to.not.throw();
374
+ });
375
+ });
376
+ });
377
+ });
378
+ });
@@ -985,6 +985,52 @@ describe('AppNexusAdapter', function () {
985
985
  expect(payload.us_privacy).to.exist.and.to.equal(consentString);
986
986
  });
987
987
 
988
+ it('should add gpp information to the request via bidderRequest.gppConsent', function () {
989
+ let consentString = 'abc1234';
990
+ let bidderRequest = {
991
+ 'bidderCode': 'appnexus',
992
+ 'auctionId': '1d1a030790a475',
993
+ 'bidderRequestId': '22edbae2733bf6',
994
+ 'timeout': 3000,
995
+ 'gppConsent': {
996
+ 'gppString': consentString,
997
+ 'applicableSections': [8]
998
+ }
999
+ };
1000
+ bidderRequest.bids = bidRequests;
1001
+
1002
+ const request = spec.buildRequests(bidRequests, bidderRequest);
1003
+ const payload = JSON.parse(request.data);
1004
+
1005
+ expect(payload.privacy).to.exist;
1006
+ expect(payload.privacy.gpp).to.equal(consentString);
1007
+ expect(payload.privacy.gpp_sid).to.deep.equal([8]);
1008
+ });
1009
+
1010
+ it('should add gpp information to the request via bidderRequest.ortb2.regs', function () {
1011
+ let consentString = 'abc1234';
1012
+ let bidderRequest = {
1013
+ 'bidderCode': 'appnexus',
1014
+ 'auctionId': '1d1a030790a475',
1015
+ 'bidderRequestId': '22edbae2733bf6',
1016
+ 'timeout': 3000,
1017
+ 'ortb2': {
1018
+ 'regs': {
1019
+ 'gpp': consentString,
1020
+ 'gpp_sid': [7]
1021
+ }
1022
+ }
1023
+ };
1024
+ bidderRequest.bids = bidRequests;
1025
+
1026
+ const request = spec.buildRequests(bidRequests, bidderRequest);
1027
+ const payload = JSON.parse(request.data);
1028
+
1029
+ expect(payload.privacy).to.exist;
1030
+ expect(payload.privacy.gpp).to.equal(consentString);
1031
+ expect(payload.privacy.gpp_sid).to.deep.equal([7]);
1032
+ });
1033
+
988
1034
  it('supports sending hybrid mobile app parameters', function () {
989
1035
  let appRequest = Object.assign({},
990
1036
  bidRequests[0],
@@ -56,6 +56,93 @@ describe('ColossussspAdapter', function () {
56
56
  referer: 'http://www.example.com',
57
57
  reachedTop: true,
58
58
  },
59
+ ortb2: {
60
+ app: {
61
+ name: 'myappname',
62
+ keywords: 'power tools, drills',
63
+ content: {
64
+ data: [
65
+ {
66
+ name: 'www.dataprovider1.com',
67
+ ext: {
68
+ segtax: 6
69
+ },
70
+ segment: [
71
+ {
72
+ id: '687'
73
+ },
74
+ {
75
+ id: '123'
76
+ }
77
+ ]
78
+ },
79
+ {
80
+ name: 'www.dataprovider1.com',
81
+ ext: {
82
+ segtax: 7
83
+ },
84
+ segment: [
85
+ {
86
+ id: '456'
87
+ },
88
+ {
89
+ id: '789'
90
+ }
91
+ ]
92
+ }
93
+ ]
94
+ }
95
+ },
96
+ site: {
97
+ name: 'example',
98
+ domain: 'page.example.com',
99
+ cat: ['IAB2'],
100
+ sectioncat: ['IAB2-2'],
101
+ pagecat: ['IAB2-2'],
102
+ page: 'https://page.example.com/here.html',
103
+ ref: 'https://ref.example.com',
104
+ keywords: 'power tools, drills',
105
+ search: 'drill',
106
+ content: {
107
+ userrating: '4',
108
+ data: [{
109
+ name: 'www.dataprovider1.com',
110
+ ext: {
111
+ segtax: 7,
112
+ cids: ['iris_c73g5jq96mwso4d8']
113
+ },
114
+ segment: [
115
+ { id: '687' },
116
+ { id: '123' }
117
+ ]
118
+ }]
119
+ },
120
+ ext: {
121
+ data: {
122
+ pageType: 'article',
123
+ category: 'repair'
124
+ }
125
+ }
126
+ },
127
+ user: {
128
+ yob: 1985,
129
+ gender: 'm',
130
+ keywords: 'a,b',
131
+ data: [{
132
+ name: 'dataprovider.com',
133
+ ext: { segtax: 4 },
134
+ segment: [
135
+ { id: '1' }
136
+ ]
137
+ }],
138
+ ext: {
139
+ data: {
140
+ registered: true,
141
+ interests: ['cars']
142
+ }
143
+ }
144
+ }
145
+ },
59
146
  bids: [bid]
60
147
  }
61
148
 
@@ -91,7 +178,7 @@ describe('ColossussspAdapter', function () {
91
178
  it('Returns valid data if array of bids is valid', function () {
92
179
  let data = serverRequest.data;
93
180
  expect(data).to.be.an('object');
94
- expect(data).to.have.all.keys('deviceWidth', 'deviceHeight', 'language', 'secure', 'host', 'page', 'placements', 'ccpa', 'gdpr_consent', 'gdpr_require');
181
+ expect(data).to.have.all.keys('deviceWidth', 'deviceHeight', 'language', 'secure', 'host', 'page', 'placements', 'ccpa', 'gdpr_consent', 'gdpr_require', 'userObj', 'siteObj', 'appObj');
95
182
  expect(data.deviceWidth).to.be.a('number');
96
183
  expect(data.deviceHeight).to.be.a('number');
97
184
  expect(data.language).to.be.a('string');
@@ -132,7 +219,7 @@ describe('ColossussspAdapter', function () {
132
219
 
133
220
  let data = serverRequest.data;
134
221
  expect(data).to.be.an('object');
135
- expect(data).to.have.all.keys('deviceWidth', 'deviceHeight', 'language', 'secure', 'host', 'page', 'placements', 'ccpa', 'gdpr_consent', 'gdpr_require');
222
+ expect(data).to.have.all.keys('deviceWidth', 'deviceHeight', 'language', 'secure', 'host', 'page', 'placements', 'ccpa', 'gdpr_consent', 'gdpr_require', 'userObj', 'siteObj', 'appObj');
136
223
  expect(data.deviceWidth).to.be.a('number');
137
224
  expect(data.deviceHeight).to.be.a('number');
138
225
  expect(data.language).to.be.a('string');