prebid.js 7.2.0 → 7.5.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 (251) hide show
  1. package/.circleci/config.yml +11 -6
  2. package/.github/dependabot.yml +6 -0
  3. package/.github/workflows/issue_tracker.yml +5 -0
  4. package/.github/workflows/release-drafter.yml +6 -0
  5. package/README.md +35 -0
  6. package/dist/33acrossBidAdapter.js +1 -1
  7. package/dist/adagioBidAdapter.js +1 -1
  8. package/dist/adbookpspBidAdapter.js +1 -1
  9. package/dist/adgenerationBidAdapter.js +1 -1
  10. package/dist/adkernelBidAdapter.js +1 -1
  11. package/dist/adotBidAdapter.js +1 -1
  12. package/dist/adpod.js +1 -1
  13. package/dist/adqueryBidAdapter.js +1 -1
  14. package/dist/adrelevantisBidAdapter.js +1 -1
  15. package/dist/adxcgBidAdapter.js +1 -1
  16. package/dist/adyoulikeBidAdapter.js +1 -1
  17. package/dist/ajaBidAdapter.js +1 -1
  18. package/dist/amxBidAdapter.js +1 -1
  19. package/dist/amxIdSystem.js +1 -1
  20. package/dist/appierAnalyticsAdapter.js +1 -1
  21. package/dist/appnexusBidAdapter.js +1 -1
  22. package/dist/asoBidAdapter.js +1 -1
  23. package/dist/audiencerunBidAdapter.js +1 -1
  24. package/dist/axonixBidAdapter.js +1 -1
  25. package/dist/bidglassBidAdapter.js +1 -1
  26. package/dist/big-richmediaBidAdapter.js +1 -1
  27. package/dist/bluebillywigBidAdapter.js +1 -1
  28. package/dist/bridgewellBidAdapter.js +1 -1
  29. package/dist/brightMountainMediaBidAdapter.js +1 -1
  30. package/dist/concertBidAdapter.js +1 -1
  31. package/dist/connectadBidAdapter.js +1 -1
  32. package/dist/consumableBidAdapter.js +1 -1
  33. package/dist/conversantBidAdapter.js +1 -1
  34. package/dist/cpexIdSystem.js +1 -1
  35. package/dist/craftBidAdapter.js +1 -1
  36. package/dist/criteoBidAdapter.js +1 -1
  37. package/dist/debugging-standalone.js +1 -1
  38. package/dist/debugging.js +1 -1
  39. package/dist/dianomiBidAdapter.js +1 -0
  40. package/dist/dspxBidAdapter.js +1 -1
  41. package/dist/eplanningBidAdapter.js +1 -1
  42. package/dist/finativeBidAdapter.js +1 -0
  43. package/dist/fpdModule.js +1 -1
  44. package/dist/gdprEnforcement.js +1 -1
  45. package/dist/glimpseBidAdapter.js +1 -1
  46. package/dist/gmosspBidAdapter.js +1 -1
  47. package/dist/goldbachBidAdapter.js +1 -1
  48. package/dist/gridBidAdapter.js +1 -1
  49. package/dist/gridNMBidAdapter.js +1 -1
  50. package/dist/gumgumBidAdapter.js +1 -1
  51. package/dist/h12mediaBidAdapter.js +1 -1
  52. package/dist/hadronIdSystem.js +1 -1
  53. package/dist/hadronRtdProvider.js +1 -1
  54. package/dist/id5IdSystem.js +1 -1
  55. package/dist/impactifyBidAdapter.js +1 -1
  56. package/dist/improvedigitalBidAdapter.js +1 -1
  57. package/dist/inmarBidAdapter.js +1 -1
  58. package/dist/insticatorBidAdapter.js +1 -1
  59. package/dist/ixBidAdapter.js +1 -1
  60. package/dist/jixieBidAdapter.js +1 -1
  61. package/dist/justpremiumBidAdapter.js +1 -1
  62. package/dist/kargoAnalyticsAdapter.js +1 -1
  63. package/dist/kargoBidAdapter.js +1 -1
  64. package/dist/konduitAnalyticsAdapter.js +1 -1
  65. package/dist/kueezBidAdapter.js +1 -1
  66. package/dist/lassoBidAdapter.js +1 -0
  67. package/dist/liveyieldAnalyticsAdapter.js +1 -1
  68. package/dist/logicadBidAdapter.js +1 -1
  69. package/dist/loglyliftBidAdapter.js +1 -1
  70. package/dist/malltvAnalyticsAdapter.js +1 -1
  71. package/dist/marsmediaBidAdapter.js +1 -1
  72. package/dist/mediafuseBidAdapter.js +1 -1
  73. package/dist/mediakeysBidAdapter.js +1 -1
  74. package/dist/medianetBidAdapter.js +1 -1
  75. package/dist/mediasquareBidAdapter.js +1 -1
  76. package/dist/mgidBidAdapter.js +1 -1
  77. package/dist/minutemediaBidAdapter.js +1 -1
  78. package/dist/missenaBidAdapter.js +1 -1
  79. package/dist/nativoBidAdapter.js +1 -1
  80. package/dist/not-for-prod/prebid.js +137 -131
  81. package/dist/oguryBidAdapter.js +1 -1
  82. package/dist/onetagBidAdapter.js +1 -1
  83. package/dist/ooloAnalyticsAdapter.js +1 -1
  84. package/dist/openxOrtbBidAdapter.js +1 -0
  85. package/dist/outbrainBidAdapter.js +1 -1
  86. package/dist/parrableIdSystem.js +1 -1
  87. package/dist/pixfutureBidAdapter.js +1 -1
  88. package/dist/prebid-core.js +2 -2
  89. package/dist/pubCommonId.js +1 -1
  90. package/dist/publinkIdSystem.js +1 -1
  91. package/dist/pubmaticBidAdapter.js +1 -1
  92. package/dist/pubwiseAnalyticsAdapter.js +1 -1
  93. package/dist/pxyzBidAdapter.js +1 -1
  94. package/dist/quantcastBidAdapter.js +1 -1
  95. package/dist/readpeakBidAdapter.js +1 -1
  96. package/dist/relaidoBidAdapter.js +1 -1
  97. package/dist/rhythmoneBidAdapter.js +1 -1
  98. package/dist/riseBidAdapter.js +1 -1
  99. package/dist/rubiconAnalyticsAdapter.js +1 -1
  100. package/dist/rubiconBidAdapter.js +1 -1
  101. package/dist/seedingAllianceBidAdapter.js +1 -1
  102. package/dist/seedtagBidAdapter.js +1 -1
  103. package/dist/sharedIdSystem.js +1 -1
  104. package/dist/sharethroughAnalyticsAdapter.js +1 -1
  105. package/dist/sharethroughBidAdapter.js +1 -1
  106. package/dist/shinezBidAdapter.js +1 -0
  107. package/dist/sizeMappingV2.js +1 -1
  108. package/dist/smaatoBidAdapter.js +1 -1
  109. package/dist/smartadserverBidAdapter.js +1 -1
  110. package/dist/smartxBidAdapter.js +1 -1
  111. package/dist/smilewantedBidAdapter.js +1 -1
  112. package/dist/sonobiBidAdapter.js +1 -1
  113. package/dist/sovrnAnalyticsAdapter.js +1 -1
  114. package/dist/sovrnBidAdapter.js +1 -1
  115. package/dist/sspBCBidAdapter.js +1 -1
  116. package/dist/sublimeBidAdapter.js +1 -1
  117. package/dist/synacormediaBidAdapter.js +1 -1
  118. package/dist/taboolaBidAdapter.js +1 -1
  119. package/dist/targetVideoBidAdapter.js +1 -1
  120. package/dist/teadsBidAdapter.js +1 -1
  121. package/dist/tncIdSystem.js +1 -0
  122. package/dist/trionBidAdapter.js +1 -1
  123. package/dist/tripleliftBidAdapter.js +1 -1
  124. package/dist/ttdBidAdapter.js +1 -1
  125. package/dist/ucfunnelAnalyticsAdapter.js +1 -1
  126. package/dist/underdogmediaBidAdapter.js +1 -1
  127. package/dist/undertoneBidAdapter.js +1 -1
  128. package/dist/userId.js +1 -1
  129. package/dist/ventesBidAdapter.js +1 -1
  130. package/dist/vidazooBidAdapter.js +1 -1
  131. package/dist/videobyteBidAdapter.js +1 -1
  132. package/dist/visxBidAdapter.js +1 -1
  133. package/dist/vrtcalBidAdapter.js +1 -1
  134. package/dist/vuukleBidAdapter.js +1 -1
  135. package/dist/widespaceBidAdapter.js +1 -1
  136. package/dist/winrBidAdapter.js +1 -1
  137. package/dist/yahoosspBidAdapter.js +1 -1
  138. package/dist/yieldlabBidAdapter.js +1 -1
  139. package/dist/yieldmoBidAdapter.js +1 -1
  140. package/dist/yieldoneAnalyticsAdapter.js +1 -1
  141. package/dist/yieldoneBidAdapter.js +1 -1
  142. package/governance.md +5 -11
  143. package/gulpHelpers.js +1 -1
  144. package/gulpfile.js +1 -1
  145. package/karma.conf.maker.js +3 -1
  146. package/modules/.submodules.json +1 -0
  147. package/modules/33acrossBidAdapter.js +5 -1
  148. package/modules/adkernelBidAdapter.js +2 -1
  149. package/modules/adotBidAdapter.js +3 -3
  150. package/modules/adqueryBidAdapter.js +5 -1
  151. package/modules/appnexusBidAdapter.js +3 -3
  152. package/modules/cpexIdSystem.js +7 -8
  153. package/modules/criteoBidAdapter.js +7 -1
  154. package/modules/cwireBidAdapter.md +1 -1
  155. package/modules/debugging/bidInterceptor.js +1 -1
  156. package/modules/debugging/index.js +2 -1
  157. package/modules/dianomiBidAdapter.js +369 -0
  158. package/modules/dianomiBidAdapter.md +73 -0
  159. package/modules/finativeBidAdapter.js +235 -0
  160. package/modules/finativeBidAdapter.md +45 -0
  161. package/modules/fpdModule/index.js +6 -5
  162. package/modules/gdprEnforcement.js +8 -14
  163. package/modules/gumgumBidAdapter.js +2 -0
  164. package/modules/gumgumBidAdapter.md +19 -1
  165. package/modules/hadronAnalyticsAdapter.md +5 -5
  166. package/modules/hadronIdSystem.js +18 -5
  167. package/modules/hadronIdSystem.md +15 -11
  168. package/modules/hadronRtdProvider.js +14 -1
  169. package/modules/hadronRtdProvider.md +17 -13
  170. package/modules/insticatorBidAdapter.js +9 -0
  171. package/modules/ixBidAdapter.js +457 -57
  172. package/modules/ixBidAdapter.md +95 -5
  173. package/modules/kargoAnalyticsAdapter.js +88 -6
  174. package/modules/kargoAnalyticsAdapter.md +33 -0
  175. package/modules/kargoBidAdapter.js +1 -2
  176. package/modules/lassoBidAdapter.js +133 -0
  177. package/modules/lassoBidAdapter.md +29 -0
  178. package/modules/medianetBidAdapter.js +9 -5
  179. package/modules/missenaBidAdapter.js +20 -2
  180. package/modules/nativoBidAdapter.js +19 -7
  181. package/modules/openxBidAdapter.md +3 -1
  182. package/modules/openxOrtbBidAdapter.js +349 -0
  183. package/modules/openxOrtbBidAdapter.md +105 -0
  184. package/modules/pubCommonId.js +1 -2
  185. package/modules/readpeakBidAdapter.js +15 -6
  186. package/modules/relaidoBidAdapter.js +19 -4
  187. package/modules/riseBidAdapter.js +1 -0
  188. package/modules/seedtagBidAdapter.js +33 -1
  189. package/modules/sharedIdSystem.js +11 -5
  190. package/modules/sharethroughBidAdapter.js +9 -24
  191. package/modules/shinezBidAdapter.js +435 -0
  192. package/modules/shinezBidAdapter.md +76 -0
  193. package/modules/sonobiBidAdapter.js +28 -9
  194. package/modules/sovrnBidAdapter.js +16 -10
  195. package/modules/taboolaBidAdapter.js +1 -1
  196. package/modules/taboolaBidAdapter.md +3 -3
  197. package/modules/tncIdSystem.js +63 -0
  198. package/modules/tncIdSystem.md +33 -0
  199. package/modules/userId/eids.js +12 -0
  200. package/modules/userId/eids.md +7 -0
  201. package/modules/userId/userId.md +17 -0
  202. package/modules/ventesBidAdapter.js +1 -1
  203. package/modules/ventesBidAdapter.md +1 -1
  204. package/modules/vrtcalBidAdapter.js +35 -0
  205. package/modules/yieldlabBidAdapter.js +4 -0
  206. package/modules/yieldmoBidAdapter.js +20 -2
  207. package/modules/yieldoneBidAdapter.js +12 -1
  208. package/package.json +1 -1
  209. package/plugins/pbjsGlobals.js +2 -1
  210. package/src/adloader.js +1 -0
  211. package/src/prebid.js +4 -1
  212. package/src/storageManager.js +4 -5
  213. package/test/spec/modules/33acrossBidAdapter_spec.js +39 -0
  214. package/test/spec/modules/appnexusBidAdapter_spec.js +165 -156
  215. package/test/spec/modules/cpexIdSystem_spec.js +5 -5
  216. package/test/spec/modules/criteoBidAdapter_spec.js +15 -5
  217. package/test/spec/modules/debugging_mod_spec.js +7 -0
  218. package/test/spec/modules/dianomiBidAdapter_spec.js +1223 -0
  219. package/test/spec/modules/eids_spec.js +26 -1
  220. package/test/spec/modules/finativeBidAdapter_spec.js +186 -0
  221. package/test/spec/modules/fpdModule_spec.js +28 -1
  222. package/test/spec/modules/gdprEnforcement_spec.js +53 -100
  223. package/test/spec/modules/gumgumBidAdapter_spec.js +5 -0
  224. package/test/spec/modules/hadronIdSystem_spec.js +2 -2
  225. package/test/spec/modules/insticatorBidAdapter_spec.js +22 -1
  226. package/test/spec/modules/ixBidAdapter_spec.js +429 -10
  227. package/test/spec/modules/kargoAnalyticsAdapter_spec.js +42 -0
  228. package/test/spec/modules/kargoBidAdapter_spec.js +1 -0
  229. package/test/spec/modules/lassoBidAdapter_spec.js +177 -0
  230. package/test/spec/modules/medianetBidAdapter_spec.js +24 -1
  231. package/test/spec/modules/missenaBidAdapter_spec.js +36 -14
  232. package/test/spec/modules/nativoBidAdapter_spec.js +67 -17
  233. package/test/spec/modules/openxOrtbBidAdapter_spec.js +1303 -0
  234. package/test/spec/modules/readpeakBidAdapter_spec.js +1 -0
  235. package/test/spec/modules/relaidoBidAdapter_spec.js +29 -2
  236. package/test/spec/modules/riseBidAdapter_spec.js +3 -0
  237. package/test/spec/modules/seedtagBidAdapter_spec.js +4 -0
  238. package/test/spec/modules/sharethroughBidAdapter_spec.js +4 -4
  239. package/test/spec/modules/shinezBidAdapter_spec.js +479 -0
  240. package/test/spec/modules/sonobiBidAdapter_spec.js +38 -23
  241. package/test/spec/modules/sovrnBidAdapter_spec.js +39 -5
  242. package/test/spec/modules/taboolaBidAdapter_spec.js +1 -1
  243. package/test/spec/modules/tncIdSystem_spec.js +109 -0
  244. package/test/spec/modules/userId_spec.js +6 -3
  245. package/test/spec/modules/ventesBidAdapter_spec.js +2 -2
  246. package/test/spec/modules/vrtcalBidAdapter_spec.js +17 -0
  247. package/test/spec/modules/yieldlabBidAdapter_spec.js +4 -0
  248. package/test/spec/modules/yieldmoBidAdapter_spec.js +15 -2
  249. package/test/spec/modules/yieldoneBidAdapter_spec.js +43 -2
  250. package/test/spec/unit/pbjs_api_spec.js +23 -0
  251. package/webpack.conf.js +1 -1
