prebid.js 6.26.0 → 6.29.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 (261) hide show
  1. package/dist/33acrossBidAdapter.js +1 -1
  2. package/dist/adWMGAnalyticsAdapter.js +1 -1
  3. package/dist/adagioAnalyticsAdapter.js +1 -1
  4. package/dist/adagioBidAdapter.js +1 -1
  5. package/dist/adbookpspBidAdapter.js +1 -1
  6. package/dist/adfBidAdapter.js +1 -1
  7. package/dist/adgenerationBidAdapter.js +1 -1
  8. package/dist/adkernelAdnAnalyticsAdapter.js +1 -1
  9. package/dist/adlooxAdServerVideo.js +1 -1
  10. package/dist/adlooxAnalyticsAdapter.js +1 -1
  11. package/dist/adlooxRtdProvider.js +1 -1
  12. package/dist/adoceanBidAdapter.js +1 -1
  13. package/dist/adomikAnalyticsAdapter.js +1 -1
  14. package/dist/adrelevantisBidAdapter.js +1 -1
  15. package/dist/adxcgAnalyticsAdapter.js +1 -1
  16. package/dist/adxcgBidAdapter.js +1 -1
  17. package/dist/adxpremiumAnalyticsAdapter.js +1 -1
  18. package/dist/adyoulikeBidAdapter.js +1 -1
  19. package/dist/ajaBidAdapter.js +1 -1
  20. package/dist/akamaiDapRtdProvider.js +1 -1
  21. package/dist/amxBidAdapter.js +1 -1
  22. package/dist/amxIdSystem.js +1 -1
  23. package/dist/appierAnalyticsAdapter.js +1 -1
  24. package/dist/appnexusAnalyticsAdapter.js +1 -1
  25. package/dist/appnexusBidAdapter.js +1 -1
  26. package/dist/asoBidAdapter.js +1 -1
  27. package/dist/atsAnalyticsAdapter.js +1 -1
  28. package/dist/audiencerunBidAdapter.js +1 -1
  29. package/dist/automatadBidAdapter.js +1 -1
  30. package/dist/axonixBidAdapter.js +1 -1
  31. package/dist/bidglassBidAdapter.js +1 -1
  32. package/dist/bidwatchAnalyticsAdapter.js +1 -1
  33. package/dist/big-richmediaBidAdapter.js +1 -1
  34. package/dist/bluebillywigBidAdapter.js +1 -1
  35. package/dist/bridgewellBidAdapter.js +1 -1
  36. package/dist/brightMountainMediaBidAdapter.js +1 -1
  37. package/dist/byDataAnalyticsAdapter.js +1 -1
  38. package/dist/colossussspBidAdapter.js +1 -1
  39. package/dist/concertAnalyticsAdapter.js +1 -1
  40. package/dist/concertBidAdapter.js +1 -1
  41. package/dist/connectadBidAdapter.js +1 -1
  42. package/dist/consumableBidAdapter.js +1 -1
  43. package/dist/conversantBidAdapter.js +1 -1
  44. package/dist/craftBidAdapter.js +1 -1
  45. package/dist/criteoBidAdapter.js +1 -1
  46. package/dist/datablocksAnalyticsAdapter.js +1 -1
  47. package/dist/dspxBidAdapter.js +1 -1
  48. package/dist/eplanningAnalyticsAdapter.js +1 -1
  49. package/dist/eplanningBidAdapter.js +1 -1
  50. package/dist/fintezaAnalyticsAdapter.js +1 -1
  51. package/dist/ftrackIdSystem.js +1 -1
  52. package/dist/gdprEnforcement.js +1 -1
  53. package/dist/glimpseBidAdapter.js +1 -1
  54. package/dist/gmosspBidAdapter.js +1 -1
  55. package/dist/goldbachBidAdapter.js +1 -1
  56. package/dist/gridBidAdapter.js +1 -1
  57. package/dist/gridNMBidAdapter.js +1 -1
  58. package/dist/gumgumBidAdapter.js +1 -1
  59. package/dist/h12mediaBidAdapter.js +1 -1
  60. package/dist/hadronAnalyticsAdapter.js +1 -1
  61. package/dist/hadronRtdProvider.js +1 -1
  62. package/dist/id5AnalyticsAdapter.js +1 -1
  63. package/dist/id5IdSystem.js +1 -1
  64. package/dist/impactifyBidAdapter.js +1 -1
  65. package/dist/improvedigitalBidAdapter.js +1 -1
  66. package/dist/incrxBidAdapter.js +1 -0
  67. package/dist/inmarBidAdapter.js +1 -1
  68. package/dist/inskinBidAdapter.js +1 -1
  69. package/dist/insticatorBidAdapter.js +1 -1
  70. package/dist/invisiblyAnalyticsAdapter.js +1 -1
  71. package/dist/ixBidAdapter.js +1 -1
  72. package/dist/jixieBidAdapter.js +1 -1
  73. package/dist/justpremiumBidAdapter.js +1 -1
  74. package/dist/kargoAnalyticsAdapter.js +1 -1
  75. package/dist/kargoBidAdapter.js +1 -1
  76. package/dist/koblerBidAdapter.js +1 -1
  77. package/dist/konduitAnalyticsAdapter.js +1 -1
  78. package/dist/livewrappedAnalyticsAdapter.js +1 -1
  79. package/dist/liveyieldAnalyticsAdapter.js +1 -1
  80. package/dist/logicadBidAdapter.js +1 -1
  81. package/dist/loglyliftBidAdapter.js +1 -1
  82. package/dist/malltvAnalyticsAdapter.js +1 -1
  83. package/dist/mantisBidAdapter.js +1 -1
  84. package/dist/marsmediaAnalyticsAdapter.js +1 -1
  85. package/dist/marsmediaBidAdapter.js +1 -1
  86. package/dist/mediafuseBidAdapter.js +1 -1
  87. package/dist/mediakeysBidAdapter.js +1 -1
  88. package/dist/medianetAnalyticsAdapter.js +1 -1
  89. package/dist/medianetBidAdapter.js +1 -1
  90. package/dist/medianetRtdProvider.js +1 -1
  91. package/dist/mediasquareBidAdapter.js +1 -1
  92. package/dist/merkleIdSystem.js +1 -1
  93. package/dist/mgidBidAdapter.js +1 -1
  94. package/dist/minutemediaBidAdapter.js +1 -1
  95. package/dist/naveggIdSystem.js +1 -1
  96. package/dist/not-for-prod/prebid.js +178 -176
  97. package/dist/novatiqIdSystem.js +1 -1
  98. package/dist/oguryBidAdapter.js +1 -1
  99. package/dist/oneVideoBidAdapter.js +1 -1
  100. package/dist/onetagBidAdapter.js +1 -1
  101. package/dist/ooloAnalyticsAdapter.js +1 -1
  102. package/dist/openxAnalyticsAdapter.js +1 -1
  103. package/dist/optimonAnalyticsAdapter.js +1 -1
  104. package/dist/outbrainBidAdapter.js +1 -1
  105. package/dist/parrableIdSystem.js +1 -1
  106. package/dist/pixfutureBidAdapter.js +1 -1
  107. package/dist/prebid-core.js +3 -3
  108. package/dist/prebidmanagerAnalyticsAdapter.js +1 -1
  109. package/dist/pubCommonId.js +1 -1
  110. package/dist/publinkIdSystem.js +1 -1
  111. package/dist/pubmaticAnalyticsAdapter.js +1 -1
  112. package/dist/pubmaticBidAdapter.js +1 -1
  113. package/dist/pubperfAnalyticsAdapter.js +1 -1
  114. package/dist/pubstackAnalyticsAdapter.js +1 -1
  115. package/dist/pubwiseAnalyticsAdapter.js +1 -1
  116. package/dist/pubxaiAnalyticsAdapter.js +1 -1
  117. package/dist/pulsepointAnalyticsAdapter.js +1 -1
  118. package/dist/pxyzBidAdapter.js +1 -1
  119. package/dist/quantcastBidAdapter.js +1 -1
  120. package/dist/readpeakBidAdapter.js +1 -1
  121. package/dist/realvuAnalyticsAdapter.js +1 -1
  122. package/dist/relaidoBidAdapter.js +1 -1
  123. package/dist/relevantAnalyticsAdapter.js +1 -1
  124. package/dist/rhythmoneBidAdapter.js +1 -1
  125. package/dist/riseBidAdapter.js +1 -1
  126. package/dist/rivrAnalyticsAdapter.js +1 -1
  127. package/dist/roxotAnalyticsAdapter.js +1 -1
  128. package/dist/rubiconAnalyticsAdapter.js +1 -1
  129. package/dist/rubiconBidAdapter.js +1 -1
  130. package/dist/scaleableAnalyticsAdapter.js +1 -1
  131. package/dist/seedingAllianceBidAdapter.js +1 -1
  132. package/dist/seedtagBidAdapter.js +1 -1
  133. package/dist/sharedIdSystem.js +1 -1
  134. package/dist/sharethroughAnalyticsAdapter.js +1 -1
  135. package/dist/sharethroughBidAdapter.js +1 -1
  136. package/dist/sigmoidAnalyticsAdapter.js +1 -1
  137. package/dist/slimcutBidAdapter.js +1 -1
  138. package/dist/smaatoBidAdapter.js +1 -1
  139. package/dist/smartadserverBidAdapter.js +1 -1
  140. package/dist/smartxBidAdapter.js +1 -1
  141. package/dist/smilewantedBidAdapter.js +1 -1
  142. package/dist/sonobiAnalyticsAdapter.js +1 -1
  143. package/dist/sonobiBidAdapter.js +1 -1
  144. package/dist/sortableAnalyticsAdapter.js +1 -1
  145. package/dist/sortableBidAdapter.js +1 -1
  146. package/dist/sovrnAnalyticsAdapter.js +1 -1
  147. package/dist/sovrnBidAdapter.js +1 -1
  148. package/dist/spotxBidAdapter.js +1 -1
  149. package/dist/sspBCBidAdapter.js +1 -1
  150. package/dist/staqAnalyticsAdapter.js +1 -1
  151. package/dist/sublimeBidAdapter.js +1 -1
  152. package/dist/synacormediaBidAdapter.js +1 -1
  153. package/dist/taboolaBidAdapter.js +1 -0
  154. package/dist/targetVideoBidAdapter.js +1 -1
  155. package/dist/teadsBidAdapter.js +1 -1
  156. package/dist/telariaBidAdapter.js +1 -1
  157. package/dist/terceptAnalyticsAdapter.js +1 -1
  158. package/dist/trionBidAdapter.js +1 -1
  159. package/dist/tripleliftBidAdapter.js +1 -1
  160. package/dist/trustxBidAdapter.js +1 -1
  161. package/dist/ttdBidAdapter.js +1 -1
  162. package/dist/ucfunnelAnalyticsAdapter.js +1 -1
  163. package/dist/underdogmediaBidAdapter.js +1 -1
  164. package/dist/undertoneBidAdapter.js +1 -1
  165. package/dist/userId.js +1 -1
  166. package/dist/vidazooBidAdapter.js +1 -1
  167. package/dist/videobyteBidAdapter.js +1 -1
  168. package/dist/visxBidAdapter.js +1 -1
  169. package/dist/vuukleBidAdapter.js +1 -1
  170. package/dist/widespaceBidAdapter.js +1 -1
  171. package/dist/winrBidAdapter.js +1 -1
  172. package/dist/yahoosspBidAdapter.js +1 -1
  173. package/dist/yieldmoBidAdapter.js +1 -1
  174. package/dist/yieldoneAnalyticsAdapter.js +1 -1
  175. package/dist/yuktamediaAnalyticsAdapter.js +1 -1
  176. package/dist/zeta_global_sspAnalyticsAdapter.js +1 -1
  177. package/dist/zeta_global_sspBidAdapter.js +1 -1
  178. package/integrationExamples/gpt/akamaidap_segments_example.html +5 -3
  179. package/modules/.submodules.json +1 -0
  180. package/modules/adfBidAdapter.js +0 -3
  181. package/modules/adlooxAnalyticsAdapter.js +9 -5
  182. package/modules/adlooxAnalyticsAdapter.md +3 -3
  183. package/modules/adlooxRtdProvider.js +3 -5
  184. package/modules/adlooxRtdProvider.md +2 -2
  185. package/modules/adoceanBidAdapter.js +29 -1
  186. package/modules/adyoulikeBidAdapter.js +3 -0
  187. package/modules/akamaiDapRtdProvider.js +469 -139
  188. package/modules/akamaiDapRtdProvider.md +5 -3
  189. package/modules/automatadBidAdapter.js +9 -5
  190. package/modules/colossussspBidAdapter.js +17 -17
  191. package/modules/conversantBidAdapter.js +2 -2
  192. package/modules/criteoBidAdapter.js +1 -1
  193. package/modules/ftrackIdSystem.js +5 -8
  194. package/modules/gdprEnforcement.js +15 -9
  195. package/modules/gridBidAdapter.js +4 -0
  196. package/modules/hadronAnalyticsAdapter.js +5 -1
  197. package/modules/hadronRtdProvider.js +15 -13
  198. package/modules/incrxBidAdapter.js +87 -0
  199. package/modules/{vertozBidAdapter.md → incrxBidAdapter.md} +6 -6
  200. package/modules/inskinBidAdapter.js +4 -3
  201. package/modules/insticatorBidAdapter.js +109 -42
  202. package/modules/ixBidAdapter.js +3 -2
  203. package/modules/ixBidAdapter.md +1 -1
  204. package/modules/kargoBidAdapter.js +32 -1
  205. package/modules/koblerBidAdapter.js +54 -45
  206. package/modules/koblerBidAdapter.md +12 -17
  207. package/modules/mantisBidAdapter.js +4 -8
  208. package/modules/medianetBidAdapter.js +2 -2
  209. package/modules/medianetRtdProvider.js +4 -6
  210. package/modules/merkleIdSystem.js +43 -31
  211. package/modules/naveggIdSystem.js +3 -2
  212. package/modules/novatiqIdSystem.js +6 -1
  213. package/modules/pubCommonId.js +2 -1
  214. package/modules/pubmaticAnalyticsAdapter.js +49 -33
  215. package/modules/relaidoBidAdapter.js +0 -3
  216. package/modules/sharedIdSystem.js +5 -11
  217. package/modules/slimcutBidAdapter.js +2 -2
  218. package/modules/spotxBidAdapter.js +1 -1
  219. package/modules/synacormediaBidAdapter.js +11 -2
  220. package/modules/taboolaBidAdapter.js +265 -0
  221. package/modules/taboolaBidAdapter.md +49 -0
  222. package/modules/telariaBidAdapter.js +3 -3
  223. package/modules/userId/eids.js +25 -5
  224. package/modules/zeta_global_sspBidAdapter.js +3 -2
  225. package/package.json +1 -1
  226. package/src/AnalyticsAdapter.js +5 -1
  227. package/src/adloader.js +6 -1
  228. package/src/storageManager.js +5 -4
  229. package/test/mocks/analyticsStub.js +13 -0
  230. package/test/mocks/xhr.js +22 -0
  231. package/test/spec/AnalyticsAdapter_spec.js +4 -0
  232. package/test/spec/modules/adfBidAdapter_spec.js +1 -1
  233. package/test/spec/modules/adoceanBidAdapter_spec.js +25 -1
  234. package/test/spec/modules/adriverIdSystem_spec.js +7 -3
  235. package/test/spec/modules/adyoulikeBidAdapter_spec.js +16 -1
  236. package/test/spec/modules/akamaiDapRtdProvider_spec.js +457 -109
  237. package/test/spec/modules/automatadBidAdapter_spec.js +4 -0
  238. package/test/spec/modules/conversantBidAdapter_spec.js +36 -5
  239. package/test/spec/modules/datablocksBidAdapter_spec.js +9 -8
  240. package/test/spec/modules/eids_spec.js +48 -3
  241. package/test/spec/modules/fintezaAnalyticsAdapter_spec.js +4 -4
  242. package/test/spec/modules/ftrackIdSystem_spec.js +11 -22
  243. package/test/spec/modules/gdprEnforcement_spec.js +100 -53
  244. package/test/spec/modules/gridBidAdapter_spec.js +11 -0
  245. package/test/spec/modules/incrxBidAdapter_spec.js +100 -0
  246. package/test/spec/modules/insticatorBidAdapter_spec.js +46 -1
  247. package/test/spec/modules/ixBidAdapter_spec.js +1 -1
  248. package/test/spec/modules/kargoBidAdapter_spec.js +27 -0
  249. package/test/spec/modules/koblerBidAdapter_spec.js +160 -124
  250. package/test/spec/modules/medianetRtdProvider_spec.js +146 -0
  251. package/test/spec/modules/merkleIdSystem_spec.js +58 -37
  252. package/test/spec/modules/naveggIdSystem_spec.js +25 -1
  253. package/test/spec/modules/proxistoreBidAdapter_spec.js +0 -2
  254. package/test/spec/modules/pubmaticAnalyticsAdapter_spec.js +117 -0
  255. package/test/spec/modules/sovrnBidAdapter_spec.js +253 -264
  256. package/test/spec/modules/synacormediaBidAdapter_spec.js +74 -0
  257. package/test/spec/modules/taboolaBidAdapter_spec.js +455 -0
  258. package/test/spec/modules/userId_spec.js +27 -1
  259. package/test/spec/modules/vidazooBidAdapter_spec.js +9 -4
  260. package/test/spec/modules/zeta_global_sspBidAdapter_spec.js +4 -2
  261. package/test/test_deps.js +1 -0
