prebid.js 7.14.0 → 7.16.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 (239) hide show
  1. package/.circleci/config.yml +3 -0
  2. package/dist/1plusXRtdProvider.js +1 -1
  3. package/dist/33acrossBidAdapter.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/adkernelAdnBidAdapter.js +1 -1
  9. package/dist/adkernelBidAdapter.js +1 -1
  10. package/dist/adlooxAdServerVideo.js +1 -1
  11. package/dist/adlooxRtdProvider.js +1 -1
  12. package/dist/adrelevantisBidAdapter.js +1 -1
  13. package/dist/adtrgtmeBidAdapter.js +1 -1
  14. package/dist/adtrueBidAdapter.js +1 -1
  15. package/dist/adxcgBidAdapter.js +1 -1
  16. package/dist/airgridRtdProvider.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/aolBidAdapter.js +1 -1
  21. package/dist/appierAnalyticsAdapter.js +1 -1
  22. package/dist/appnexusBidAdapter.js +1 -1
  23. package/dist/asoBidAdapter.js +1 -1
  24. package/dist/axonixBidAdapter.js +1 -1
  25. package/dist/beachfrontBidAdapter.js +1 -1
  26. package/dist/bidglassBidAdapter.js +1 -1
  27. package/dist/big-richmediaBidAdapter.js +1 -1
  28. package/dist/bizzclickBidAdapter.js +1 -1
  29. package/dist/bliinkBidAdapter.js +1 -1
  30. package/dist/bluebillywigBidAdapter.js +1 -1
  31. package/dist/brandmetricsRtdProvider.js +1 -1
  32. package/dist/bridgewellBidAdapter.js +1 -1
  33. package/dist/brightMountainMediaBidAdapter.js +1 -1
  34. package/dist/brightcomBidAdapter.js +1 -1
  35. package/dist/browsiRtdProvider.js +1 -1
  36. package/dist/categoryTranslation.js +1 -1
  37. package/dist/concertBidAdapter.js +1 -1
  38. package/dist/connectadBidAdapter.js +1 -1
  39. package/dist/consentManagement.js +1 -1
  40. package/dist/consentManagementUsp.js +1 -1
  41. package/dist/consumableBidAdapter.js +1 -1
  42. package/dist/conversantBidAdapter.js +1 -1
  43. package/dist/cpmstarBidAdapter.js +1 -1
  44. package/dist/craftBidAdapter.js +1 -1
  45. package/dist/criteoBidAdapter.js +1 -1
  46. package/dist/currency.js +1 -1
  47. package/dist/dataControllerModule.js +1 -1
  48. package/dist/dchain.js +1 -1
  49. package/dist/deepintentBidAdapter.js +1 -1
  50. package/dist/dependencies.json +3 -0
  51. package/dist/dgkeywordRtdProvider.js +1 -1
  52. package/dist/dianomiBidAdapter.js +1 -1
  53. package/dist/distroscaleBidAdapter.js +1 -1
  54. package/dist/dspxBidAdapter.js +1 -1
  55. package/dist/eplanningBidAdapter.js +1 -1
  56. package/dist/etargetBidAdapter.js +1 -1
  57. package/dist/feedadBidAdapter.js +1 -1
  58. package/dist/finativeBidAdapter.js +1 -1
  59. package/dist/fpdModule.js +1 -1
  60. package/dist/gamoshiBidAdapter.js +1 -1
  61. package/dist/glimpseBidAdapter.js +1 -1
  62. package/dist/gmosspBidAdapter.js +1 -1
  63. package/dist/goldbachBidAdapter.js +1 -1
  64. package/dist/gothamadsBidAdapter.js +1 -1
  65. package/dist/gridBidAdapter.js +1 -1
  66. package/dist/gridNMBidAdapter.js +1 -1
  67. package/dist/gumgumBidAdapter.js +1 -1
  68. package/dist/h12mediaBidAdapter.js +1 -1
  69. package/dist/iasRtdProvider.js +1 -1
  70. package/dist/id5IdSystem.js +1 -1
  71. package/dist/imRtdProvider.js +1 -1
  72. package/dist/impactifyBidAdapter.js +1 -1
  73. package/dist/improvedigitalBidAdapter.js +1 -1
  74. package/dist/inmarBidAdapter.js +1 -1
  75. package/dist/insticatorBidAdapter.js +1 -1
  76. package/dist/ixBidAdapter.js +1 -1
  77. package/dist/justpremiumBidAdapter.js +1 -1
  78. package/dist/konduitAnalyticsAdapter.js +1 -1
  79. package/dist/kueezBidAdapter.js +1 -1
  80. package/dist/lassoBidAdapter.js +1 -1
  81. package/dist/lifestreetBidAdapter.js +1 -1
  82. package/dist/liveIntentAnalyticsAdapter.js +1 -0
  83. package/dist/liveyieldAnalyticsAdapter.js +1 -1
  84. package/dist/logicadBidAdapter.js +1 -1
  85. package/dist/loglyliftBidAdapter.js +1 -1
  86. package/dist/luponmediaBidAdapter.js +1 -1
  87. package/dist/malltvAnalyticsAdapter.js +1 -1
  88. package/dist/marsmediaBidAdapter.js +1 -1
  89. package/dist/mass.js +1 -1
  90. package/dist/mediafuseBidAdapter.js +1 -1
  91. package/dist/mediakeysBidAdapter.js +1 -1
  92. package/dist/mediasniperBidAdapter.js +1 -1
  93. package/dist/mediasquareBidAdapter.js +1 -1
  94. package/dist/mgidBidAdapter.js +1 -1
  95. package/dist/minutemediaBidAdapter.js +1 -1
  96. package/dist/multibid.js +1 -1
  97. package/dist/naveggIdSystem.js +1 -1
  98. package/dist/newspassidBidAdapter.js +1 -1
  99. package/dist/nextMillenniumBidAdapter.js +1 -1
  100. package/dist/not-for-prod/prebid.js +172 -171
  101. package/dist/oguryBidAdapter.js +1 -1
  102. package/dist/oneKeyRtdProvider.js +1 -1
  103. package/dist/onetagBidAdapter.js +1 -1
  104. package/dist/ooloAnalyticsAdapter.js +1 -1
  105. package/dist/openxBidAdapter.js +1 -1
  106. package/dist/openxOrtbBidAdapter.js +1 -1
  107. package/dist/operaadsBidAdapter.js +1 -1
  108. package/dist/outbrainBidAdapter.js +1 -1
  109. package/dist/ozoneBidAdapter.js +1 -1
  110. package/dist/parrableIdSystem.js +1 -1
  111. package/dist/permutiveRtdProvider.js +1 -1
  112. package/dist/pixfutureBidAdapter.js +1 -1
  113. package/dist/prebid-core.js +2 -2
  114. package/dist/prebidServerBidAdapter.js +1 -1
  115. package/dist/priceFloors.js +1 -1
  116. package/dist/pubCommonId.js +1 -1
  117. package/dist/pubgeniusBidAdapter.js +1 -1
  118. package/dist/publinkIdSystem.js +1 -1
  119. package/dist/pubmaticBidAdapter.js +1 -1
  120. package/dist/pubwiseAnalyticsAdapter.js +1 -1
  121. package/dist/pubwiseBidAdapter.js +1 -1
  122. package/dist/pubxBidAdapter.js +1 -1
  123. package/dist/pxyzBidAdapter.js +1 -1
  124. package/dist/quantcastBidAdapter.js +1 -1
  125. package/dist/readpeakBidAdapter.js +1 -1
  126. package/dist/relaidoBidAdapter.js +1 -1
  127. package/dist/rhythmoneBidAdapter.js +1 -1
  128. package/dist/riseBidAdapter.js +1 -1
  129. package/dist/rtdModule.js +1 -1
  130. package/dist/rubiconAnalyticsAdapter.js +1 -1
  131. package/dist/rubiconBidAdapter.js +1 -1
  132. package/dist/seedingAllianceBidAdapter.js +1 -1
  133. package/dist/seedtagBidAdapter.js +1 -1
  134. package/dist/sharethroughAnalyticsAdapter.js +1 -1
  135. package/dist/sharethroughBidAdapter.js +1 -1
  136. package/dist/shinezBidAdapter.js +1 -1
  137. package/dist/sirdataRtdProvider.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/sonobiBidAdapter.js +1 -1
  143. package/dist/sovrnAnalyticsAdapter.js +1 -1
  144. package/dist/sovrnBidAdapter.js +1 -1
  145. package/dist/spotxBidAdapter.js +1 -1
  146. package/dist/sspBCBidAdapter.js +1 -1
  147. package/dist/stroeerCoreBidAdapter.js +1 -1
  148. package/dist/sublimeBidAdapter.js +1 -1
  149. package/dist/synacormediaBidAdapter.js +1 -1
  150. package/dist/targetVideoBidAdapter.js +1 -1
  151. package/dist/teadsBidAdapter.js +1 -1
  152. package/dist/trionBidAdapter.js +1 -1
  153. package/dist/tripleliftBidAdapter.js +1 -1
  154. package/dist/ttdBidAdapter.js +1 -1
  155. package/dist/ucfunnelAnalyticsAdapter.js +1 -1
  156. package/dist/ucfunnelBidAdapter.js +1 -1
  157. package/dist/underdogmediaBidAdapter.js +1 -1
  158. package/dist/undertoneBidAdapter.js +1 -1
  159. package/dist/userId.js +1 -1
  160. package/dist/vidazooBidAdapter.js +1 -1
  161. package/dist/videobyteBidAdapter.js +1 -1
  162. package/dist/viewability.js +1 -1
  163. package/dist/visxBidAdapter.js +1 -1
  164. package/dist/vuukleBidAdapter.js +1 -1
  165. package/dist/weboramaRtdProvider.js +1 -1
  166. package/dist/widespaceBidAdapter.js +1 -1
  167. package/dist/winrBidAdapter.js +1 -1
  168. package/dist/yahoosspBidAdapter.js +1 -1
  169. package/dist/yieldliftBidAdapter.js +1 -1
  170. package/dist/yieldmoBidAdapter.js +1 -1
  171. package/dist/yieldoneAnalyticsAdapter.js +1 -1
  172. package/dist/zeta_global_sspBidAdapter.js +1 -1
  173. package/modules/amxBidAdapter.js +98 -78
  174. package/modules/appnexusBidAdapter.js +73 -12
  175. package/modules/categoryTranslation.js +9 -8
  176. package/modules/consentManagement.js +4 -2
  177. package/modules/consentManagementUsp.js +17 -14
  178. package/modules/cpmstarBidAdapter.js +2 -1
  179. package/modules/currency.js +4 -3
  180. package/modules/dataControllerModule/index.js +4 -3
  181. package/modules/dchain.js +3 -2
  182. package/modules/dianomiBidAdapter.js +17 -14
  183. package/modules/dianomiBidAdapter.md +1 -1
  184. package/modules/feedadBidAdapter.js +40 -8
  185. package/modules/fpdModule/index.js +3 -2
  186. package/modules/iasRtdProvider.js +17 -3
  187. package/modules/ixBidAdapter.js +2 -5
  188. package/modules/liveIntentAnalyticsAdapter.js +148 -0
  189. package/modules/liveIntentAnalyticsAdapter.md +22 -0
  190. package/modules/mass.js +5 -3
  191. package/modules/multibid/index.js +4 -2
  192. package/modules/naveggIdSystem.js +53 -22
  193. package/modules/nextMillenniumBidAdapter.js +168 -55
  194. package/modules/openxOrtbBidAdapter.js +1 -1
  195. package/modules/prebidServerBidAdapter/index.js +18 -4
  196. package/modules/priceFloors.js +5 -4
  197. package/modules/pubCommonId.js +3 -2
  198. package/modules/rtdModule/index.js +3 -2
  199. package/modules/sharethroughBidAdapter.js +8 -6
  200. package/modules/spotxBidAdapter.js +1 -0
  201. package/modules/stroeerCoreBidAdapter.js +129 -92
  202. package/modules/stroeerCoreBidAdapter.md +52 -14
  203. package/modules/teadsBidAdapter.js +32 -10
  204. package/modules/ucfunnelBidAdapter.js +9 -10
  205. package/modules/userId/index.js +73 -48
  206. package/modules/viewability.js +2 -170
  207. package/package.json +3 -3
  208. package/src/adapterManager.js +21 -13
  209. package/src/adapters/bidderFactory.js +28 -6
  210. package/src/auction.js +17 -4
  211. package/src/auctionManager.js +5 -0
  212. package/src/constants.json +2 -0
  213. package/src/native.js +5 -2
  214. package/src/prebid.js +52 -23
  215. package/src/secureCreatives.js +1 -1
  216. package/src/utils/perfMetrics.js +386 -0
  217. package/src/utils.js +1 -1
  218. package/test/helpers/testing-utils.js +4 -3
  219. package/test/spec/modules/adriverIdSystem_spec.js +7 -3
  220. package/test/spec/modules/amxBidAdapter_spec.js +250 -192
  221. package/test/spec/modules/appnexusBidAdapter_spec.js +61 -6
  222. package/test/spec/modules/consentManagementUsp_spec.js +6 -2
  223. package/test/spec/modules/dianomiBidAdapter_spec.js +326 -6
  224. package/test/spec/modules/feedadBidAdapter_spec.js +147 -11
  225. package/test/spec/modules/iasRtdProvider_spec.js +3 -1
  226. package/test/spec/modules/ixBidAdapter_spec.js +0 -64
  227. package/test/spec/modules/liveIntentAnalyticsAdapter_spec.js +297 -0
  228. package/test/spec/modules/nextMillenniumBidAdapter_spec.js +103 -1
  229. package/test/spec/modules/openxOrtbBidAdapter_spec.js +31 -0
  230. package/test/spec/modules/sharethroughBidAdapter_spec.js +23 -2
  231. package/test/spec/modules/spotxBidAdapter_spec.js +6 -0
  232. package/test/spec/modules/stroeerCoreBidAdapter_spec.js +315 -33
  233. package/test/spec/modules/teadsBidAdapter_spec.js +65 -11
  234. package/test/spec/modules/ucfunnelBidAdapter_spec.js +24 -10
  235. package/test/spec/native_spec.js +11 -0
  236. package/test/spec/unit/utils/perfMetrics_spec.js +394 -0
  237. package/wdio.conf.js +1 -0
  238. package/modules/viewability.md +0 -87
  239. package/test/spec/modules/viewability_spec.js +0 -280