@@ -0,0 +1,177 @@
1
+ import { expect } from 'chai';
2
+ import { spec } from 'modules/lassoBidAdapter.js';
3
+ import { server } from '../../mocks/xhr';
4
+
5
+ const ENDPOINT_URL = 'https://trc.lhmos.com/prebid';
6
+
7
+ const bid = {
8
+ bidder: 'lasso',
9
+ params: {
10
+ adUnitId: 123456
11
+ },
12
+ auctionStart: Date.now(),
13
+ adUnitCode: 'adunit-code',
14
+ auctionId: 'cfa6f46d-4584-46e1-9c00-54769abb51e3',
15
+ bidderRequestId: 'a123b456c789d',
16
+ bidId: '123a456b789',
17
+ mediaTypes: {
18
+ banner: {
19
+ sizes: [[300, 250]]
20
+ }
21
+ },
22
+ sizes: [[300, 250]],
23
+ src: 'client',
24
+ transactionId: '26740296-0111-4b7a-80df-7196823026f4'
25
+ };
26
+
27
+ const bidderRequest = {
28
+ auctionId: 'cfa6f46d-4584-46e1-9c00-54769abb51e3',
29
+ auctionStart: Date.now(),
30
+ start: Date.now(),
31
+ biddeCode: 'lasso',
32
+ bidderRequestId: 'a123b456c789d',
33
+ bids: [bid],
34
+ timeout: 10000
35
+ };
36
+
37
+ describe('lassoBidAdapter', function () {
38
+ describe('All needed functions are available', function() {
39
+ it(`isBidRequestValid is present and type function`, function () {
40
+ expect(spec.isBidRequestValid).to.exist.and.to.be.a('function')
41
+ });
42
+
43
+ it(`buildRequests is present and type function`, function () {
44
+ expect(spec.buildRequests).to.exist.and.to.be.a('function')
45
+ });
46
+
47
+ it(`interpretResponse is present and type function`, function () {
48
+ expect(spec.interpretResponse).to.exist.and.to.be.a('function')
49
+ });
50
+
51
+ it(`onTimeout is present and type function`, function () {
52
+ expect(spec.onTimeout).to.exist.and.to.be.a('function')
53
+ });
54
+
55
+ it(`onBidWon is present and type function`, function () {
56
+ expect(spec.onBidWon).to.exist.and.to.be.a('function')
57
+ });
58
+ });
59
+
60
+ describe('isBidRequestValid', function () {
61
+ it('should return true when required params found', function () {
62
+ expect(spec.isBidRequestValid(bid)).to.equal(true);
63
+ });
64
+ it('should return true when there are extra params', function () {
65
+ const bid = Object.assign({}, bid, {
66
+ params: {
67
+ adUnitId: 123456,
68
+ zone: 1,
69
+ publisher: 'test'
70
+ }
71
+ })
72
+ expect(spec.isBidRequestValid(bid)).to.equal(true);
73
+ });
74
+ it('should return false when there are no params', function () {
75
+ const invalidBid = { ...bid };
76
+ delete invalidBid.params;
77
+ expect(spec.isBidRequestValid(invalidBid)).to.equal(false);
78
+ });
79
+ });
80
+
81
+ describe('buildRequests', function () {
82
+ const validBidRequests = spec.buildRequests([bid], bidderRequest);
83
+ expect(validBidRequests).to.be.an('array').that.is.not.empty;
84
+
85
+ const bidRequest = validBidRequests[0];
86
+
87
+ it('Returns valid bidRequest', function () {
88
+ expect(bidRequest).to.exist;
89
+ expect(bidRequest.method).to.exist;
90
+ expect(bidRequest.url).to.exist;
91
+ expect(bidRequest.data).to.exist;
92
+ });
93
+
94
+ it('Returns GET method', function() {
95
+ expect(bidRequest.method).to.exist;
96
+ expect(bidRequest.method).to.equal('GET');
97
+ });
98
+ });
99
+
100
+ describe('interpretResponse', function () {
101
+ let serverResponse = {
102
+ body: {
103
+ bidid: '123456789',
104
+ id: '33302780340222111',
105
+ bid: {
106
+ price: 1,
107
+ w: 728,
108
+ h: 90,
109
+ crid: 123456,
110
+ ad: '<script>console.log("ad");</script>',
111
+ mediaType: 'banner'
112
+ },
113
+ meta: {
114
+ cat: ['1', '2', '3', '4'],
115
+ advertiserDomains: ['lassomarketing.io'],
116
+ advertiserName: 'Lasso'
117
+ },
118
+ cur: 'USD',
119
+ netRevenue: false,
120
+ ttl: 300,
121
+ }
122
+ };
123
+
124
+ it('should get the correct bid response', function () {
125
+ let expectedResponse = {
126
+ requestId: '123456789',
127
+ cpm: 1,
128
+ currency: 'USD',
129
+ width: 728,
130
+ height: 90,
131
+ creativeId: 123456,
132
+ netRevenue: false,
133
+ ttl: 300,
134
+ ad: '<script>console.log("ad");</script>',
135
+ mediaType: 'banner',
136
+ meta: {
137
+ secondaryCatIds: ['1', '2', '3', '4'],
138
+ advertiserDomains: ['lassomarketing.io'],
139
+ advertiserName: 'Lasso',
140
+ mediaType: 'banner'
141
+ }
142
+ };
143
+ let result = spec.interpretResponse(serverResponse);
144
+ expect(Object.keys(result[0])).to.deep.equal(Object.keys(expectedResponse));
145
+ });
146
+ });
147
+
148
+ describe('onTimeout', () => {
149
+ it('should send timeout', () => {
150
+ const timeoutData = {
151
+ bidder: 'lasso',
152
+ auctionId: 'cfa6f46d-4584-46e1-9c00-54769abb51e3',
153
+ dUnitCode: 'adunit-code',
154
+ bidId: '123a456b789',
155
+ params: {
156
+ adUnitId: 123456,
157
+ },
158
+ timeout: 3000
159
+ };
160
+ spec.onTimeout(timeoutData);
161
+
162
+ expect(server.requests[0].method).to.equal('POST');
163
+ expect(server.requests[0].url).to.equal(ENDPOINT_URL + '/timeout');
164
+ expect(JSON.parse(server.requests[0].requestBody)).to.deep.equal(timeoutData);
165
+ });
166
+ });
167
+
168
+ describe('onBidWon', () => {
169
+ it('should send bid won request', () => {
170
+ spec.onBidWon(bid);
171
+
172
+ expect(server.requests[0].method).to.equal('POST');
173
+ expect(server.requests[0].url).to.equal(ENDPOINT_URL + '/won');
174
+ expect(JSON.parse(server.requests[0].requestBody)).to.deep.equal(bid);
175
+ });
176
+ });
177
+ });
@@ -361,6 +361,9 @@ let VALID_BID_REQUEST = [{
361
361
  'refererInfo': {
362
362
  referer: 'http://media.net/prebidtest',
363
363
  stack: ['http://media.net/prebidtest'],
364
+ page: 'http://media.net/page',
365
+ domain: 'media.net',
366
+ topmostLocation: 'http://media.net/topmost',
364
367
  reachedTop: true
365
368
  }
366
369
  },
@@ -369,6 +372,7 @@ let VALID_BID_REQUEST = [{
369
372
  'page': 'http://media.net/prebidtest',
370
373
  'domain': 'media.net',
371
374
  'ref': 'http://media.net/prebidtest',
375
+ 'topMostLocation': 'http://media.net/topmost',
372
376
  'isTop': true
373
377
  },
374
378
  'ext': {
@@ -385,6 +389,7 @@ let VALID_BID_REQUEST = [{
385
389
  'id': 'aafabfd0-28c0-4ac0-aa09-99689e88b81d',
386
390
  'imp': [{
387
391
  'id': '28f8f8130a583e',
392
+ 'transactionId': '277b631f-92f5-4844-8b19-ea13c095d3f1',
388
393
  'ext': {
389
394
  'dfp_id': 'div-gpt-ad-1460505748561-0',
390
395
  'visibility': 1,
@@ -417,6 +422,7 @@ let VALID_BID_REQUEST = [{
417
422
  }
418
423
  }, {
419
424
  'id': '3f97ca71b1e5c2',
425
+ 'transactionId': 'c52a5c62-3c2b-4b90-9ff8-ec1487754822',
420
426
  'ext': {
421
427
  'dfp_id': 'div-gpt-ad-1460505748561-123',
422
428
  'visibility': 1,
@@ -454,6 +460,7 @@ let VALID_BID_REQUEST = [{
454
460
  'page': 'http://media.net/prebidtest',
455
461
  'domain': 'media.net',
456
462
  'ref': 'http://media.net/prebidtest',
463
+ 'topMostLocation': 'http://media.net/topmost',
457
464
  'isTop': true
458
465
  },
459
466
  'ext': {
@@ -470,6 +477,7 @@ let VALID_BID_REQUEST = [{
470
477
  'id': 'aafabfd0-28c0-4ac0-aa09-99689e88b81d',
471
478
  'imp': [{
472
479
  'id': '28f8f8130a583e',
480
+ 'transactionId': '277b631f-92f5-4844-8b19-ea13c095d3f1',
473
481
  'ext': {
474
482
  'dfp_id': 'div-gpt-ad-1460505748561-0',
475
483
  'visibility': 1,
@@ -502,6 +510,7 @@ let VALID_BID_REQUEST = [{
502
510
  }
503
511
  }, {
504
512
  'id': '3f97ca71b1e5c2',
513
+ 'transactionId': 'c52a5c62-3c2b-4b90-9ff8-ec1487754822',
505
514
  'ext': {
506
515
  'dfp_id': 'div-gpt-ad-1460505748561-123',
507
516
  'visibility': 1,
@@ -540,6 +549,7 @@ let VALID_BID_REQUEST = [{
540
549
  'page': 'http://media.net/prebidtest',
541
550
  'domain': 'media.net',
542
551
  'ref': 'http://media.net/prebidtest',
552
+ 'topMostLocation': 'http://media.net/topmost',
543
553
  'isTop': true
544
554
  },
545
555
  'ext': {
@@ -556,6 +566,7 @@ let VALID_BID_REQUEST = [{
556
566
  'id': 'aafabfd0-28c0-4ac0-aa09-99689e88b81d',
557
567
  'imp': [{
558
568
  'id': '28f8f8130a583e',
569
+ 'transactionId': '277b631f-92f5-4844-8b19-ea13c095d3f1',
559
570
  'ext': {
560
571
  'dfp_id': 'div-gpt-ad-1460505748561-0',
561
572
  'visibility': 1,
@@ -587,6 +598,7 @@ let VALID_BID_REQUEST = [{
587
598
  }
588
599
  }, {
589
600
  'id': '3f97ca71b1e5c2',
601
+ 'transactionId': 'c52a5c62-3c2b-4b90-9ff8-ec1487754822',
590
602
  'ext': {
591
603
  'dfp_id': 'div-gpt-ad-1460505748561-123',
592
604
  'visibility': 1,
@@ -624,6 +636,7 @@ let VALID_BID_REQUEST = [{
624
636
  'page': 'http://media.net/prebidtest',
625
637
  'domain': 'media.net',
626
638
  'ref': 'http://media.net/prebidtest',
639
+ 'topMostLocation': 'http://media.net/topmost',
627
640
  'isTop': true
628
641
  },
629
642
  'ext': {
@@ -643,6 +656,7 @@ let VALID_BID_REQUEST = [{
643
656
  'id': 'aafabfd0-28c0-4ac0-aa09-99689e88b81d',
644
657
  'imp': [{
645
658
  'id': '28f8f8130a583e',
659
+ 'transactionId': '277b631f-92f5-4844-8b19-ea13c095d3f1',
646
660
  'tagid': 'crid',
647
661
  'ext': {
648
662
  'dfp_id': 'div-gpt-ad-1460505748561-0',
@@ -676,6 +690,7 @@ let VALID_BID_REQUEST = [{
676
690
  }
677
691
  }, {
678
692
  'id': '3f97ca71b1e5c2',
693
+ 'transactionId': 'c52a5c62-3c2b-4b90-9ff8-ec1487754822',
679
694
  'tagid': 'crid',
680
695
  'ext': {
681
696
  'dfp_id': 'div-gpt-ad-1460505748561-123',
@@ -715,6 +730,7 @@ let VALID_BID_REQUEST = [{
715
730
  'page': 'http://media.net/prebidtest',
716
731
  'domain': 'media.net',
717
732
  'ref': 'http://media.net/prebidtest',
733
+ 'topMostLocation': 'http://media.net/topmost',
718
734
  'isTop': true
719
735
  },
720
736
  'ext': {
@@ -731,6 +747,7 @@ let VALID_BID_REQUEST = [{
731
747
  'id': 'aafabfd0-28c0-4ac0-aa09-99689e88b81d',
732
748
  'imp': [{
733
749
  'id': '28f8f8130a583e',
750
+ 'transactionId': '277b631f-92f5-4844-8b19-ea13c095d3f1',
734
751
  'tagid': 'crid',
735
752
  'ext': {
736
753
  'dfp_id': 'div-gpt-ad-1460505748561-0',
@@ -764,6 +781,7 @@ let VALID_BID_REQUEST = [{
764
781
  }
765
782
  }, {
766
783
  'id': '3f97ca71b1e5c2',
784
+ 'transactionId': 'c52a5c62-3c2b-4b90-9ff8-ec1487754822',
767
785
  'tagid': 'crid',
768
786
  'ext': {
769
787
  'dfp_id': 'div-gpt-ad-1460505748561-123',
@@ -1105,6 +1123,9 @@ let VALID_BID_REQUEST = [{
1105
1123
  refererInfo: {
1106
1124
  referer: 'http://media.net/prebidtest',
1107
1125
  stack: ['http://media.net/prebidtest'],
1126
+ page: 'http://media.net/page',
1127
+ domain: 'media.net',
1128
+ topmostLocation: 'http://media.net/topmost',
1108
1129
  reachedTop: true
1109
1130
  }
1110
1131
  },
@@ -1113,8 +1134,8 @@ let VALID_BID_REQUEST = [{
1113
1134
  'domain': 'media.net',
1114
1135
  'page': 'http://media.net/prebidtest',
1115
1136
  'ref': 'http://media.net/prebidtest',
1137
+ 'topMostLocation': 'http://media.net/topmost',
1116
1138
  'isTop': true
1117
-
1118
1139
  },
1119
1140
  'ext': {
1120
1141
  'customer_id': 'customer_id',
@@ -1132,6 +1153,7 @@ let VALID_BID_REQUEST = [{
1132
1153
  'id': 'aafabfd0-28c0-4ac0-aa09-99689e88b81d',
1133
1154
  'imp': [{
1134
1155
  'id': '28f8f8130a583e',
1156
+ 'transactionId': '277b631f-92f5-4844-8b19-ea13c095d3f1',
1135
1157
  'ext': {
1136
1158
  'dfp_id': 'div-gpt-ad-1460505748561-0',
1137
1159
  'visibility': 1,
@@ -1163,6 +1185,7 @@ let VALID_BID_REQUEST = [{
1163
1185
  }
1164
1186
  }, {
1165
1187
  'id': '3f97ca71b1e5c2',
1188
+ 'transactionId': 'c52a5c62-3c2b-4b90-9ff8-ec1487754822',
1166
1189
  'ext': {
1167
1190
  'dfp_id': 'div-gpt-ad-1460505748561-123',
1168
1191
  'visibility': 1,
@@ -133,25 +133,47 @@ describe('Missena Adapter', function () {
133
133
  });
134
134
 
135
135
  describe('getUserSyncs', function () {
136
- const expectedUserSyncs = [
137
- { type: 'iframe', url: 'https://sync.missena.io/iframe' },
138
- ];
139
- const serverResponses = [];
136
+ const syncFrameUrl = 'https://sync.missena.io/iframe';
137
+ const consentString = 'sampleString';
138
+ const iframeEnabledOptions = {
139
+ iframeEnabled: true,
140
+ };
141
+ const iframeDisabledOptions = {
142
+ iframeEnabled: false,
143
+ };
140
144
 
141
145
  it('should return userSync when iframeEnabled', function () {
142
- const syncOptions = {
143
- iframeEnabled: true,
144
- };
145
- const userSyncs = spec.getUserSyncs(syncOptions, serverResponses);
146
- expect(userSyncs).to.deep.equal(expectedUserSyncs);
146
+ const userSync = spec.getUserSyncs(iframeEnabledOptions, []);
147
+
148
+ expect(userSync.length).to.be.equal(1);
149
+ expect(userSync[0].type).to.be.equal('iframe');
150
+ expect(userSync[0].url).to.be.equal(syncFrameUrl);
147
151
  });
148
152
 
149
153
  it('should return empty array when iframeEnabled is false', function () {
150
- const syncOptions = {
151
- iframeEnabled: false,
152
- };
153
- const userSyncs = spec.getUserSyncs(syncOptions, serverResponses);
154
- expect(userSyncs).to.deep.equal([]);
154
+ const userSync = spec.getUserSyncs(iframeDisabledOptions, []);
155
+ expect(userSync.length).to.be.equal(0);
156
+ });
157
+
158
+ it('sync frame url should contain gdpr data when present', function () {
159
+ const userSync = spec.getUserSyncs(iframeEnabledOptions, [], {
160
+ gdprApplies: true,
161
+ consentString,
162
+ });
163
+ const expectedUrl = `${syncFrameUrl}?gdpr=1&gdpr_consent=${consentString}`;
164
+ expect(userSync.length).to.be.equal(1);
165
+ expect(userSync[0].type).to.be.equal('iframe');
166
+ expect(userSync[0].url).to.be.equal(expectedUrl);
167
+ });
168
+ it('sync frame url should contain gdpr data when present (gdprApplies false)', function () {
169
+ const userSync = spec.getUserSyncs(iframeEnabledOptions, [], {
170
+ gdprApplies: false,
171
+ consentString,
172
+ });
173
+ const expectedUrl = `${syncFrameUrl}?gdpr=0&gdpr_consent=${consentString}`;
174
+ expect(userSync.length).to.be.equal(1);
175
+ expect(userSync[0].type).to.be.equal('iframe');
176
+ expect(userSync[0].url).to.be.equal(expectedUrl);
155
177
  });
156
178
  });
157
179
  });
@@ -1,5 +1,33 @@
1
1
  import { expect } from 'chai'
2
- import { spec } from 'modules/nativoBidAdapter.js'
2
+ import { spec, BidDataMap } from 'modules/nativoBidAdapter.js'
3
+
4
+ describe('bidDataMap', function () {
5
+ it('Should fail gracefully if no key value pairs have been added and no key is sent', function () {
6
+ const bdm = new BidDataMap()
7
+ const bidData = bdm.getBidData()
8
+ expect(bidData).to.be.undefined
9
+ })
10
+
11
+ it('Should fail gracefully if no key value pairs have been added', function () {
12
+ const bdm = new BidDataMap()
13
+ const bidData = bdm.getBidData('testKey')
14
+ expect(bidData).to.be.undefined
15
+ })
16
+
17
+ it('Should add bid data to corresponding keys', function () {
18
+ const keys = ['key1', 'anotherKey', 6]
19
+ const bidData = { prop: 'value' }
20
+
21
+ const bdm = new BidDataMap()
22
+ bdm.addBidData(bidData, keys)
23
+ const bidDataKey0 = bdm.getBidData(keys[0])
24
+ const bidDataKey1 = bdm.getBidData(keys[1])
25
+ const bidDataKey2 = bdm.getBidData(keys[2])
26
+ expect(bidDataKey0).to.be.equal(bidData)
27
+ expect(bidDataKey1).to.be.equal(bidData)
28
+ expect(bidDataKey2).to.be.equal(bidData)
29
+ })
30
+ })
3
31
 
4
32
  describe('nativoBidAdapterTests', function () {
5
33
  describe('isBidRequestValid', function () {
@@ -48,23 +76,28 @@ describe('nativoBidAdapterTests', function () {
48
76
  })
49
77
 
50
78
  describe('buildRequests', function () {
51
- let bidRequests = [
52
- {
53
- bidder: 'nativo',
54
- params: {
55
- placementId: '10433394',
56
- },
57
- adUnitCode: 'adunit-code',
58
- sizes: [
59
- [300, 250],
60
- [300, 600],
61
- ],
62
- bidId: '27b02036ccfa6e',
63
- bidderRequestId: '1372cd8bd8d6a8',
64
- auctionId: 'cfc467e4-2707-48da-becb-bcaab0b2c114',
65
- transactionId: '3b36e7e0-0c3e-4006-a279-a741239154ff',
79
+ const bidRequest = {
80
+ bidder: 'nativo',
81
+ params: {
82
+ placementId: '10433394',
66
83
  },
67
- ]
84
+ adUnitCode: 'adunit-code',
85
+ sizes: [
86
+ [300, 250],
87
+ [300, 600],
88
+ ],
89
+ bidId: '27b02036ccfa6e',
90
+ bidderRequestId: '1372cd8bd8d6a8',
91
+ auctionId: 'cfc467e4-2707-48da-becb-bcaab0b2c114',
92
+ transactionId: '3b36e7e0-0c3e-4006-a279-a741239154ff',
93
+ }
94
+ const bidRequestString = JSON.stringify(bidRequest)
95
+ let bidRequests
96
+
97
+ beforeEach(function() {
98
+ // Clone bidRequest each time
99
+ bidRequests = [JSON.parse(bidRequestString)]
100
+ })
68
101
 
69
102
  it('url should contain query string parameters', function () {
70
103
  const request = spec.buildRequests(bidRequests, {
@@ -83,6 +116,23 @@ describe('nativoBidAdapterTests', function () {
83
116
  expect(request.url).to.include('ntv_ppc')
84
117
  expect(request.url).to.include('ntv_url')
85
118
  expect(request.url).to.include('ntv_dbr')
119
+ expect(request.url).to.include('ntv_pas')
120
+ })
121
+
122
+ it('url should NOT contain placement specific query string parameters if placementId option is not provided', function () {
123
+ bidRequests[0].params = {}
124
+ const request = spec.buildRequests(bidRequests, {
125
+ bidderRequestId: 123456,
126
+ refererInfo: {
127
+ referer: 'https://www.test.com',
128
+ },
129
+ })
130
+
131
+ expect(request.url).to.exist
132
+ expect(request.url).to.be.a('string')
133
+
134
+ expect(request.url).to.not.include('ntv_pas')
135
+ expect(request.url).to.not.include('ntv_ptd')
86
136
  })
87
137
  })
88
138
  })