prebid.js 7.46.0 → 7.48.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 (195) hide show
  1. package/dist/33acrossBidAdapter.js +1 -1
  2. package/dist/33acrossIdSystem.js +1 -1
  3. package/dist/ablidaBidAdapter.js +1 -1
  4. package/dist/adagioBidAdapter.js +1 -1
  5. package/dist/adbookpspBidAdapter.js +1 -1
  6. package/dist/adgenerationBidAdapter.js +1 -1
  7. package/dist/admaticBidAdapter.js +1 -1
  8. package/dist/adrelevantisBidAdapter.js +1 -1
  9. package/dist/adrinoBidAdapter.js +1 -1
  10. package/dist/adtrgtmeBidAdapter.js +1 -1
  11. package/dist/adxcgBidAdapter.js +1 -1
  12. package/dist/adyoulikeBidAdapter.js +1 -1
  13. package/dist/ajaBidAdapter.js +1 -1
  14. package/dist/amxBidAdapter.js +1 -1
  15. package/dist/amxIdSystem.js +1 -1
  16. package/dist/appierAnalyticsAdapter.js +1 -1
  17. package/dist/appnexusBidAdapter.js +1 -1
  18. package/dist/asoBidAdapter.js +1 -1
  19. package/dist/axonixBidAdapter.js +1 -1
  20. package/dist/bidglassBidAdapter.js +1 -1
  21. package/dist/big-richmediaBidAdapter.js +1 -1
  22. package/dist/bridgewellBidAdapter.js +1 -1
  23. package/dist/brightMountainMediaBidAdapter.js +1 -1
  24. package/dist/carodaBidAdapter.js +1 -1
  25. package/dist/chtnwBidAdapter.js +1 -1
  26. package/dist/concertBidAdapter.js +1 -1
  27. package/dist/connectIdSystem.js +1 -1
  28. package/dist/connectadBidAdapter.js +1 -1
  29. package/dist/consumableBidAdapter.js +1 -1
  30. package/dist/conversantAnalyticsAdapter.js +1 -1
  31. package/dist/conversantBidAdapter.js +1 -1
  32. package/dist/craftBidAdapter.js +1 -1
  33. package/dist/criteoBidAdapter.js +1 -1
  34. package/dist/criteoIdSystem.js +1 -1
  35. package/dist/cwireBidAdapter.js +1 -1
  36. package/dist/dependencies.json +4 -0
  37. package/dist/dspxBidAdapter.js +1 -1
  38. package/dist/emtvBidAdapter.js +1 -0
  39. package/dist/eplanningBidAdapter.js +1 -1
  40. package/dist/feedadBidAdapter.js +1 -1
  41. package/dist/finativeBidAdapter.js +1 -1
  42. package/dist/freewheel-sspBidAdapter.js +1 -1
  43. package/dist/glimpseBidAdapter.js +1 -1
  44. package/dist/gmosspBidAdapter.js +1 -1
  45. package/dist/goldbachBidAdapter.js +1 -1
  46. package/dist/greenbidsAnalyticsAdapter.js +1 -1
  47. package/dist/greenbidsRtdProvider.js +1 -0
  48. package/dist/gridBidAdapter.js +1 -1
  49. package/dist/gumgumBidAdapter.js +1 -1
  50. package/dist/h12mediaBidAdapter.js +1 -1
  51. package/dist/id5IdSystem.js +1 -1
  52. package/dist/impactifyBidAdapter.js +1 -1
  53. package/dist/improvedigitalBidAdapter.js +1 -1
  54. package/dist/inmarBidAdapter.js +1 -1
  55. package/dist/insticatorBidAdapter.js +1 -1
  56. package/dist/iqmBidAdapter.js +1 -1
  57. package/dist/ixBidAdapter.js +1 -1
  58. package/dist/justpremiumBidAdapter.js +1 -1
  59. package/dist/kargoBidAdapter.js +1 -1
  60. package/dist/konduitAnalyticsAdapter.js +1 -1
  61. package/dist/kueezBidAdapter.js +1 -1
  62. package/dist/kueezRtbBidAdapter.js +1 -1
  63. package/dist/kulturemediaBidAdapter.js +1 -1
  64. package/dist/lassoBidAdapter.js +1 -1
  65. package/dist/lifestreetBidAdapter.js +1 -1
  66. package/dist/liveyieldAnalyticsAdapter.js +1 -1
  67. package/dist/logicadBidAdapter.js +1 -1
  68. package/dist/loglyliftBidAdapter.js +1 -1
  69. package/dist/magniteAnalyticsAdapter.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/mediasquareBidAdapter.js +1 -1
  74. package/dist/mgidBidAdapter.js +1 -1
  75. package/dist/minutemediaBidAdapter.js +1 -1
  76. package/dist/minutemediaplusBidAdapter.js +1 -1
  77. package/dist/missenaBidAdapter.js +1 -1
  78. package/dist/nextMillenniumBidAdapter.js +1 -1
  79. package/dist/nexx360BidAdapter.js +1 -1
  80. package/dist/not-for-prod/prebid.js +142 -139
  81. package/dist/oguryBidAdapter.js +1 -1
  82. package/dist/onetagBidAdapter.js +1 -1
  83. package/dist/ooloAnalyticsAdapter.js +1 -1
  84. package/dist/optidigitalBidAdapter.js +1 -1
  85. package/dist/orbitsoftBidAdapter.js +1 -1
  86. package/dist/outbrainBidAdapter.js +1 -1
  87. package/dist/parrableIdSystem.js +1 -1
  88. package/dist/pixfutureBidAdapter.js +1 -1
  89. package/dist/prebid-core.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/radsBidAdapter.js +1 -1
  96. package/dist/readpeakBidAdapter.js +1 -1
  97. package/dist/relaidoBidAdapter.js +1 -1
  98. package/dist/relevantdigitalBidAdapter.js +1 -0
  99. package/dist/rhythmoneBidAdapter.js +1 -1
  100. package/dist/riseBidAdapter.js +1 -1
  101. package/dist/rtbhouseBidAdapter.js +1 -1
  102. package/dist/rubiconAnalyticsAdapter.js +1 -1
  103. package/dist/rubiconBidAdapter.js +1 -1
  104. package/dist/seedingAllianceBidAdapter.js +1 -1
  105. package/dist/seedtagBidAdapter.js +1 -1
  106. package/dist/sharethroughAnalyticsAdapter.js +1 -1
  107. package/dist/sharethroughBidAdapter.js +1 -1
  108. package/dist/shinezBidAdapter.js +1 -1
  109. package/dist/smaatoBidAdapter.js +1 -1
  110. package/dist/smartadserverBidAdapter.js +1 -1
  111. package/dist/smartxBidAdapter.js +1 -1
  112. package/dist/smilewantedBidAdapter.js +1 -1
  113. package/dist/sonobiBidAdapter.js +1 -1
  114. package/dist/sovrnAnalyticsAdapter.js +1 -1
  115. package/dist/sovrnBidAdapter.js +1 -1
  116. package/dist/sspBCBidAdapter.js +1 -1
  117. package/dist/stvBidAdapter.js +1 -1
  118. package/dist/sublimeBidAdapter.js +1 -1
  119. package/dist/synacormediaBidAdapter.js +1 -1
  120. package/dist/targetVideoBidAdapter.js +1 -1
  121. package/dist/teadsBidAdapter.js +1 -1
  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/uid2IdSystem.js +1 -1
  127. package/dist/underdogmediaBidAdapter.js +1 -1
  128. package/dist/undertoneBidAdapter.js +1 -1
  129. package/dist/userId.js +1 -1
  130. package/dist/vdoaiBidAdapter.js +1 -1
  131. package/dist/vidazooBidAdapter.js +1 -1
  132. package/dist/videobyteBidAdapter.js +1 -1
  133. package/dist/vidoomyBidAdapter.js +1 -1
  134. package/dist/visxBidAdapter.js +1 -1
  135. package/dist/vuukleBidAdapter.js +1 -1
  136. package/dist/widespaceBidAdapter.js +1 -1
  137. package/dist/winrBidAdapter.js +1 -1
  138. package/dist/wipesBidAdapter.js +1 -1
  139. package/dist/yahoosspBidAdapter.js +1 -1
  140. package/dist/yieldmoBidAdapter.js +1 -1
  141. package/dist/yieldoneAnalyticsAdapter.js +1 -1
  142. package/dist/yieldoneBidAdapter.js +1 -1
  143. package/modules/ablidaBidAdapter.js +4 -5
  144. package/modules/admaticBidAdapter.js +32 -5
  145. package/modules/adrinoBidAdapter.js +11 -4
  146. package/modules/axonixBidAdapter.js +6 -6
  147. package/modules/connectIdSystem.js +5 -2
  148. package/modules/criteoBidAdapter.js +3 -5
  149. package/modules/criteoIdSystem.js +27 -14
  150. package/modules/dspxBidAdapter.js +2 -3
  151. package/modules/emtvBidAdapter.js +211 -0
  152. package/modules/emtvBidAdapter.md +79 -0
  153. package/modules/freewheel-sspBidAdapter.js +32 -7
  154. package/modules/greenbidsRtdProvider.js +110 -0
  155. package/modules/greenbidsRtdProvider.md +65 -0
  156. package/modules/impactifyBidAdapter.js +0 -1
  157. package/modules/iqmBidAdapter.js +1 -2
  158. package/modules/missenaBidAdapter.js +1 -1
  159. package/modules/nextMillenniumBidAdapter.js +2 -0
  160. package/modules/orbitsoftBidAdapter.js +1 -2
  161. package/modules/radsBidAdapter.js +3 -4
  162. package/modules/relevantdigitalBidAdapter.js +198 -0
  163. package/modules/relevantdigitalBidAdapter.md +117 -0
  164. package/modules/rtbhouseBidAdapter.js +9 -12
  165. package/modules/sovrnBidAdapter.js +4 -0
  166. package/modules/stvBidAdapter.js +4 -5
  167. package/modules/tripleliftBidAdapter.js +14 -3
  168. package/modules/ttdBidAdapter.js +73 -71
  169. package/modules/underdogmediaBidAdapter.js +9 -12
  170. package/modules/userId/index.js +1 -1
  171. package/modules/vdoaiBidAdapter.js +2 -3
  172. package/modules/vidoomyBidAdapter.js +19 -6
  173. package/modules/vidoomyBidAdapter.md +12 -2
  174. package/modules/wipesBidAdapter.js +2 -3
  175. package/modules/yieldmoBidAdapter.js +2 -2
  176. package/modules/yieldoneBidAdapter.js +3 -4
  177. package/package.json +1 -1
  178. package/test/spec/modules/adlooxAdServerVideo_spec.js +18 -35
  179. package/test/spec/modules/admaticBidAdapter_spec.js +164 -11
  180. package/test/spec/modules/adrinoBidAdapter_spec.js +50 -2
  181. package/test/spec/modules/connectIdSystem_spec.js +4 -4
  182. package/test/spec/modules/criteoBidAdapter_spec.js +56 -0
  183. package/test/spec/modules/criteoIdSystem_spec.js +99 -9
  184. package/test/spec/modules/emtvBidAdapter_spec.js +400 -0
  185. package/test/spec/modules/freewheel-sspBidAdapter_spec.js +31 -2
  186. package/test/spec/modules/greenbidsRtdProvider_spec.js +210 -0
  187. package/test/spec/modules/relevantdigitalBidAdapter_spec.js +295 -0
  188. package/test/spec/modules/rtbhouseBidAdapter_spec.js +24 -2
  189. package/test/spec/modules/sovrnBidAdapter_spec.js +65 -0
  190. package/test/spec/modules/tripleliftBidAdapter_spec.js +53 -8
  191. package/test/spec/modules/ttdBidAdapter_spec.js +20 -0
  192. package/test/spec/modules/vidoomyBidAdapter_spec.js +49 -0
  193. package/test/spec/modules/yieldmoBidAdapter_spec.js +2 -2
  194. package/test/spec/ortbConverter/userId_spec.js +12 -0
  195. package/test/spec/modules/realvuAnalyticsAdapter_spec.js +0 -189