@@ -16,7 +16,7 @@ function createBidderRequest(auctionId, timeout, pageUrl) {
16
16
  }
17
17
 
18
18
  function createValidBidRequest(params, bidId, sizes) {
19
- return {
19
+ const validBidRequest = {
20
20
  adUnitCode: 'adunit-code',
21
21
  bidId: bidId || '22c4871113f461',
22
22
  bidder: 'kobler',
@@ -28,11 +28,12 @@ function createValidBidRequest(params, bidId, sizes) {
28
28
  sizes: sizes || [[300, 250], [320, 100]]
29
29
  }
30
30
  },
31
- params: params || {
32
- placementId: 'tpw58278'
33
- },
34
31
  transactionTd: '04314114-15bd-4638-8664-bdb8bdc60bff'
35
32
  };
33
+ if (params) {
34
+ validBidRequest.params = params;
35
+ }
36
+ return validBidRequest;
36
37
  }
37
38
 
38
39
  describe('KoblerAdapter', function () {
@@ -56,7 +57,7 @@ describe('KoblerAdapter', function () {
56
57
  expect(result).to.be.false;
57
58
  });
58
59
 
59
- it('should not accept a request without params as valid', function () {
60
+ it('should not accept a request without mediaTypes and sizes as valid', function () {
60
61
  const bid = {
61
62
  bidId: 'e11768e8-3b71-4453-8698-0a2feb866589'
62
63
  };
@@ -66,11 +67,56 @@ describe('KoblerAdapter', function () {
66
67
  expect(result).to.be.false;
67
68
  });
68
69
 
69
- it('should not accept a request without placementId as valid', function () {
70
+ it('should not accept a request without mediaTypes and string sizes as valid', function () {
70
71
  const bid = {
71
72
  bidId: 'e11768e8-3b71-4453-8698-0a2feb866589',
72
- params: {
73
- someParam: 'abc'
73
+ sizes: 'string'
74
+ };
75
+
76
+ const result = spec.isBidRequestValid(bid);
77
+
78
+ expect(result).to.be.false;
79
+ });
80
+
81
+ it('should not accept a request without mediaTypes and empty sizes as valid', function () {
82
+ const bid = {
83
+ bidId: 'e11768e8-3b71-4453-8698-0a2feb866589',
84
+ sizes: []
85
+ };
86
+
87
+ const result = spec.isBidRequestValid(bid);
88
+
89
+ expect(result).to.be.false;
90
+ });
91
+
92
+ it('should not accept a request without mediaTypes.banner and sizes as valid', function () {
93
+ const bid = {
94
+ bidId: 'e11768e8-3b71-4453-8698-0a2feb866589',
95
+ mediaTypes: {}
96
+ };
97
+
98
+ const result = spec.isBidRequestValid(bid);
99
+
100
+ expect(result).to.be.false;
101
+ });
102
+
103
+ it('should not accept a request without mediaTypes.banner and empty sizes as valid', function () {
104
+ const bid = {
105
+ bidId: 'e11768e8-3b71-4453-8698-0a2feb866589',
106
+ sizes: [],
107
+ mediaTypes: {}
108
+ };
109
+
110
+ const result = spec.isBidRequestValid(bid);
111
+
112
+ expect(result).to.be.false;
113
+ });
114
+
115
+ it('should not accept a request without sizes and string mediaTypes.banner as valid', function () {
116
+ const bid = {
117
+ bidId: 'e11768e8-3b71-4453-8698-0a2feb866589',
118
+ mediaTypes: {
119
+ banner: 'string'
74
120
  }
75
121
  };
76
122
 
@@ -79,12 +125,67 @@ describe('KoblerAdapter', function () {
79
125
  expect(result).to.be.false;
80
126
  });
81
127
 
82
- it('should accept a request with bidId and placementId as valid', function () {
128
+ it('should not accept a request without sizes and mediaTypes.banner.sizes as valid', function () {
83
129
  const bid = {
84
130
  bidId: 'e11768e8-3b71-4453-8698-0a2feb866589',
85
- params: {
86
- someParam: 'abc',
87
- placementId: '8bde0923-1409-4253-9594-495b58d931ba'
131
+ mediaTypes: {
132
+ banner: {}
133
+ }
134
+ };
135
+
136
+ const result = spec.isBidRequestValid(bid);
137
+
138
+ expect(result).to.be.false;
139
+ });
140
+
141
+ it('should not accept a request without sizes and string mediaTypes.banner.sizes as valid', function () {
142
+ const bid = {
143
+ bidId: 'e11768e8-3b71-4453-8698-0a2feb866589',
144
+ mediaTypes: {
145
+ banner: {
146
+ sizes: 'string'
147
+ }
148
+ }
149
+ };
150
+
151
+ const result = spec.isBidRequestValid(bid);
152
+
153
+ expect(result).to.be.false;
154
+ });
155
+
156
+ it('should not accept a request without sizes and empty mediaTypes.banner.sizes as valid', function () {
157
+ const bid = {
158
+ bidId: 'e11768e8-3b71-4453-8698-0a2feb866589',
159
+ mediaTypes: {
160
+ banner: {
161
+ sizes: []
162
+ }
163
+ }
164
+ };
165
+
166
+ const result = spec.isBidRequestValid(bid);
167
+
168
+ expect(result).to.be.false;
169
+ });
170
+
171
+ it('should accept a request with bidId and sizes as valid', function () {
172
+ const bid = {
173
+ bidId: 'e11768e8-3b71-4453-8698-0a2feb866589',
174
+ sizes: [[5, 5]]
175
+ };
176
+
177
+ const result = spec.isBidRequestValid(bid);
178
+
179
+ expect(result).to.be.true;
180
+ });
181
+
182
+ it('should accept a request with bidId and mediaTypes.banner.sizes as valid', function () {
183
+ const bid = {
184
+ bidId: 'e11768e8-3b71-4453-8698-0a2feb866589',
185
+ mediaTypes: {
186
+ banner: {
187
+ sizes: [[0, 0]]
188
+ }
88
189
  }
89
190
  };
90
191
 
@@ -114,13 +215,10 @@ describe('KoblerAdapter', function () {
114
215
  const firstSize = [400, 800];
115
216
  const secondSize = [450, 950];
116
217
  const sizes = [firstSize, secondSize];
117
- const placementId = 'tsjs86325';
118
218
  const bidId = '3a56a019-4835-4f75-811c-76fac6853a2c';
119
219
  const validBidRequests = [
120
220
  createValidBidRequest(
121
- {
122
- placementId: placementId
123
- },
221
+ undefined,
124
222
  bidId,
125
223
  sizes
126
224
  )
@@ -132,7 +230,6 @@ describe('KoblerAdapter', function () {
132
230
 
133
231
  expect(openRtbRequest.imp.length).to.be.equal(1);
134
232
  expect(openRtbRequest.imp[0].id).to.be.equal(bidId);
135
- expect(openRtbRequest.imp[0].tagid).to.be.equal(placementId);
136
233
  expect(openRtbRequest.imp[0].banner.w).to.be.equal(firstSize[0]);
137
234
  expect(openRtbRequest.imp[0].banner.h).to.be.equal(firstSize[1]);
138
235
  expect(openRtbRequest.imp[0].banner.format.length).to.be.equal(2);
@@ -163,40 +260,31 @@ describe('KoblerAdapter', function () {
163
260
  expect(openRtbRequest.imp[0].banner.format[0].h).to.be.equal(0);
164
261
  });
165
262
 
166
- it('should use 0 as default position', function () {
167
- const validBidRequests = [createValidBidRequest()];
168
- const bidderRequest = createBidderRequest();
169
-
170
- const result = spec.buildRequests(validBidRequests, bidderRequest);
171
- const openRtbRequest = JSON.parse(result.data);
172
-
173
- expect(openRtbRequest.imp.length).to.be.equal(1);
174
- expect(openRtbRequest.imp[0].banner.ext.kobler.pos).to.be.equal(0);
175
- });
176
-
177
- it('should read zip from valid bid requests', function () {
178
- const zip = '700 02';
263
+ it('should read test from valid bid requests', function () {
179
264
  const validBidRequests = [
180
265
  createValidBidRequest(
181
266
  {
182
- placementId: 'nmah8324234',
183
- zip: zip
267
+ test: true
184
268
  }
185
269
  )
186
270
  ];
187
271
  const bidderRequest = createBidderRequest();
188
272
 
189
273
  const result = spec.buildRequests(validBidRequests, bidderRequest);
190
- const openRtbRequest = JSON.parse(result.data);
274
+ expect(result.url).to.be.equal('https://bid-service.dev.essrtb.com/bid/prebid_rtb_call');
191
275
 
192
- expect(openRtbRequest.device.geo.zip).to.be.equal(zip);
276
+ const openRtbRequest = JSON.parse(result.data);
277
+ expect(openRtbRequest.site.page).to.be.equal('example.com');
278
+ expect(openRtbRequest.test).to.be.equal(1);
193
279
  });
194
280
 
195
- it('should read test from valid bid requests', function () {
281
+ it('should read pageUrl from config when testing', function () {
282
+ config.setConfig({
283
+ pageUrl: 'https://testing-url.com'
284
+ });
196
285
  const validBidRequests = [
197
286
  createValidBidRequest(
198
287
  {
199
- placementId: 'zwop842799',
200
288
  test: true
201
289
  }
202
290
  )
@@ -204,49 +292,40 @@ describe('KoblerAdapter', function () {
204
292
  const bidderRequest = createBidderRequest();
205
293
 
206
294
  const result = spec.buildRequests(validBidRequests, bidderRequest);
207
- const openRtbRequest = JSON.parse(result.data);
295
+ expect(result.url).to.be.equal('https://bid-service.dev.essrtb.com/bid/prebid_rtb_call');
208
296
 
297
+ const openRtbRequest = JSON.parse(result.data);
298
+ expect(openRtbRequest.site.page).to.be.equal('https://testing-url.com');
209
299
  expect(openRtbRequest.test).to.be.equal(1);
210
300
  });
211
301
 
212
- it('should read floorPrice from valid bid requests', function () {
213
- const floorPrice = 4.343;
302
+ it('should not read pageUrl from config when not testing', function () {
303
+ config.setConfig({
304
+ pageUrl: 'https://testing-url.com'
305
+ });
214
306
  const validBidRequests = [
215
- createValidBidRequest(
216
- {
217
- placementId: 'oqr3224234',
218
- floorPrice: floorPrice
219
- }
220
- )
307
+ createValidBidRequest()
221
308
  ];
222
- const bidderRequest = createBidderRequest();
309
+ const bidderRequest = createBidderRequest(
310
+ 'f85d61cc-ed11-4b6c-aefb-87943263cedb',
311
+ 2000,
312
+ 'https://non-testing-url.net'
313
+ );
223
314
 
224
315
  const result = spec.buildRequests(validBidRequests, bidderRequest);
225
- const openRtbRequest = JSON.parse(result.data);
316
+ expect(result.url).to.be.equal('https://bid.essrtb.com/bid/prebid_rtb_call');
226
317
 
227
- expect(openRtbRequest.imp.length).to.be.equal(1);
228
- expect(openRtbRequest.imp[0].bidfloor).to.be.equal(floorPrice);
318
+ const openRtbRequest = JSON.parse(result.data);
319
+ expect(openRtbRequest.site.page).to.be.equal('https://non-testing-url.net');
320
+ expect(openRtbRequest.test).to.be.equal(0);
229
321
  });
230
322
 
231
- it('should read position from valid bid requests', function () {
232
- const placementId = 'yzksf234592';
323
+ it('should read floorPrice from valid bid requests', function () {
324
+ const floorPrice = 4.343;
233
325
  const validBidRequests = [
234
326
  createValidBidRequest(
235
327
  {
236
- placementId: placementId,
237
- position: 1
238
- }
239
- ),
240
- createValidBidRequest(
241
- {
242
- placementId: placementId,
243
- position: 2
244
- }
245
- ),
246
- createValidBidRequest(
247
- {
248
- placementId: placementId,
249
- position: 3
328
+ floorPrice: floorPrice
250
329
  }
251
330
  )
252
331
  ];
@@ -255,13 +334,8 @@ describe('KoblerAdapter', function () {
255
334
  const result = spec.buildRequests(validBidRequests, bidderRequest);
256
335
  const openRtbRequest = JSON.parse(result.data);
257
336
 
258
- expect(openRtbRequest.imp.length).to.be.equal(3);
259
- expect(openRtbRequest.imp[0].banner.ext.kobler.pos).to.be.equal(1);
260
- expect(openRtbRequest.imp[0].tagid).to.be.equal(placementId);
261
- expect(openRtbRequest.imp[1].banner.ext.kobler.pos).to.be.equal(2);
262
- expect(openRtbRequest.imp[1].tagid).to.be.equal(placementId);
263
- expect(openRtbRequest.imp[2].banner.ext.kobler.pos).to.be.equal(3);
264
- expect(openRtbRequest.imp[2].tagid).to.be.equal(placementId);
337
+ expect(openRtbRequest.imp.length).to.be.equal(1);
338
+ expect(openRtbRequest.imp[0].bidfloor).to.be.equal(floorPrice);
265
339
  });
266
340
 
267
341
  it('should read dealIds from valid bid requests', function () {
@@ -270,13 +344,11 @@ describe('KoblerAdapter', function () {
270
344
  const validBidRequests = [
271
345
  createValidBidRequest(
272
346
  {
273
- placementId: 'rsl1239823',
274
347
  dealIds: dealIds1
275
348
  }
276
349
  ),
277
350
  createValidBidRequest(
278
351
  {
279
- placementId: 'pqw234232',
280
352
  dealIds: dealIds2
281
353
  }
282
354
  )
@@ -353,10 +425,7 @@ describe('KoblerAdapter', function () {
353
425
  const validBidRequests = [
354
426
  createValidBidRequest(
355
427
  {
356
- placementId: 'pcha322364',
357
- zip: '0015',
358
428
  floorPrice: 5.6234,
359
- position: 1,
360
429
  dealIds: ['623472534328234']
361
430
  },
362
431
  '953ee65d-d18a-484f-a840-d3056185a060',
@@ -364,19 +433,14 @@ describe('KoblerAdapter', function () {
364
433
  ),
365
434
  createValidBidRequest(
366
435
  {
367
- placementId: 'sdfgoi32y4',
368
436
  floorPrice: 3.2543,
369
- position: 2,
370
437
  dealIds: ['92368234753283', '263845832942']
371
438
  },
372
439
  '8320bf79-9d90-4a17-87c6-5d505706a921',
373
440
  [[400, 500], [200, 250], [300, 350]]
374
441
  ),
375
442
  createValidBidRequest(
376
- {
377
- placementId: 'gwms2738647',
378
- position: 3
379
- },
443
+ undefined,
380
444
  'd0de713b-32e3-4191-a2df-a007f08ffe72',
381
445
  [[800, 900]]
382
446
  )
@@ -406,14 +470,8 @@ describe('KoblerAdapter', function () {
406
470
  }
407
471
  ],
408
472
  w: 400,
409
- h: 600,
410
- ext: {
411
- kobler: {
412
- pos: 1
413
- }
414
- }
473
+ h: 600
415
474
  },
416
- tagid: 'pcha322364',
417
475
  bidfloor: 5.6234,
418
476
  bidfloorcur: 'USD',
419
477
  pmp: {
@@ -442,14 +500,8 @@ describe('KoblerAdapter', function () {
442
500
  }
443
501
  ],
444
502
  w: 400,
445
- h: 500,
446
- ext: {
447
- kobler: {
448
- pos: 2
449
- }
450
- }
503
+ h: 500
451
504
  },
452
- tagid: 'sdfgoi32y4',
453
505
  bidfloor: 3.2543,
454
506
  bidfloorcur: 'USD',
455
507
  pmp: {
@@ -473,24 +525,15 @@ describe('KoblerAdapter', function () {
473
525
  }
474
526
  ],
475
527
  w: 800,
476
- h: 900,
477
- ext: {
478
- kobler: {
479
- pos: 3
480
- }
481
- }
528
+ h: 900
482
529
  },
483
- tagid: 'gwms2738647',
484
530
  bidfloor: 0,
485
531
  bidfloorcur: 'USD',
486
532
  pmp: {}
487
533
  }
488
534
  ],
489
535
  device: {
490
- devicetype: 2,
491
- geo: {
492
- zip: '0015'
493
- }
536
+ devicetype: 2
494
537
  },
495
538
  site: {
496
539
  page: 'bid.kobler.no'
@@ -531,7 +574,7 @@ describe('KoblerAdapter', function () {
531
574
  dealid: '',
532
575
  w: 320,
533
576
  h: 250,
534
- adm: '<script src="https://atag.essrtb.com/serve/prebid_ad_tag?payload=sdhfusdaobfadslf234324&sp=${AUCTION_PRICE}&cur=${AUCTION_PRICE_CURRENCY}"></script>',
577
+ adm: '<script src="https://atag.essrtb.com/serve/prebid_ad_tag?payload=sdhfusdaobfadslf234324"></script>',
535
578
  adomain: [
536
579
  'https://kobler.no'
537
580
  ]
@@ -544,7 +587,7 @@ describe('KoblerAdapter', function () {
544
587
  dealid: '2783483223432342',
545
588
  w: 580,
546
589
  h: 400,
547
- adm: '<script src="https://atag.essrtb.com/serve/prebid_ad_tag?payload=nbashgufvishdafjk23432&sp=${AUCTION_PRICE}&cur=${AUCTION_PRICE_CURRENCY}"></script>',
590
+ adm: '<script src="https://atag.essrtb.com/serve/prebid_ad_tag?payload=nbashgufvishdafjk23432"></script>',
548
591
  adomain: [
549
592
  'https://bid.kobler.no'
550
593
  ]
@@ -568,7 +611,7 @@ describe('KoblerAdapter', function () {
568
611
  dealId: '',
569
612
  netRevenue: true,
570
613
  ttl: 600,
571
- ad: '<script src="https://atag.essrtb.com/serve/prebid_ad_tag?payload=sdhfusdaobfadslf234324&sp=${AUCTION_PRICE}&cur=NOK"></script>',
614
+ ad: '<script src="https://atag.essrtb.com/serve/prebid_ad_tag?payload=sdhfusdaobfadslf234324"></script>',
572
615
  nurl: 'https://atag.essrtb.com/serve/prebid_win_notification?payload=sdhfusdaobfadslf234324&sp=${AUCTION_PRICE}&sp_cur=${AUCTION_PRICE_CURRENCY}&asp=${AD_SERVER_PRICE}&asp_cur=${AD_SERVER_PRICE_CURRENCY}',
573
616
  meta: {
574
617
  advertiserDomains: [
@@ -586,7 +629,7 @@ describe('KoblerAdapter', function () {
586
629
  dealId: '2783483223432342',
587
630
  netRevenue: true,
588
631
  ttl: 600,
589
- ad: '<script src="https://atag.essrtb.com/serve/prebid_ad_tag?payload=nbashgufvishdafjk23432&sp=${AUCTION_PRICE}&cur=NOK"></script>',
632
+ ad: '<script src="https://atag.essrtb.com/serve/prebid_ad_tag?payload=nbashgufvishdafjk23432"></script>',
590
633
  nurl: 'https://atag.essrtb.com/serve/prebid_win_notification?payload=nbashgufvishdafjk23432&sp=${AUCTION_PRICE}&sp_cur=${AUCTION_PRICE_CURRENCY}&asp=${AD_SERVER_PRICE}&asp_cur=${AD_SERVER_PRICE_CURRENCY}',
591
634
  meta: {
592
635
  advertiserDomains: [
@@ -628,6 +671,7 @@ describe('KoblerAdapter', function () {
628
671
  }
629
672
  });
630
673
  spec.onBidWon({
674
+ originalCpm: 1.532,
631
675
  cpm: 8.341,
632
676
  currency: 'NOK',
633
677
  nurl: 'https://atag.essrtb.com/serve/prebid_win_notification?payload=sdhfusdaobfadslf234324&sp=${AUCTION_PRICE}&sp_cur=${AUCTION_PRICE_CURRENCY}&asp=${AD_SERVER_PRICE}&asp_cur=${AD_SERVER_PRICE_CURRENCY}',
@@ -670,22 +714,14 @@ describe('KoblerAdapter', function () {
670
714
  auctionId: 'a1fba829-dd41-409f-acfb-b7b0ac5f30c6',
671
715
  bidId: 'ef236c6c-e934-406b-a877-d7be8e8a839a',
672
716
  timeout: 100,
673
- params: [
674
- {
675
- placementId: 'xrwg62731',
676
- }
677
- ],
717
+ params: [],
678
718
  },
679
719
  {
680
720
  adUnitCode: 'adunit-code-2',
681
721
  auctionId: 'a1fba829-dd41-409f-acfb-b7b0ac5f30c6',
682
722
  bidId: 'ca4121c8-9a4a-46ba-a624-e9b64af206f2',
683
723
  timeout: 100,
684
- params: [
685
- {
686
- placementId: 'bc482234',
687
- }
688
- ],
724
+ params: [],
689
725
  }
690
726
  ]);
691
727
 
@@ -693,12 +729,12 @@ describe('KoblerAdapter', function () {
693
729
  expect(utils.triggerPixel.getCall(0).args[0]).to.be.equal(
694
730
  'https://bid.essrtb.com/notify/prebid_timeout?ad_unit_code=adunit-code&' +
695
731
  'auction_id=a1fba829-dd41-409f-acfb-b7b0ac5f30c6&bid_id=ef236c6c-e934-406b-a877-d7be8e8a839a&timeout=100&' +
696
- 'placement_id=xrwg62731&page_url=' + encodeURIComponent(getRefererInfo().referer)
732
+ 'page_url=' + encodeURIComponent(getRefererInfo().referer)
697
733
  );
698
734
  expect(utils.triggerPixel.getCall(1).args[0]).to.be.equal(
699
735
  'https://bid.essrtb.com/notify/prebid_timeout?ad_unit_code=adunit-code-2&' +
700
736
  'auction_id=a1fba829-dd41-409f-acfb-b7b0ac5f30c6&bid_id=ca4121c8-9a4a-46ba-a624-e9b64af206f2&timeout=100&' +
701
- 'placement_id=bc482234&page_url=' + encodeURIComponent(getRefererInfo().referer)
737
+ 'page_url=' + encodeURIComponent(getRefererInfo().referer)
702
738
  );
703
739
  });
704
740
  });
@@ -0,0 +1,146 @@
1
+ import * as medianetRTD from '../../../modules/medianetRtdProvider.js';
2
+ import * as sinon from 'sinon';
3
+ import { assert } from 'chai';
4
+
5
+ let sandbox;
6
+ let setDataSpy;
7
+ let getTargetingDataSpy;
8
+ let onPrebidRequestBidSpy;
9
+
10
+ const conf = {
11
+ dataProviders: [{
12
+ 'name': 'medianet',
13
+ 'params': {
14
+ 'cid': 'customer_id',
15
+ }
16
+ }]
17
+ };
18
+
19
+ describe('medianet realtime module', function () {
20
+ beforeEach(function () {
21
+ sandbox = sinon.sandbox.create();
22
+ window.mnjs = window.mnjs || {};
23
+ window.mnjs.que = window.mnjs.que || [];
24
+ window.mnjs.setData = setDataSpy = sandbox.spy();
25
+ window.mnjs.getTargetingData = getTargetingDataSpy = sandbox.spy();
26
+ window.mnjs.onPrebidRequestBid = onPrebidRequestBidSpy = sandbox.spy();
27
+ });
28
+
29
+ afterEach(function () {
30
+ sandbox.restore();
31
+ window.mnjs = {};
32
+ });
33
+
34
+ it('init should return false when customer id is passed', function () {
35
+ assert.equal(medianetRTD.medianetRtdModule.init({}), false);
36
+ });
37
+
38
+ it('init should return true when customer id is passed', function () {
39
+ assert.equal(medianetRTD.medianetRtdModule.init(conf.dataProviders[0]), true);
40
+ });
41
+
42
+ it('init should pass config to js when loaded', function () {
43
+ medianetRTD.medianetRtdModule.init(conf.dataProviders[0]);
44
+
45
+ const command = window.mnjs.que.pop();
46
+ assert.isFunction(command);
47
+ command();
48
+
49
+ assert.equal(setDataSpy.called, true);
50
+ assert.equal(setDataSpy.args[0][0].name, 'initIRefresh');
51
+ });
52
+
53
+ it('auctionInit should pass information to js when loaded', function () {
54
+ const auctionObject = {adUnits: []};
55
+ medianetRTD.medianetRtdModule.onAuctionInitEvent(auctionObject);
56
+
57
+ const command = window.mnjs.que.pop();
58
+ assert.isFunction(command);
59
+ command();
60
+
61
+ assert.equal(setDataSpy.called, true);
62
+ assert.equal(setDataSpy.args[0][0].name, 'auctionInit');
63
+ assert.deepEqual(setDataSpy.args[0][0].data, {auction: auctionObject});
64
+ });
65
+
66
+ describe('getTargeting should work correctly', function () {
67
+ it('should return empty if not loaded', function () {
68
+ window.mnjs.loaded = false;
69
+ assert.deepEqual(medianetRTD.medianetRtdModule.getTargetingData([]), {});
70
+ });
71
+
72
+ it('should return ad unit codes when ad units are present', function () {
73
+ const adUnitCodes = ['code1', 'code2'];
74
+ assert.deepEqual(medianetRTD.medianetRtdModule.getTargetingData(adUnitCodes), {
75
+ code1: {'mnadc': 'code1'},
76
+ code2: {'mnadc': 'code2'},
77
+ });
78
+ });
79
+
80
+ it('should call mnjs.getTargetingData if loaded', function () {
81
+ window.mnjs.loaded = true;
82
+ medianetRTD.medianetRtdModule.getTargetingData([]);
83
+ assert.equal(getTargetingDataSpy.called, true);
84
+ });
85
+ });
86
+
87
+ describe('getBidRequestData should work correctly', function () {
88
+ it('callback should be called when we are not interested in request', function () {
89
+ const requestBidsProps = {
90
+ adUnits: [{
91
+ code: 'code1', bids: [],
92
+ }],
93
+ adUnitCodes: ['code1'],
94
+ };
95
+ const callbackSpy = sandbox.spy();
96
+ medianetRTD.medianetRtdModule.getBidRequestData(requestBidsProps, callbackSpy, conf.dataProviders[0], {});
97
+
98
+ const command = window.mnjs.que.pop();
99
+ assert.isFunction(command);
100
+ command();
101
+
102
+ assert.equal(onPrebidRequestBidSpy.called, true, 'onPrebidRequest should always be called');
103
+ assert.equal(callbackSpy.called, true, 'when onPrebidRequest returns nothing callback should be called immediately');
104
+ });
105
+
106
+ it('we should wait for callback till onComplete', function () {
107
+ const requestBidsProps = {
108
+ adUnits: [{
109
+ code: 'code1', bids: [],
110
+ }],
111
+ adUnitCodes: ['code1'],
112
+ };
113
+
114
+ const refreshInformation = {
115
+ mnrf: '1',
116
+ mnrfc: 2,
117
+ };
118
+
119
+ const callbackSpy = sandbox.spy();
120
+ const onCompleteSpy = sandbox.spy();
121
+ window.mnjs.onPrebidRequestBid = onPrebidRequestBidSpy = () => {
122
+ onPrebidRequestBidSpy.called = true;
123
+ return {onComplete: onCompleteSpy};
124
+ };
125
+ medianetRTD.medianetRtdModule.getBidRequestData(requestBidsProps, callbackSpy, conf.dataProviders[0], {});
126
+
127
+ const command = window.mnjs.que.pop();
128
+ assert.isFunction(command);
129
+ command();
130
+
131
+ assert.equal(callbackSpy.called, false, 'callback should not be called, as we are returning a request from onPrebidRequestBid');
132
+ assert.equal(onPrebidRequestBidSpy.called, true, 'onPrebidRequestBid should be called once');
133
+ assert.equal(onCompleteSpy.called, true, 'onComplete should be passed callback');
134
+ assert.isFunction(onCompleteSpy.args[0][0], 'onCompleteSpy first argument error callback should be a function');
135
+ assert.isFunction(onCompleteSpy.args[0][1], 'onCompleteSpy second argument success callback should be a function');
136
+ onCompleteSpy.args[0][0]();
137
+ assert.equal(callbackSpy.callCount, 1, 'callback should be called when error callback is triggered');
138
+ onCompleteSpy.args[0][1]({}, {
139
+ 'code1': {ext: {refresh: refreshInformation}}
140
+ });
141
+ assert.equal(callbackSpy.callCount, 2, 'callback should be called when success callback is triggered');
142
+ assert.isObject(requestBidsProps.adUnits[0].ortb2Imp, 'ORTB object should be set');
143
+ assert.deepEqual(requestBidsProps.adUnits[0].ortb2Imp.ext.refresh, refreshInformation, 'ORTB should have refresh information should be set');
144
+ });
145
+ });
146
+ });