@@ -610,7 +610,7 @@ describe('AppNexusAdapter', function () {
610
610
  config.getConfig.restore();
611
611
  });
612
612
 
613
- it('adds auction level keywords to request when set', function () {
613
+ it('adds auction level keywords and ortb2 keywords to request when set', function () {
614
614
  let bidRequest = Object.assign({}, bidRequests[0]);
615
615
  sinon
616
616
  .stub(config, 'getConfig')
@@ -618,10 +618,31 @@ describe('AppNexusAdapter', function () {
618
618
  .returns({
619
619
  gender: 'm',
620
620
  music: ['rock', 'pop'],
621
- test: ''
621
+ test: '',
622
+ tools: 'power'
622
623
  });
623
624
 
624
- const request = spec.buildRequests([bidRequest]);
625
+ const bidderRequest = {
626
+ ortb2: {
627
+ site: {
628
+ keywords: 'power tools, drills, tools=industrial',
629
+ content: {
630
+ keywords: 'video, source=streaming'
631
+ }
632
+ },
633
+ user: {
634
+ keywords: 'tools=home,renting'
635
+ },
636
+ app: {
637
+ keywords: 'app=iphone 11',
638
+ content: {
639
+ keywords: 'appcontent=home repair, dyi'
640
+ }
641
+ }
642
+ }
643
+ };
644
+
645
+ const request = spec.buildRequests([bidRequest], bidderRequest);
625
646
  const payload = JSON.parse(request.data);
626
647
 
627
648
  expect(payload.keywords).to.deep.equal([{
@@ -632,6 +653,28 @@ describe('AppNexusAdapter', function () {
632
653
  'value': ['rock', 'pop']
633
654
  }, {
634
655
  'key': 'test'
656
+ }, {
657
+ 'key': 'tools',
658
+ 'value': ['power', 'industrial', 'home']
659
+ }, {
660
+ 'key': 'power tools'
661
+ }, {
662
+ 'key': 'drills'
663
+ }, {
664
+ 'key': 'video'
665
+ }, {
666
+ 'key': 'source',
667
+ 'value': ['streaming']
668
+ }, {
669
+ 'key': 'renting'
670
+ }, {
671
+ 'key': 'app',
672
+ 'value': ['iphone 11']
673
+ }, {
674
+ 'key': 'appcontent',
675
+ 'value': ['home repair']
676
+ }, {
677
+ 'key': 'dyi'
635
678
  }]);
636
679
 
637
680
  config.getConfig.restore();
@@ -714,7 +757,7 @@ describe('AppNexusAdapter', function () {
714
757
  });
715
758
  }
716
759
 
717
- it('should convert keyword params to proper form and attaches to request', function () {
760
+ it('should convert keyword params and adUnit ortb2 keywords to proper form and attaches to request', function () {
718
761
  let bidRequest = Object.assign({},
719
762
  bidRequests[0],
720
763
  {
@@ -730,6 +773,13 @@ describe('AppNexusAdapter', function () {
730
773
  emptyArr: [''],
731
774
  badValue: { 'foo': 'bar' } // should be dropped
732
775
  }
776
+ },
777
+ ortb2Imp: {
778
+ ext: {
779
+ data: {
780
+ keywords: 'ortb2=yes,ortb2test, multiValMixed=4, singleValNum=456'
781
+ }
782
+ }
733
783
  }
734
784
  }
735
785
  );
@@ -748,14 +798,19 @@ describe('AppNexusAdapter', function () {
748
798
  'value': ['5']
749
799
  }, {
750
800
  'key': 'multiValMixed',
751
- 'value': ['value1', '2', 'value3']
801
+ 'value': ['value1', '2', 'value3', '4']
752
802
  }, {
753
803
  'key': 'singleValNum',
754
- 'value': ['123']
804
+ 'value': ['123', '456']
755
805
  }, {
756
806
  'key': 'emptyStr'
757
807
  }, {
758
808
  'key': 'emptyArr'
809
+ }, {
810
+ 'key': 'ortb2',
811
+ 'value': ['yes']
812
+ }, {
813
+ 'key': 'ortb2test'
759
814
  }]);
760
815
  });
761
816
 
@@ -23,8 +23,12 @@ function createIFrameMarker() {
23
23
  }
24
24
 
25
25
  describe('consentManagement', function () {
26
- it('should be enabled by default', () => {
27
- expect(uspDataHandler.enabled).to.be.true;
26
+ it('should enable itself on requestBids using default values', (done) => {
27
+ requestBidsHook(() => {
28
+ expect(uspDataHandler.enabled).to.be.true;
29
+ expect(consentAPI).to.eql('iab');
30
+ done();
31
+ }, {});
28
32
  });
29
33
  it('should respect configuration set after activation', () => {
30
34
  setConsentConfig({
@@ -198,7 +198,7 @@ describe('Dianomi adapter', () => {
198
198
  {
199
199
  bidId: 'bidId',
200
200
  params: { smartadId: 1234 },
201
- ortb2
201
+ ortb2,
202
202
  },
203
203
  ];
204
204
  let request = JSON.parse(
@@ -225,12 +225,12 @@ describe('Dianomi adapter', () => {
225
225
  name: "publisher's name",
226
226
  },
227
227
  },
228
- }
228
+ };
229
229
  let validBidRequests = [
230
230
  {
231
231
  bidId: 'bidId',
232
232
  params: { smartadId: 1234 },
233
- ortb2
233
+ ortb2,
234
234
  },
235
235
  ];
236
236
  let refererInfo = { page: 'page' };
@@ -342,7 +342,7 @@ describe('Dianomi adapter', () => {
342
342
  },
343
343
  {
344
344
  bidId: 'bidId2',
345
- params: { smartadId: 1234 }
345
+ params: { smartadId: 1234 },
346
346
  },
347
347
  ];
348
348
  let request = JSON.parse(
@@ -1022,7 +1022,7 @@ describe('Dianomi adapter', () => {
1022
1022
  {
1023
1023
  data: null,
1024
1024
  id: 2,
1025
- img: { type: null, url: 'test.url.com/Files/58345/308185.jpg?bv=1', w: 30, h: 10 },
1025
+ img: { type: null, url: 'test.url.com/Files/58345/308185.jpgbv=1', w: 30, h: 10 },
1026
1026
  required: 0,
1027
1027
  title: null,
1028
1028
  video: null,
@@ -1032,7 +1032,7 @@ describe('Dianomi adapter', () => {
1032
1032
  id: 3,
1033
1033
  img: {
1034
1034
  type: null,
1035
- url: 'test.url.com/Files/58345/308200.jpg?bv=1',
1035
+ url: 'test.url.com/Files/58345/308200.jpgbv=1',
1036
1036
  w: 100,
1037
1037
  h: 100,
1038
1038
  },
@@ -1220,4 +1220,324 @@ describe('Dianomi adapter', () => {
1220
1220
  });
1221
1221
  });
1222
1222
  });
1223
+
1224
+ describe('UserSyncs', () => {
1225
+ let usersyncIframeUrl = 'https://www-prebid.dianomi.com/prebid/usersync/index.html?';
1226
+ let usersyncRedirectUrl = 'https://data.dianomi.com/frontend/usync?';
1227
+ it('should register the usersync iframe', function () {
1228
+ let syncs = spec.getUserSyncs({
1229
+ iframeEnabled: true,
1230
+ });
1231
+
1232
+ expect(syncs).to.deep.equal({ type: 'iframe', url: usersyncIframeUrl });
1233
+ });
1234
+
1235
+ it('should register the usersync redirect', function () {
1236
+ let syncs = spec.getUserSyncs({
1237
+ pixelEnabled: true,
1238
+ });
1239
+
1240
+ expect(syncs).to.deep.equal({ type: 'image', url: usersyncRedirectUrl });
1241
+ });
1242
+
1243
+ it('should pass gdpr params if consent is true', function () {
1244
+ expect(
1245
+ spec.getUserSyncs(
1246
+ { iframeEnabled: true },
1247
+ {},
1248
+ {
1249
+ gdprApplies: true,
1250
+ consentString: 'foo',
1251
+ }
1252
+ )
1253
+ ).to.deep.equal({
1254
+ type: 'iframe',
1255
+ url: `${usersyncIframeUrl}gdpr=1&gdpr_consent=foo`,
1256
+ });
1257
+
1258
+ expect(
1259
+ spec.getUserSyncs(
1260
+ { pixelEnabled: true },
1261
+ {},
1262
+ {
1263
+ gdprApplies: true,
1264
+ consentString: 'foo',
1265
+ }
1266
+ )
1267
+ ).to.deep.equal({
1268
+ type: 'image',
1269
+ url: `${usersyncRedirectUrl}gdpr=1&gdpr_consent=foo`,
1270
+ });
1271
+ });
1272
+
1273
+ it('should pass gdpr params if consent is false', function () {
1274
+ expect(
1275
+ spec.getUserSyncs(
1276
+ { iframeEnabled: true },
1277
+ {},
1278
+ {
1279
+ gdprApplies: false,
1280
+ consentString: 'foo',
1281
+ }
1282
+ )
1283
+ ).to.deep.equal({
1284
+ type: 'iframe',
1285
+ url: `${usersyncIframeUrl}gdpr=0&gdpr_consent=foo`,
1286
+ });
1287
+
1288
+ expect(
1289
+ spec.getUserSyncs(
1290
+ { pixelEnabled: true },
1291
+ {},
1292
+ {
1293
+ gdprApplies: false,
1294
+ consentString: 'foo',
1295
+ }
1296
+ )
1297
+ ).to.deep.equal({
1298
+ type: 'image',
1299
+ url: `${usersyncRedirectUrl}gdpr=0&gdpr_consent=foo`,
1300
+ });
1301
+ });
1302
+
1303
+ it('should pass gdpr param gdpr_consent only when gdprApplies is undefined', function () {
1304
+ expect(
1305
+ spec.getUserSyncs(
1306
+ { iframeEnabled: true },
1307
+ {},
1308
+ {
1309
+ consentString: 'foo',
1310
+ }
1311
+ )
1312
+ ).to.deep.equal({
1313
+ type: 'iframe',
1314
+ url: `${usersyncIframeUrl}gdpr_consent=foo`,
1315
+ });
1316
+
1317
+ expect(
1318
+ spec.getUserSyncs(
1319
+ { pixelEnabled: true },
1320
+ {},
1321
+ {
1322
+ consentString: 'foo',
1323
+ }
1324
+ )
1325
+ ).to.deep.equal({
1326
+ type: 'image',
1327
+ url: `${usersyncRedirectUrl}gdpr_consent=foo`,
1328
+ });
1329
+ });
1330
+
1331
+ it('should pass no params if gdpr consentString is not defined', function () {
1332
+ expect(spec.getUserSyncs({ iframeEnabled: true }, {}, {})).to.deep.equal({
1333
+ type: 'iframe',
1334
+ url: `${usersyncIframeUrl}`,
1335
+ });
1336
+
1337
+ expect(spec.getUserSyncs({ pixelEnabled: true }, {}, {})).to.deep.equal({
1338
+ type: 'image',
1339
+ url: `${usersyncRedirectUrl}`,
1340
+ });
1341
+ });
1342
+
1343
+ it('should pass no params if gdpr consentString is a number', function () {
1344
+ expect(
1345
+ spec.getUserSyncs(
1346
+ { iframeEnabled: true },
1347
+ {},
1348
+ {
1349
+ consentString: 0,
1350
+ }
1351
+ )
1352
+ ).to.deep.equal({
1353
+ type: 'iframe',
1354
+ url: `${usersyncIframeUrl}`,
1355
+ });
1356
+
1357
+ expect(
1358
+ spec.getUserSyncs(
1359
+ { pixelEnabled: true },
1360
+ {},
1361
+ {
1362
+ consentString: 0,
1363
+ }
1364
+ )
1365
+ ).to.deep.equal({
1366
+ type: 'image',
1367
+ url: `${usersyncRedirectUrl}`,
1368
+ });
1369
+ });
1370
+
1371
+ it('should pass no params if gdpr consentString is null', function () {
1372
+ expect(
1373
+ spec.getUserSyncs(
1374
+ { iframeEnabled: true },
1375
+ {},
1376
+ {
1377
+ consentString: null,
1378
+ }
1379
+ )
1380
+ ).to.deep.equal({
1381
+ type: 'iframe',
1382
+ url: `${usersyncIframeUrl}`,
1383
+ });
1384
+
1385
+ expect(
1386
+ spec.getUserSyncs(
1387
+ { pixelEnabled: true },
1388
+ {},
1389
+ {
1390
+ consentString: null,
1391
+ }
1392
+ )
1393
+ ).to.deep.equal({
1394
+ type: 'image',
1395
+ url: `${usersyncRedirectUrl}`,
1396
+ });
1397
+ });
1398
+
1399
+ it('should pass no params if gdpr consentString is a object', function () {
1400
+ expect(
1401
+ spec.getUserSyncs(
1402
+ { iframeEnabled: true },
1403
+ {},
1404
+ {
1405
+ consentString: {},
1406
+ }
1407
+ )
1408
+ ).to.deep.equal({
1409
+ type: 'iframe',
1410
+ url: `${usersyncIframeUrl}`,
1411
+ });
1412
+
1413
+ expect(
1414
+ spec.getUserSyncs(
1415
+ { pixelEnabled: true },
1416
+ {},
1417
+ {
1418
+ consentString: {},
1419
+ }
1420
+ )
1421
+ ).to.deep.equal({
1422
+ type: 'image',
1423
+ url: `${usersyncRedirectUrl}`,
1424
+ });
1425
+ });
1426
+
1427
+ it('should pass no params if gdpr is not defined', function () {
1428
+ expect(spec.getUserSyncs({ iframeEnabled: true }, {}, undefined)).to.deep.equal({
1429
+ type: 'iframe',
1430
+ url: `${usersyncIframeUrl}`,
1431
+ });
1432
+
1433
+ expect(spec.getUserSyncs({ pixelEnabled: true }, {}, undefined)).to.deep.equal({
1434
+ type: 'image',
1435
+ url: `${usersyncRedirectUrl}`,
1436
+ });
1437
+ });
1438
+
1439
+ it('should pass us_privacy if uspConsent is defined', function () {
1440
+ expect(spec.getUserSyncs({ iframeEnabled: true }, {}, undefined, '1NYN')).to.deep.equal({
1441
+ type: 'iframe',
1442
+ url: `${usersyncIframeUrl}us_privacy=1NYN`,
1443
+ });
1444
+
1445
+ expect(spec.getUserSyncs({ pixelEnabled: true }, {}, undefined, '1NYN')).to.deep.equal({
1446
+ type: 'image',
1447
+ url: `${usersyncRedirectUrl}us_privacy=1NYN`,
1448
+ });
1449
+ });
1450
+
1451
+ it('should pass us_privacy after gdpr if both are present', function () {
1452
+ expect(
1453
+ spec.getUserSyncs(
1454
+ { iframeEnabled: true },
1455
+ {},
1456
+ {
1457
+ consentString: 'foo',
1458
+ },
1459
+ '1NYN'
1460
+ )
1461
+ ).to.deep.equal({
1462
+ type: 'iframe',
1463
+ url: `${usersyncIframeUrl}gdpr_consent=foo&us_privacy=1NYN`,
1464
+ });
1465
+
1466
+ expect(
1467
+ spec.getUserSyncs(
1468
+ { pixelEnabled: true },
1469
+ {},
1470
+ {
1471
+ consentString: 'foo',
1472
+ },
1473
+ '1NYN'
1474
+ )
1475
+ ).to.deep.equal({
1476
+ type: 'image',
1477
+ url: `${usersyncRedirectUrl}gdpr_consent=foo&us_privacy=1NYN`,
1478
+ });
1479
+ });
1480
+
1481
+ it('should pass gdprApplies', function () {
1482
+ expect(
1483
+ spec.getUserSyncs(
1484
+ { iframeEnabled: true },
1485
+ {},
1486
+ {
1487
+ gdprApplies: true,
1488
+ },
1489
+ '1NYN'
1490
+ )
1491
+ ).to.deep.equal({
1492
+ type: 'iframe',
1493
+ url: `${usersyncIframeUrl}gdpr=1&us_privacy=1NYN`,
1494
+ });
1495
+
1496
+ expect(
1497
+ spec.getUserSyncs(
1498
+ { pixelEnabled: true },
1499
+ {},
1500
+ {
1501
+ gdprApplies: true,
1502
+ },
1503
+ '1NYN'
1504
+ )
1505
+ ).to.deep.equal({
1506
+ type: 'image',
1507
+ url: `${usersyncRedirectUrl}gdpr=1&us_privacy=1NYN`,
1508
+ });
1509
+ });
1510
+
1511
+ it('should pass all correctly', function () {
1512
+ expect(
1513
+ spec.getUserSyncs(
1514
+ { iframeEnabled: true },
1515
+ {},
1516
+ {
1517
+ gdprApplies: true,
1518
+ consentString: 'foo',
1519
+ },
1520
+ '1NYN'
1521
+ )
1522
+ ).to.deep.equal({
1523
+ type: 'iframe',
1524
+ url: `${usersyncIframeUrl}gdpr=1&gdpr_consent=foo&us_privacy=1NYN`,
1525
+ });
1526
+
1527
+ expect(
1528
+ spec.getUserSyncs(
1529
+ { pixelEnabled: true },
1530
+ {},
1531
+ {
1532
+ gdprApplies: true,
1533
+ consentString: 'foo',
1534
+ },
1535
+ '1NYN'
1536
+ )
1537
+ ).to.deep.equal({
1538
+ type: 'image',
1539
+ url: `${usersyncRedirectUrl}gdpr=1&gdpr_consent=foo&us_privacy=1NYN`,
1540
+ });
1541
+ });
1542
+ });
1223
1543
  });
@@ -303,24 +303,160 @@ describe('FeedAdAdapter', function () {
303
303
  });
304
304
 
305
305
  describe('interpretResponse', function () {
306
- const body = [{
307
- foo: 'bar',
308
- sub: {
309
- obj: 5
310
- }
311
- }, {
312
- bar: 'foo'
313
- }];
314
-
315
306
  it('should convert string bodies to JSON', function () {
307
+ const body = [{
308
+ ad: 'bar',
309
+ }];
316
310
  let result = spec.interpretResponse({body: JSON.stringify(body)});
317
311
  expect(result).to.deep.equal(body);
318
312
  });
319
313
 
320
- it('should pass through body objects', function () {
314
+ it('should pass through object bodies', function () {
315
+ const body = [{
316
+ ad: 'bar',
317
+ }];
321
318
  let result = spec.interpretResponse({body});
322
319
  expect(result).to.deep.equal(body);
323
320
  });
321
+
322
+ it('should pass through only bodies with ad fields', function () {
323
+ const bid1 = {
324
+ ad: 'bar',
325
+ other: 'field',
326
+ some: 'thing'
327
+ };
328
+ const bid2 = {
329
+ foo: 'bar'
330
+ };
331
+ const bid3 = {
332
+ ad: 'ad html',
333
+ };
334
+ const body = [bid1, bid2, bid3];
335
+ let result = spec.interpretResponse({body: JSON.stringify(body)});
336
+ expect(result).to.deep.equal([bid1, bid3]);
337
+ });
338
+
339
+ it('should remove extension fields from bid responses', function () {
340
+ const bid = {
341
+ ext: {},
342
+ ad: 'ad html',
343
+ cpm: 100
344
+ };
345
+ const result = spec.interpretResponse({body: JSON.stringify([bid])});
346
+ expect(result[0]).not.to.haveOwnProperty('ext');
347
+ });
348
+
349
+ it('should return an empty array if the response is not an array', function () {
350
+ const bid = {};
351
+ const result = spec.interpretResponse({body: JSON.stringify(bid)});
352
+ expect(result).to.deep.equal([]);
353
+ });
354
+ });
355
+
356
+ describe('getUserSyncs', function () {
357
+ const pixelSync1 = {type: 'image', url: 'the pixel url 1'};
358
+ const pixelSync2 = {type: 'image', url: 'the pixel url 2'};
359
+ const iFrameSync1 = {type: 'iframe', url: 'the iFrame url 1'};
360
+ const iFrameSync2 = {type: 'iframe', url: 'the iFrame url 2'};
361
+
362
+ it('should pass through the syncs out of the extension fields of the server response', function () {
363
+ const serverResponse = [{
364
+ ext: {
365
+ pixels: [pixelSync1, pixelSync2],
366
+ iframes: [iFrameSync1, iFrameSync2],
367
+ }
368
+ }];
369
+ const result = spec.getUserSyncs({iframeEnabled: true, pixelEnabled: true}, serverResponse)
370
+ expect(result).to.deep.equal([
371
+ pixelSync1,
372
+ pixelSync2,
373
+ iFrameSync1,
374
+ iFrameSync2,
375
+ ]);
376
+ });
377
+
378
+ it('should concat the syncs of all responses', function () {
379
+ const serverResponse = [{
380
+ ext: {
381
+ pixels: [pixelSync1],
382
+ iframes: [iFrameSync2],
383
+ },
384
+ ad: 'ad html',
385
+ cpm: 100
386
+ }, {
387
+ ext: {
388
+ iframes: [iFrameSync1],
389
+ }
390
+ }, {
391
+ ext: {
392
+ pixels: [pixelSync2],
393
+ }
394
+ }];
395
+ const result = spec.getUserSyncs({iframeEnabled: true, pixelEnabled: true}, serverResponse);
396
+ expect(result).to.deep.equal([
397
+ pixelSync1,
398
+ iFrameSync2,
399
+ iFrameSync1,
400
+ pixelSync2,
401
+ ]);
402
+ });
403
+
404
+ it('should filter out duplicates', function () {
405
+ const serverResponse = [{
406
+ ext: {
407
+ pixels: [pixelSync1, pixelSync1],
408
+ iframes: [iFrameSync2, iFrameSync2],
409
+ }
410
+ }, {
411
+ ext: {
412
+ iframes: [iFrameSync2, iFrameSync2],
413
+ }
414
+ }];
415
+ const result = spec.getUserSyncs({iframeEnabled: true, pixelEnabled: true}, serverResponse);
416
+ expect(result).to.deep.equal([
417
+ pixelSync1,
418
+ iFrameSync2,
419
+ ]);
420
+ });
421
+
422
+ it('should not include iFrame syncs if the option is disabled', function () {
423
+ const serverResponse = [{
424
+ ext: {
425
+ pixels: [pixelSync1, pixelSync2],
426
+ iframes: [iFrameSync1, iFrameSync2],
427
+ }
428
+ }];
429
+ const result = spec.getUserSyncs({iframeEnabled: false, pixelEnabled: true}, serverResponse);
430
+ expect(result).to.deep.equal([
431
+ pixelSync1,
432
+ pixelSync2,
433
+ ]);
434
+ });
435
+
436
+ it('should not include pixel syncs if the option is disabled', function () {
437
+ const serverResponse = [{
438
+ ext: {
439
+ pixels: [pixelSync1, pixelSync2],
440
+ iframes: [iFrameSync1, iFrameSync2],
441
+ }
442
+ }];
443
+ const result = spec.getUserSyncs({iframeEnabled: true, pixelEnabled: false}, serverResponse);
444
+ expect(result).to.deep.equal([
445
+ iFrameSync1,
446
+ iFrameSync2,
447
+ ]);
448
+ });
449
+
450
+ it('should not include any syncs if the sync options are disabled or missing', function () {
451
+ const serverResponse = [{
452
+ ext: {
453
+ pixels: [pixelSync1, pixelSync2],
454
+ iframes: [iFrameSync1, iFrameSync2],
455
+ }
456
+ }];
457
+ const result = spec.getUserSyncs({iframeEnabled: false, pixelEnabled: false}, serverResponse);
458
+ expect(result).to.deep.equal([]);
459
+ });
324
460
  });
325
461
 
326
462
  describe('event tracking calls', function () {
@@ -456,7 +592,7 @@ describe('FeedAdAdapter', function () {
456
592
  prebid_bid_id: bidId,
457
593
  prebid_transaction_id: transactionId,
458
594
  referer,
459
- sdk_version: '1.0.2'
595
+ sdk_version: '1.0.3'
460
596
  };
461
597
  subject(data);
462
598
  expect(server.requests.length).to.equal(1);
@@ -73,6 +73,7 @@ describe('iasRtdProvider is a RTD provider that', function () {
73
73
  request = server.requests[0];
74
74
  request.respond(200, responseHeader, JSON.stringify(data));
75
75
  expect(request.url).to.be.include(`https://pixel.adsafeprotected.com/services/pub?anId=1234`);
76
+ expect(request.url).to.be.include('url=https%253A%252F%252Fintegralads.com%252Ftest')
76
77
  expect(adUnits).to.length(2);
77
78
  expect(adUnits[0]).to.be.eq(adUnitsOriginal[0]);
78
79
  const targetingKeys = Object.keys(iasTargeting);
@@ -136,7 +137,8 @@ const config = {
136
137
  pubId: 1234,
137
138
  keyMappings: {
138
139
  'id': 'ias_id'
139
- }
140
+ },
141
+ pageUrl: 'https://integralads.com/test'
140
142
  }
141
143
  };
142
144