@@ -139,15 +139,13 @@ describe('triplelift adapter', function () {
139
139
  sizes: [[300, 250], [300, 600], [1, 1, 1], ['flex']],
140
140
  bidId: '30b31c1838de1e',
141
141
  bidderRequestId: '22edbae2733bf6',
142
+ transactionId: '173f49a8-7549-4218-a23c-e7ba59b47229',
142
143
  auctionId: '1d1a030790a475',
143
144
  userId: {},
144
145
  schain,
145
146
  ortb2Imp: {
146
147
  ext: {
147
- data: {
148
- pbAdSlot: 'homepage-top-rect',
149
- adUnitSpecificAttribute: 123
150
- }
148
+ tid: '173f49a8-7549-4218-a23c-e7ba59b47229'
151
149
  }
152
150
  }
153
151
  },
@@ -178,6 +176,15 @@ describe('triplelift adapter', function () {
178
176
  auctionId: '1d1a030790a475',
179
177
  userId: {},
180
178
  schain,
179
+ ortb2Imp: {
180
+ ext: {
181
+ data: {
182
+ pbAdSlot: 'homepage-top-rect',
183
+ adUnitSpecificAttribute: 123
184
+ },
185
+ tid: '173f49a8-7549-4218-a23c-e7ba59b47229'
186
+ }
187
+ }
181
188
  },
182
189
  // banner and outstream video
183
190
  {
@@ -245,6 +252,11 @@ describe('triplelift adapter', function () {
245
252
  auctionId: '1d1a030790a475',
246
253
  userId: {},
247
254
  schain,
255
+ ortb2Imp: {
256
+ misc: {
257
+ test: 1
258
+ }
259
+ }
248
260
  },
249
261
  // incomplete banner and incomplete video
250
262
  {
@@ -689,6 +701,39 @@ describe('triplelift adapter', function () {
689
701
  expect(payload.imp[13].video.placement).to.equal(3);
690
702
  });
691
703
 
704
+ it('should add tid to imp.ext if transactionId exists', function() {
705
+ const request = tripleliftAdapterSpec.buildRequests(bidRequests, bidderRequest);
706
+ expect(request.data.imp[0].ext.tid).to.exist.and.be.a('string');
707
+ expect(request.data.imp[0].ext.tid).to.equal('173f49a8-7549-4218-a23c-e7ba59b47229');
708
+ });
709
+
710
+ it('should not add impression ext object if ortb2Imp does not exist', function() {
711
+ const request = tripleliftAdapterSpec.buildRequests(bidRequests, bidderRequest);
712
+ expect(request.data.imp[2].ext).to.not.exist;
713
+ });
714
+
715
+ it('should not add impression ext object if ortb2Imp.ext does not exist', function() {
716
+ const request = tripleliftAdapterSpec.buildRequests(bidRequests, bidderRequest);
717
+ expect(request.data.imp[3].ext).to.not.exist;
718
+ });
719
+
720
+ it('should copy entire impression ext object', function() {
721
+ const request = tripleliftAdapterSpec.buildRequests(bidRequests, bidderRequest);
722
+ expect(request.data.imp[1].ext).to.haveOwnProperty('tid');
723
+ expect(request.data.imp[1].ext).to.haveOwnProperty('data');
724
+ expect(request.data.imp[1].ext.data).to.haveOwnProperty('adUnitSpecificAttribute');
725
+ expect(request.data.imp[1].ext.data).to.haveOwnProperty('pbAdSlot');
726
+ expect(request.data.imp[1].ext).to.deep.equal(
727
+ {
728
+ data: {
729
+ pbAdSlot: 'homepage-top-rect',
730
+ adUnitSpecificAttribute: 123
731
+ },
732
+ tid: '173f49a8-7549-4218-a23c-e7ba59b47229'
733
+ }
734
+ );
735
+ });
736
+
692
737
  it('should add tdid to the payload if included', function () {
693
738
  const id = '6bca7f6b-a98a-46c0-be05-6020f7604598';
694
739
  bidRequests[0].userId.tdid = id;
@@ -1103,10 +1148,10 @@ describe('triplelift adapter', function () {
1103
1148
  });
1104
1149
  it('should send ad unit fpd if kvps are available', function() {
1105
1150
  const request = tripleliftAdapterSpec.buildRequests(bidRequests, bidderRequest);
1106
- expect(request.data.imp[0].fpd.context).to.haveOwnProperty('data');
1107
- expect(request.data.imp[0].fpd.context.data).to.haveOwnProperty('pbAdSlot');
1108
- expect(request.data.imp[0].fpd.context.data).to.haveOwnProperty('adUnitSpecificAttribute');
1109
- expect(request.data.imp[1].fpd).to.not.exist;
1151
+ expect(request.data.imp[1].fpd.context).to.haveOwnProperty('data');
1152
+ expect(request.data.imp[1].fpd.context.data).to.haveOwnProperty('pbAdSlot');
1153
+ expect(request.data.imp[1].fpd.context.data).to.haveOwnProperty('adUnitSpecificAttribute');
1154
+ expect(request.data.imp[2].fpd).to.not.exist;
1110
1155
  });
1111
1156
  it('should send 1PlusX data as fpd if localStorage is available and no other fpd is defined', function() {
1112
1157
  sandbox.stub(storage, 'getDataFromLocalStorage').callsFake(() => '{"kid":1,"s":"ySRdArquXuBolr/cVv0UNqrJhTO4QZsbNH/t+2kR3gXjbA==","t":"/yVtBrquXuBolr/cVv0UNtx1mssdLYeKFhWFI3Dq1dJnug=="}');
@@ -104,6 +104,10 @@ describe('ttdBidAdapter', function () {
104
104
  });
105
105
 
106
106
  describe('video', function () {
107
+ if (!FEATURES.VIDEO) {
108
+ return;
109
+ }
110
+
107
111
  function makeBid() {
108
112
  return {
109
113
  'bidder': 'ttd',
@@ -683,6 +687,10 @@ describe('ttdBidAdapter', function () {
683
687
  });
684
688
 
685
689
  describe('buildRequests-display-video-multiformat', function () {
690
+ if (!FEATURES.VIDEO) {
691
+ return;
692
+ }
693
+
686
694
  const baseMultiformatBidRequests = [{
687
695
  'bidder': 'ttd',
688
696
  'params': {
@@ -751,6 +759,10 @@ describe('ttdBidAdapter', function () {
751
759
  });
752
760
 
753
761
  describe('buildRequests-video', function () {
762
+ if (!FEATURES.VIDEO) {
763
+ return;
764
+ }
765
+
754
766
  const baseVideoBidRequests = [{
755
767
  'bidder': 'ttd',
756
768
  'params': {
@@ -1186,6 +1198,10 @@ describe('ttdBidAdapter', function () {
1186
1198
  });
1187
1199
 
1188
1200
  describe('interpretResponse-simple-video', function () {
1201
+ if (!FEATURES.VIDEO) {
1202
+ return;
1203
+ }
1204
+
1189
1205
  const incoming = {
1190
1206
  'body': {
1191
1207
  'cur': 'USD',
@@ -1318,6 +1334,10 @@ describe('ttdBidAdapter', function () {
1318
1334
  });
1319
1335
 
1320
1336
  describe('interpretResponse-display-and-video', function () {
1337
+ if (!FEATURES.VIDEO) {
1338
+ return;
1339
+ }
1340
+
1321
1341
  const incoming = {
1322
1342
  'body': {
1323
1343
  'id': 'e7b34fa3-8654-424e-8c49-03e509e53d8c',
@@ -219,6 +219,55 @@ describe('vidoomyBidAdapter', function() {
219
219
  expect(bidRequest.data.bidfloor).to.equal(bidfloor);
220
220
  });
221
221
  });
222
+
223
+ describe('badv, bcat, bapp, btype, battr', function () {
224
+ const bidderRequestNew = {
225
+ ...bidderRequest,
226
+ bcat: ['EX1', 'EX2', 'EX3'],
227
+ badv: ['site.com'],
228
+ bapp: ['app.com'],
229
+ btype: [1, 2, 3],
230
+ battr: [1, 2, 3]
231
+ }
232
+ const request = spec.buildRequests(bidRequests, bidderRequestNew);
233
+ it('should have badv, bcat, bapp, btype, battr in request', function () {
234
+ expect(request[0].data).to.include.any.keys('badv');
235
+ expect(request[0].data).to.include.any.keys('bcat');
236
+ expect(request[0].data).to.include.any.keys('bapp');
237
+ expect(request[0].data).to.include.any.keys('btype');
238
+ expect(request[0].data).to.include.any.keys('battr');
239
+ })
240
+
241
+ it('should have equal badv, bcat, bapp, btype, battr in request', function () {
242
+ expect(request[0].badv).to.deep.equal(bidderRequest.refererInfo.badv);
243
+ expect(request[0].bcat).to.deep.equal(bidderRequest.refererInfo.bcat);
244
+ expect(request[0].bapp).to.deep.equal(bidderRequest.refererInfo.bapp);
245
+ expect(request[0].btype).to.deep.equal(bidderRequest.refererInfo.btype);
246
+ expect(request[0].battr).to.deep.equal(bidderRequest.refererInfo.battr);
247
+ })
248
+ })
249
+
250
+ describe('first party data', function () {
251
+ const bidderRequest2 = {
252
+ ...bidderRequest,
253
+ ortb2: {
254
+ bcat: ['EX1', 'EX2', 'EX3'],
255
+ badv: ['site.com'],
256
+ bapp: ['app.com'],
257
+ btype: [1, 2, 3],
258
+ battr: [1, 2, 3]
259
+ }
260
+ }
261
+ const request = spec.buildRequests(bidRequests, bidderRequest2);
262
+
263
+ it('should have badv, bcat, bapp, btype, battr in request and equal to bidderRequest.ortb2', function () {
264
+ expect(request[0].data.bcat).to.deep.equal(bidderRequest2.ortb2.bcat)
265
+ expect(request[0].data.badv).to.deep.equal(bidderRequest2.ortb2.badv)
266
+ expect(request[0].data.bapp).to.deep.equal(bidderRequest2.ortb2.bapp);
267
+ expect(request[0].data.btype).to.deep.equal(bidderRequest2.ortb2.btype);
268
+ expect(request[0].data.battr).to.deep.equal(bidderRequest2.ortb2.battr);
269
+ });
270
+ });
222
271
  });
223
272
 
224
273
  describe('interpretResponse', function () {
@@ -212,7 +212,7 @@ describe('YieldmoAdapter', function () {
212
212
  expect(data.hasOwnProperty('h')).to.be.true;
213
213
  expect(data.hasOwnProperty('w')).to.be.true;
214
214
  expect(data.hasOwnProperty('pubcid')).to.be.true;
215
- expect(data.userConsent).to.equal('{"gdprApplies":"","cmp":"","gpp":"","gpp_sid":""}');
215
+ expect(data.userConsent).to.equal('{"gdprApplies":"","cmp":"","gpp":"","gpp_sid":[]}');
216
216
  expect(data.us_privacy).to.equal('');
217
217
  });
218
218
 
@@ -263,7 +263,7 @@ describe('YieldmoAdapter', function () {
263
263
  gdprApplies: true,
264
264
  cmp: 'BOJ/P2HOJ/P2HABABMAAAAAZ+A==',
265
265
  gpp: '',
266
- gpp_sid: '',
266
+ gpp_sid: [],
267
267
  })
268
268
  );
269
269
  });
@@ -18,4 +18,16 @@ describe('pbjs - ortb user eids', () => {
18
18
  setOrtbUserExtEids(req, {}, [{}]);
19
19
  expect(req).to.eql({});
20
20
  })
21
+
22
+ it('has no effect if user.ext.eids is an empty array', () => {
23
+ const req = {};
24
+ setOrtbUserExtEids(req, {}, {
25
+ bidRequests: [
26
+ {
27
+ userIdAsEids: []
28
+ }
29
+ ]
30
+ });
31
+ expect(req).to.eql({});
32
+ });
21
33
  })
@@ -1,189 +0,0 @@
1
- import { expect } from 'chai';
2
- import realvuAnalyticsAdapter, { lib } from 'modules/realvuAnalyticsAdapter.js';
3
- import CONSTANTS from 'src/constants.json';
4
-
5
- function addDiv(id) {
6
- let dv = document.createElement('div');
7
- dv.id = id;
8
- dv.style.width = '728px';
9
- dv.style.height = '90px';
10
- dv.style.display = 'block';
11
- document.body.appendChild(dv);
12
- let f = document.createElement('iframe');
13
- f.width = 728;
14
- f.height = 90;
15
- dv.appendChild(f);
16
- let d = null;
17
- if (f.contentDocument) d = f.contentDocument; // DOM
18
- else if (f.contentWindow) d = f.contentWindow.document; // IE
19
- d.open()
20
- d.write('<img width="728" height="90" />');
21
- d.close();
22
- return dv;
23
- }
24
-
25
- describe('RealVu', function() {
26
- let sandbox;
27
- beforeEach(function () {
28
- sandbox = sinon.sandbox.create();
29
- addDiv('ad1');
30
- addDiv('ad2');
31
- sandbox.stub(lib, 'scr');
32
- });
33
-
34
- afterEach(function () {
35
- let a1 = document.getElementById('ad1');
36
- document.body.removeChild(a1);
37
- let a2 = document.getElementById('ad2');
38
- document.body.removeChild(a2);
39
- sandbox.restore();
40
- realvuAnalyticsAdapter.disableAnalytics();
41
- });
42
-
43
- after(function () {
44
- delete window.top1;
45
- delete window.realvu_aa_fifo;
46
- delete window.realvu_aa;
47
- clearInterval(window.boost_poll);
48
- delete window.boost_poll;
49
- });
50
-
51
- describe('Analytics Adapter.', function () {
52
- it('enableAnalytics', function () {
53
- const config = {
54
- options: {
55
- partnerId: '1Y',
56
- regAllUnits: true
57
- // unitIds: ['ad1', 'ad2']
58
- }
59
- };
60
- let p = realvuAnalyticsAdapter.enableAnalytics(config);
61
- expect(p).to.equal('1Y');
62
- });
63
-
64
- it('checkIn', function () {
65
- const bid = {
66
- adUnitCode: 'ad1',
67
- sizes: [
68
- [728, 90],
69
- [970, 250],
70
- [970, 90]
71
- ]
72
- };
73
- let result = realvuAnalyticsAdapter.checkIn(bid, '1Y');
74
- const b = Object.assign({}, window.top1.realvu_aa);
75
- let a = b.ads[0];
76
- // console.log('a: ' + a.x + ', ' + a.y + ', ' + a.w + ', ' + a.h);
77
- // console.log('b: ' + b.x1 + ', ' + b.y1 + ', ' + b.x2 + ', ' + b.y2);
78
- expect(result).to.equal('yes');
79
-
80
- result = realvuAnalyticsAdapter.checkIn(bid); // test invalid partnerId 'undefined'
81
- result = realvuAnalyticsAdapter.checkIn(bid, ''); // test invalid partnerId ''
82
- });
83
-
84
- it('isInView return "NA"', function () {
85
- const adUnitCode = '1234';
86
- let result = realvuAnalyticsAdapter.isInView(adUnitCode);
87
- expect(result).to.equal('NA');
88
- });
89
-
90
- it('bid response event', function () {
91
- const config = {
92
- options: {
93
- partnerId: '1Y',
94
- regAllUnits: true
95
- // unitIds: ['ad1', 'ad2']
96
- }
97
- };
98
- realvuAnalyticsAdapter.enableAnalytics(config);
99
- const args = {
100
- 'biddercode': 'realvu',
101
- 'adUnitCode': 'ad1',
102
- 'width': 300,
103
- 'height': 250,
104
- 'statusMessage': 'Bid available',
105
- 'adId': '7ba299eba818c1',
106
- 'mediaType': 'banner',
107
- 'creative_id': 85792851,
108
- 'cpm': 0.4308
109
- };
110
- realvuAnalyticsAdapter.track({
111
- eventType: CONSTANTS.EVENTS.BID_RESPONSE,
112
- args: args
113
- });
114
- const boost = Object.assign({}, window.top1.realvu_aa);
115
- expect(boost.ads[boost.len - 1].bids.length).to.equal(1);
116
-
117
- realvuAnalyticsAdapter.track({
118
- eventType: CONSTANTS.EVENTS.BID_WON,
119
- args: args
120
- });
121
- expect(boost.ads[boost.len - 1].bids[0].winner).to.equal(1);
122
- });
123
- });
124
-
125
- describe('Boost.', function () {
126
- // const boost = window.top1.realvu_aa;
127
- let boost;
128
- beforeEach(function() {
129
- boost = Object.assign({}, window.top1.realvu_aa);
130
- });
131
- it('brd', function () {
132
- let a1 = document.getElementById('ad1');
133
- let p = boost.brd(a1, 'Left');
134
- expect(typeof p).to.not.equal('undefined');
135
- });
136
-
137
- it('addUnitById', function () {
138
- let a1 = document.getElementById('ad1');
139
- let p = boost.addUnitById('1Y', 'ad1');
140
- expect(typeof p).to.not.equal('undefined');
141
- });
142
-
143
- it('questA', function () {
144
- const dv = document.getElementById('ad1');
145
- let q = boost.questA(dv);
146
- expect(q).to.not.equal(null);
147
- });
148
-
149
- it('render', function () {
150
- let dv = document.getElementById('ad1');
151
- // dv.style.width = '728px';
152
- // dv.style.height = '90px';
153
- // dv.style.display = 'block';
154
- dv.getBoundingClientRect = false;
155
- // document.body.appendChild(dv);
156
- let q = boost.findPosG(dv);
157
- expect(q).to.not.equal(null);
158
- });
159
-
160
- it('readPos', function () {
161
- const a = boost.ads[boost.len - 1];
162
- let r = boost.readPos(a);
163
- expect(r).to.equal(true);
164
- });
165
-
166
- it('send_track', function () {
167
- const a = boost.ads[boost.len - 1];
168
- boost.track(a, 'show', '');
169
- boost.sr = 'a';
170
- boost.send_track();
171
- expect(boost.beacons.length).to.equal(0);
172
- });
173
-
174
- it('questA text', function () {
175
- let p = document.createElement('p');
176
- p.innerHTML = 'ABC';
177
- document.body.appendChild(p);
178
- let r = boost.questA(p.firstChild);
179
- document.body.removeChild(p);
180
- expect(r).to.not.equal(null);
181
- });
182
-
183
- it('_f=conf', function () {
184
- const a = boost.ads[boost.len - 1];
185
- let r = boost.tru(a, 'conf');
186
- expect(r).to.not.include('_ps=');
187
- });
188
- });
189
- });