prebid.js 7.22.0 → 7.24.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 (314) hide show
  1. package/dist/33acrossBidAdapter.js +1 -1
  2. package/dist/aaxBlockmeterRtdProvider.js +1 -0
  3. package/dist/adagioBidAdapter.js +1 -1
  4. package/dist/adbookpspBidAdapter.js +1 -1
  5. package/dist/adgenerationBidAdapter.js +1 -1
  6. package/dist/admaticBidAdapter.js +1 -0
  7. package/dist/adrelevantisBidAdapter.js +1 -1
  8. package/dist/adtrgtmeBidAdapter.js +1 -1
  9. package/dist/adxcgBidAdapter.js +1 -1
  10. package/dist/adyoulikeBidAdapter.js +1 -1
  11. package/dist/ajaBidAdapter.js +1 -1
  12. package/dist/amxBidAdapter.js +1 -1
  13. package/dist/amxIdSystem.js +1 -1
  14. package/dist/analyticsAdapter.js +1 -1
  15. package/dist/appierAnalyticsAdapter.js +1 -1
  16. package/dist/appnexusBidAdapter.js +1 -1
  17. package/dist/asoBidAdapter.js +1 -1
  18. package/dist/audiencerunBidAdapter.js +1 -1
  19. package/dist/axonixBidAdapter.js +1 -1
  20. package/dist/bidViewability.js +1 -1
  21. package/dist/bidViewabilityIO.js +1 -1
  22. package/dist/bidglassBidAdapter.js +1 -1
  23. package/dist/big-richmediaBidAdapter.js +1 -1
  24. package/dist/bluebillywigBidAdapter.js +1 -1
  25. package/dist/bridgewellBidAdapter.js +1 -1
  26. package/dist/brightMountainMediaBidAdapter.js +1 -1
  27. package/dist/browsiRtdProvider.js +1 -1
  28. package/dist/carodaBidAdapter.js +1 -1
  29. package/dist/chtnwBidAdapter.js +1 -0
  30. package/dist/cleanioRtdProvider.js +1 -1
  31. package/dist/concertBidAdapter.js +1 -1
  32. package/dist/connectIdSystem.js +1 -1
  33. package/dist/connectadBidAdapter.js +1 -1
  34. package/dist/consentManagement.js +1 -1
  35. package/dist/consentManagementUsp.js +1 -1
  36. package/dist/consumableBidAdapter.js +1 -1
  37. package/dist/conversantBidAdapter.js +1 -1
  38. package/dist/craftBidAdapter.js +1 -1
  39. package/dist/criteoBidAdapter.js +1 -1
  40. package/dist/currency.js +1 -1
  41. package/dist/dependencies.json +19 -0
  42. package/dist/dfpAdServerVideo.js +1 -1
  43. package/dist/dgkeywordRtdProvider.js +1 -1
  44. package/dist/dspxBidAdapter.js +1 -1
  45. package/dist/eplanningBidAdapter.js +1 -1
  46. package/dist/finativeBidAdapter.js +1 -1
  47. package/dist/gdprEnforcement.js +1 -1
  48. package/dist/glimpseBidAdapter.js +1 -1
  49. package/dist/gmosspBidAdapter.js +1 -1
  50. package/dist/goldbachBidAdapter.js +1 -1
  51. package/dist/googleAnalyticsAdapter.js +1 -1
  52. package/dist/gridBidAdapter.js +1 -1
  53. package/dist/gridNMBidAdapter.js +1 -1
  54. package/dist/growthCodeIdSystem.js +1 -1
  55. package/dist/gumgumBidAdapter.js +1 -1
  56. package/dist/h12mediaBidAdapter.js +1 -1
  57. package/dist/id5AnalyticsAdapter.js +1 -1
  58. package/dist/id5IdSystem.js +1 -1
  59. package/dist/impactifyBidAdapter.js +1 -1
  60. package/dist/improvedigitalBidAdapter.js +1 -1
  61. package/dist/inmarBidAdapter.js +1 -1
  62. package/dist/insticatorBidAdapter.js +1 -1
  63. package/dist/instreamTracking.js +1 -1
  64. package/dist/ixBidAdapter.js +1 -1
  65. package/dist/jixieBidAdapter.js +1 -1
  66. package/dist/justpremiumBidAdapter.js +1 -1
  67. package/dist/jwplayerVideoProvider.js +1 -0
  68. package/dist/kargoBidAdapter.js +1 -1
  69. package/dist/konduitAnalyticsAdapter.js +1 -1
  70. package/dist/kueezBidAdapter.js +1 -1
  71. package/dist/kueezRtbBidAdapter.js +1 -0
  72. package/dist/lassoBidAdapter.js +1 -1
  73. package/dist/lifestreetBidAdapter.js +1 -1
  74. package/dist/liveyieldAnalyticsAdapter.js +1 -1
  75. package/dist/logicadBidAdapter.js +1 -1
  76. package/dist/loglyliftBidAdapter.js +1 -1
  77. package/dist/magniteAnalyticsAdapter.js +1 -1
  78. package/dist/malltvAnalyticsAdapter.js +1 -1
  79. package/dist/marsmediaBidAdapter.js +1 -1
  80. package/dist/mediafuseBidAdapter.js +1 -1
  81. package/dist/mediakeysBidAdapter.js +1 -1
  82. package/dist/mediasquareBidAdapter.js +1 -1
  83. package/dist/mgidBidAdapter.js +1 -1
  84. package/dist/mgidRtdProvider.js +1 -0
  85. package/dist/minutemediaBidAdapter.js +1 -1
  86. package/dist/multibid.js +1 -1
  87. package/dist/not-for-prod/prebid.js +153 -141
  88. package/dist/oguryBidAdapter.js +1 -1
  89. package/dist/onetagBidAdapter.js +1 -1
  90. package/dist/ooloAnalyticsAdapter.js +1 -1
  91. package/dist/openxOrtbBidAdapter.js +1 -1
  92. package/dist/ortbConverter.js +1 -0
  93. package/dist/outbrainBidAdapter.js +1 -1
  94. package/dist/oxxionRtdProvider.js +1 -0
  95. package/dist/parrableIdSystem.js +1 -1
  96. package/dist/pbsExtensions.js +1 -0
  97. package/dist/permutiveRtdProvider.js +1 -1
  98. package/dist/pixfutureBidAdapter.js +1 -1
  99. package/dist/prebid-core.js +1 -1
  100. package/dist/prebidServerBidAdapter.js +1 -1
  101. package/dist/priceFloors.js +1 -1
  102. package/dist/pubCommonId.js +1 -1
  103. package/dist/publinkIdSystem.js +1 -1
  104. package/dist/pubmaticBidAdapter.js +1 -1
  105. package/dist/pubwiseAnalyticsAdapter.js +1 -1
  106. package/dist/pxyzBidAdapter.js +1 -1
  107. package/dist/quantcastBidAdapter.js +1 -1
  108. package/dist/readpeakBidAdapter.js +1 -1
  109. package/dist/relaidoBidAdapter.js +1 -1
  110. package/dist/rhythmoneBidAdapter.js +1 -1
  111. package/dist/riseBidAdapter.js +1 -1
  112. package/dist/rtdModule.js +1 -1
  113. package/dist/rubiconAnalyticsAdapter.js +1 -1
  114. package/dist/rubiconBidAdapter.js +1 -1
  115. package/dist/schain.js +1 -1
  116. package/dist/seedingAllianceBidAdapter.js +1 -1
  117. package/dist/seedtagBidAdapter.js +1 -1
  118. package/dist/sharethroughAnalyticsAdapter.js +1 -1
  119. package/dist/sharethroughBidAdapter.js +1 -1
  120. package/dist/shinezBidAdapter.js +1 -1
  121. package/dist/smaatoBidAdapter.js +1 -1
  122. package/dist/smartadserverBidAdapter.js +1 -1
  123. package/dist/smartxBidAdapter.js +1 -1
  124. package/dist/smilewantedBidAdapter.js +1 -1
  125. package/dist/sonobiBidAdapter.js +1 -1
  126. package/dist/sovrnAnalyticsAdapter.js +1 -1
  127. package/dist/sovrnBidAdapter.js +1 -1
  128. package/dist/spotxBidAdapter.js +1 -1
  129. package/dist/sspBCBidAdapter.js +1 -1
  130. package/dist/sublimeBidAdapter.js +1 -1
  131. package/dist/synacormediaBidAdapter.js +1 -1
  132. package/dist/targetVideoBidAdapter.js +1 -1
  133. package/dist/teadsBidAdapter.js +1 -1
  134. package/dist/teadsIdSystem.js +1 -1
  135. package/dist/trionBidAdapter.js +1 -1
  136. package/dist/tripleliftBidAdapter.js +1 -1
  137. package/dist/ttdBidAdapter.js +1 -1
  138. package/dist/ucfunnelAnalyticsAdapter.js +1 -1
  139. package/dist/underdogmediaBidAdapter.js +1 -1
  140. package/dist/undertoneBidAdapter.js +1 -1
  141. package/dist/userId.js +1 -1
  142. package/dist/vidazooBidAdapter.js +1 -1
  143. package/dist/video.js +1 -0
  144. package/dist/videoModule.js +1 -0
  145. package/dist/videobyteBidAdapter.js +1 -1
  146. package/dist/videojsVideoProvider.js +1 -0
  147. package/dist/visxBidAdapter.js +1 -1
  148. package/dist/vuukleBidAdapter.js +1 -1
  149. package/dist/widespaceBidAdapter.js +1 -1
  150. package/dist/winrBidAdapter.js +1 -1
  151. package/dist/yahoosspBidAdapter.js +1 -1
  152. package/dist/yieldmoBidAdapter.js +1 -1
  153. package/dist/yieldoneAnalyticsAdapter.js +1 -1
  154. package/integrationExamples/gpt/mgidRtdProvider_example.html +143 -0
  155. package/integrationExamples/videoModule/jwplayer/bidMarkedAsUsed.html +98 -0
  156. package/integrationExamples/videoModule/jwplayer/bidRequestScheduling.html +89 -0
  157. package/integrationExamples/videoModule/jwplayer/eventListeners.html +244 -0
  158. package/integrationExamples/videoModule/jwplayer/gamAdServerMediation.html +122 -0
  159. package/integrationExamples/videoModule/jwplayer/mediaMetadata.html +80 -0
  160. package/integrationExamples/videoModule/jwplayer/playlist.html +122 -0
  161. package/integrationExamples/videoModule/videojs/bidMarkedAsUsed.html +126 -0
  162. package/integrationExamples/videoModule/videojs/bidRequestScheduling.html +132 -0
  163. package/integrationExamples/videoModule/videojs/eventListeners.html +238 -0
  164. package/integrationExamples/videoModule/videojs/gamAdServerMediation.html +138 -0
  165. package/integrationExamples/videoModule/videojs/mediaMetadata.html +103 -0
  166. package/integrationExamples/videoModule/videojs/playlist.html +151 -0
  167. package/libraries/ortbConverter/README.md +378 -0
  168. package/libraries/ortbConverter/converter.js +135 -0
  169. package/libraries/ortbConverter/lib/composer.js +43 -0
  170. package/libraries/ortbConverter/lib/mergeProcessors.js +9 -0
  171. package/libraries/ortbConverter/lib/sizes.js +14 -0
  172. package/libraries/ortbConverter/processors/banner.js +40 -0
  173. package/libraries/ortbConverter/processors/default.js +167 -0
  174. package/libraries/ortbConverter/processors/mediaType.js +21 -0
  175. package/libraries/ortbConverter/processors/native.js +37 -0
  176. package/libraries/ortbConverter/processors/video.js +66 -0
  177. package/libraries/pbsExtensions/pbsExtensions.js +12 -0
  178. package/libraries/pbsExtensions/processors/aliases.js +17 -0
  179. package/libraries/pbsExtensions/processors/mediaType.js +23 -0
  180. package/libraries/pbsExtensions/processors/params.js +22 -0
  181. package/libraries/pbsExtensions/processors/pbs.js +99 -0
  182. package/libraries/pbsExtensions/processors/requestExtPrebid.js +30 -0
  183. package/libraries/pbsExtensions/processors/video.js +23 -0
  184. package/libraries/video/constants/enums.js +5 -0
  185. package/libraries/video/constants/events.js +97 -0
  186. package/libraries/video/constants/ortb.js +169 -0
  187. package/libraries/video/constants/vendorCodes.js +6 -0
  188. package/libraries/video/shared/eventHandler.js +18 -0
  189. package/libraries/video/shared/parentModule.js +82 -0
  190. package/libraries/video/shared/state.js +47 -0
  191. package/libraries/video/shared/vastXmlBuilder.js +77 -0
  192. package/libraries/video/shared/vastXmlEditor.js +115 -0
  193. package/modules/.submodules.json +7 -1
  194. package/modules/aaxBlockmeterRtdProvider.js +59 -0
  195. package/modules/aaxBlockmeterRtdProvider.md +48 -0
  196. package/modules/admaticBidAdapter.js +147 -0
  197. package/modules/admaticBidAdapter.md +48 -0
  198. package/modules/amxBidAdapter.js +1 -0
  199. package/modules/appnexusBidAdapter.js +38 -1
  200. package/modules/chtnwBidAdapter.js +110 -0
  201. package/modules/chtnwBidAdapter.md +31 -0
  202. package/modules/concertBidAdapter.js +44 -2
  203. package/modules/connectIdSystem.js +36 -23
  204. package/modules/connectIdSystem.md +3 -2
  205. package/modules/consentManagement.js +22 -1
  206. package/modules/consentManagementUsp.js +29 -7
  207. package/modules/criteoBidAdapter.js +25 -5
  208. package/modules/currency.js +9 -0
  209. package/modules/dgkeywordRtdProvider.js +3 -3
  210. package/modules/gridNMBidAdapter.js +10 -14
  211. package/modules/growthCodeIdSystem.js +9 -5
  212. package/modules/gumgumBidAdapter.js +4 -0
  213. package/modules/improvedigitalBidAdapter.js +191 -470
  214. package/modules/ixBidAdapter.js +54 -71
  215. package/modules/jwplayerVideoProvider.js +929 -0
  216. package/modules/jwplayerVideoProvider.md +25 -0
  217. package/modules/kargoBidAdapter.js +1 -1
  218. package/modules/kueezRtbBidAdapter.js +278 -0
  219. package/modules/kueezRtbBidAdapter.md +35 -0
  220. package/modules/magniteAnalyticsAdapter.js +6 -1
  221. package/modules/mgidRtdProvider.js +190 -0
  222. package/modules/mgidRtdProvider.md +51 -0
  223. package/modules/multibid/index.js +12 -0
  224. package/modules/openxOrtbBidAdapter.js +120 -275
  225. package/modules/oxxionRtdProvider.js +119 -0
  226. package/modules/oxxionRtdProvider.md +48 -0
  227. package/modules/permutiveRtdProvider.js +2 -1
  228. package/modules/permutiveRtdProvider.md +36 -1
  229. package/modules/prebidServerBidAdapter/index.js +19 -716
  230. package/modules/prebidServerBidAdapter/ortbConverter.js +274 -0
  231. package/modules/priceFloors.js +73 -1
  232. package/modules/pubmaticBidAdapter.js +21 -29
  233. package/modules/rtdModule/index.js +22 -1
  234. package/modules/schain.js +24 -1
  235. package/modules/spotxBidAdapter.js +16 -15
  236. package/modules/synacormediaBidAdapter.js +1 -1
  237. package/modules/teadsIdSystem.js +5 -0
  238. package/modules/tripleliftBidAdapter.js +1 -1
  239. package/modules/userId/eids.js +3 -10
  240. package/modules/userId/index.js +64 -6
  241. package/modules/videoModule/addingSubmodule.md +521 -0
  242. package/modules/videoModule/coreVideo.js +234 -0
  243. package/modules/videoModule/gamAdServerSubmodule.js +27 -0
  244. package/modules/videoModule/index.js +244 -0
  245. package/modules/videoModule/videoImpressionVerifier.js +206 -0
  246. package/modules/videojsVideoProvider.js +854 -0
  247. package/modules/videojsVideoProvider.md +17 -0
  248. package/package.json +12 -8
  249. package/src/adRendering.js +1 -1
  250. package/src/adapterManager.js +56 -7
  251. package/src/adloader.js +3 -1
  252. package/src/auction.js +6 -1
  253. package/src/events.js +5 -1
  254. package/src/pbjsORTB.js +35 -0
  255. package/src/prebid.js +137 -112
  256. package/src/targeting.js +10 -2
  257. package/src/utils/currency.js +16 -0
  258. package/src/utils.js +21 -0
  259. package/test/spec/auctionmanager_spec.js +15 -0
  260. package/test/spec/modules/aaxBlockmeter_spec.js +58 -0
  261. package/test/spec/modules/admaticBidAdapter_spec.js +46 -0
  262. package/test/spec/modules/chtnwBidAdapter_spec.js +105 -0
  263. package/test/spec/modules/concertBidAdapter_spec.js +56 -0
  264. package/test/spec/modules/connectIdSystem_spec.js +175 -5
  265. package/test/spec/modules/consentManagementUsp_spec.js +64 -18
  266. package/test/spec/modules/criteoBidAdapter_spec.js +28 -0
  267. package/test/spec/modules/dgkeywordRtdProvider_spec.js +3 -3
  268. package/test/spec/modules/eids_spec.js +10 -7
  269. package/test/spec/modules/ftrackIdSystem_spec.js +34 -22
  270. package/test/spec/modules/gumgumBidAdapter_spec.js +15 -0
  271. package/test/spec/modules/improvedigitalBidAdapter_spec.js +231 -211
  272. package/test/spec/modules/ixBidAdapter_spec.js +412 -350
  273. package/test/spec/modules/kueezRtbBidAdapter_spec.js +396 -0
  274. package/test/spec/modules/magniteAnalyticsAdapter_spec.js +26 -0
  275. package/test/spec/modules/mgidRtdProvider_spec.js +366 -0
  276. package/test/spec/modules/openxOrtbBidAdapter_spec.js +77 -49
  277. package/test/spec/modules/oxxionRtdProvider_spec.js +142 -0
  278. package/test/spec/modules/permutiveRtdProvider_spec.js +64 -5
  279. package/test/spec/modules/prebidServerBidAdapter_spec.js +139 -137
  280. package/test/spec/modules/realTimeDataModule_spec.js +65 -0
  281. package/test/spec/modules/tripleliftBidAdapter_spec.js +14 -0
  282. package/test/spec/modules/userId_spec.js +67 -1
  283. package/test/spec/modules/videoModule/coreVideo_spec.js +98 -0
  284. package/test/spec/modules/videoModule/pbVideo_spec.js +362 -0
  285. package/test/spec/modules/videoModule/shared/parentModule_spec.js +73 -0
  286. package/test/spec/modules/videoModule/shared/state_spec.js +26 -0
  287. package/test/spec/modules/videoModule/shared/vastXmlBuilder_spec.js +103 -0
  288. package/test/spec/modules/videoModule/shared/vastXmlEditor_spec.js +209 -0
  289. package/test/spec/modules/videoModule/submodules/jwplayerVideoProvider_spec.js +846 -0
  290. package/test/spec/modules/videoModule/submodules/videojsVideoProvider_spec.js +391 -0
  291. package/test/spec/modules/videoModule/videoImpressionVerifier_spec.js +112 -0
  292. package/test/spec/ortbConverter/banner_spec.js +203 -0
  293. package/test/spec/ortbConverter/composer_spec.js +69 -0
  294. package/test/spec/ortbConverter/converter_spec.js +283 -0
  295. package/test/spec/ortbConverter/currency_spec.js +40 -0
  296. package/test/spec/ortbConverter/default_processors_spec.js +61 -0
  297. package/test/spec/ortbConverter/gdpr_spec.js +38 -0
  298. package/test/spec/ortbConverter/mediaTypes_spec.js +67 -0
  299. package/test/spec/ortbConverter/mergeProcessors_spec.js +59 -0
  300. package/test/spec/ortbConverter/multibid_spec.js +35 -0
  301. package/test/spec/ortbConverter/native_spec.js +95 -0
  302. package/test/spec/ortbConverter/pbjsORTB_spec.js +67 -0
  303. package/test/spec/ortbConverter/pbsExtensions/aliases_spec.js +57 -0
  304. package/test/spec/ortbConverter/pbsExtensions/params_spec.js +96 -0
  305. package/test/spec/ortbConverter/pbsExtensions/video_spec.js +52 -0
  306. package/test/spec/ortbConverter/priceFloors_spec.js +143 -0
  307. package/test/spec/ortbConverter/schain_spec.js +33 -0
  308. package/test/spec/ortbConverter/userId_spec.js +21 -0
  309. package/test/spec/ortbConverter/usp_spec.js +15 -0
  310. package/test/spec/ortbConverter/video_spec.js +189 -0
  311. package/test/spec/unit/core/adapterManager_spec.js +102 -0
  312. package/test/spec/unit/core/targeting_spec.js +34 -0
  313. package/test/spec/unit/pbjs_api_spec.js +124 -45
  314. package/test/spec/utils_spec.js +45 -1
@@ -0,0 +1,58 @@
1
+ import {aaxBlockmeterRtdModule} from '../../../modules/aaxBlockmeterRtdProvider.js';
2
+ import * as sinon from 'sinon';
3
+ import {assert} from 'chai';
4
+
5
+ let sandbox;
6
+ let getTargetingDataSpy;
7
+
8
+ const config = {
9
+ dataProviders: [{
10
+ 'name': 'aaxBlockmeter',
11
+ 'params': {
12
+ 'pub': 'publisher_id',
13
+ }
14
+ }]
15
+ };
16
+
17
+ describe('aaxBlockmeter realtime module', function () {
18
+ beforeEach(function () {
19
+ sandbox = sinon.sandbox.create();
20
+ window.aax = window.aax || {};
21
+ window.aax.getTargetingData = getTargetingDataSpy = sandbox.spy();
22
+ });
23
+
24
+ afterEach(function () {
25
+ sandbox.restore();
26
+ window.aax = {};
27
+ });
28
+
29
+ it('init should return false when config is empty', function () {
30
+ assert.equal(aaxBlockmeterRtdModule.init({}), false);
31
+ });
32
+
33
+ it('init should return false when config.params id is empty', function () {
34
+ assert.equal(aaxBlockmeterRtdModule.init({params: {}}), false);
35
+ });
36
+
37
+ it('init should return true when config.params.pub is not string', function () {
38
+ assert.equal(aaxBlockmeterRtdModule.init({params: {pub: 12345}}), false);
39
+ });
40
+
41
+ it('init should return true when config.params.pub id is passed and is string typed', function () {
42
+ assert.equal(aaxBlockmeterRtdModule.init(config.dataProviders[0]), true);
43
+ });
44
+
45
+ describe('getTargetingData should work correctly', function () {
46
+ it('should return ad unit codes when ad units are present', function () {
47
+ const codes = ['code1', 'code2'];
48
+ assert.deepEqual(aaxBlockmeterRtdModule.getTargetingData(codes), {
49
+ code1: {'atk': 'code1'},
50
+ code2: {'atk': 'code2'},
51
+ });
52
+ });
53
+
54
+ it('should call aax.getTargetingData if loaded', function () {
55
+ aaxBlockmeterRtdModule.getTargetingData([], config.dataProviders[0], null);
56
+ });
57
+ });
58
+ });
@@ -0,0 +1,46 @@
1
+ import {expect} from 'chai';
2
+ import {spec, storage} from 'modules/admaticBidAdapter.js';
3
+ import {newBidder} from 'src/adapters/bidderFactory.js';
4
+ import {getStorageManager} from 'src/storageManager';
5
+
6
+ const ENDPOINT = 'https://layer.serve.admatic.com.tr/v1';
7
+
8
+ describe('admaticBidAdapter', () => {
9
+ const adapter = newBidder(spec);
10
+
11
+ describe('inherited functions', () => {
12
+ it('exists and is a function', () => {
13
+ expect(adapter.callBids).to.exist.and.to.be.a('function');
14
+ });
15
+ });
16
+
17
+ describe('isBidRequestValid', function() {
18
+ let bid = {
19
+ 'bidder': 'admatic',
20
+ 'params': {
21
+ 'networkId': 10433394
22
+ },
23
+ 'adUnitCode': 'adunit-code',
24
+ 'sizes': [[300, 250], [300, 600]],
25
+ 'bidId': '30b31c1838de1e',
26
+ 'bidderRequestId': '22edbae2733bf6',
27
+ 'auctionId': '1d1a030790a475',
28
+ 'creativeId': 'er2ee'
29
+ };
30
+
31
+ it('should return true when required params found', function() {
32
+ expect(spec.isBidRequestValid(bid)).to.equal(true);
33
+ });
34
+
35
+ it('should return false when required params are not passed', function() {
36
+ let bid = Object.assign({}, bid);
37
+ delete bid.params;
38
+
39
+ bid.params = {
40
+ 'networkId': 0
41
+ };
42
+
43
+ expect(spec.isBidRequestValid(bid)).to.equal(false);
44
+ });
45
+ });
46
+ });
@@ -0,0 +1,105 @@
1
+ import { expect } from 'chai';
2
+ import { spec } from '../../../modules/chtnwBidAdapter.js';
3
+ import * as utils from '../../../src/utils.js';
4
+
5
+ describe('ChtnwAdapter', function () {
6
+ describe('isBidRequestValid', function () {
7
+ const bid = {
8
+ code: 'adunit-code',
9
+ bidder: 'chtnw',
10
+ params: {
11
+ placementId: '38EL412LO82XR9O6'
12
+ },
13
+ sizes: [
14
+ [300, 250]
15
+ ],
16
+ };
17
+
18
+ it('should return true when required params found', function () {
19
+ const bidRequest = utils.deepClone(bid);
20
+ expect(spec.isBidRequestValid(bidRequest)).to.equal(true);
21
+ });
22
+
23
+ it('should return false when required params are missing', function () {
24
+ const bidRequest = utils.deepClone(bid);
25
+ delete bidRequest.params;
26
+ expect(spec.isBidRequestValid(bidRequest)).to.equal(false);
27
+ });
28
+ });
29
+
30
+ describe('buildRequests', function () {
31
+ let bidRequests = [{
32
+ code: 'adunit-code',
33
+ bidder: 'chtnw',
34
+ params: {
35
+ placementId: '38EL412LO82XR9O6'
36
+ },
37
+ sizes: [
38
+ [300, 250]
39
+ ],
40
+ }];
41
+
42
+ const request = spec.buildRequests(bidRequests);
43
+
44
+ it('Returns POST method', function () {
45
+ expect(request.method).to.equal('POST');
46
+ });
47
+
48
+ it('Returns general data valid', function () {
49
+ let data = request.data;
50
+ expect(data).to.be.an('object');
51
+ expect(data).to.have.property('bids');
52
+ expect(data).to.have.property('uuid');
53
+ expect(data).to.have.property('device');
54
+ expect(data).to.have.property('site');
55
+ });
56
+ });
57
+
58
+ describe('interpretResponse', function () {
59
+ let responseBody = [{
60
+ 'requestId': 'test',
61
+ 'cpm': 0.5,
62
+ 'currency': 'USD',
63
+ 'width': 300,
64
+ 'height': 250,
65
+ 'netRevenue': true,
66
+ 'ttl': 60,
67
+ 'creativeId': 'AD',
68
+ 'ad': '<h1>AD<h1>',
69
+ 'mediaType': 'banner',
70
+ 'meta': {
71
+ 'advertiserDomains': [
72
+ 'www.example.com'
73
+ ]
74
+ }
75
+ }];
76
+
77
+ it('handles empty bid response', function () {
78
+ let response = {
79
+ body: responseBody
80
+ };
81
+ let result = spec.interpretResponse(response);
82
+ expect(result.length).to.not.equal(0);
83
+ expect(result[0].meta.advertiserDomains).to.be.an('array');
84
+ });
85
+
86
+ it('handles empty bid response', function () {
87
+ let response = {
88
+ body: []
89
+ };
90
+ let result = spec.interpretResponse(response);
91
+ expect(result.length).to.equal(0);
92
+ });
93
+ });
94
+
95
+ describe('getUserSyncs', function () {
96
+ it('should register type is image', function () {
97
+ const syncOptions = {
98
+ 'pixelEnabled': 'true'
99
+ }
100
+ let userSync = spec.getUserSyncs(syncOptions);
101
+ expect(userSync[0].type).to.equal('image');
102
+ expect(userSync[0].url).to.have.string('ssp');
103
+ });
104
+ });
105
+ });
@@ -7,11 +7,33 @@ describe('ConcertAdapter', function () {
7
7
  let bidRequests;
8
8
  let bidRequest;
9
9
  let bidResponse;
10
+ let element;
11
+ let sandbox;
10
12
 
11
13
  afterEach(function () {
12
14
  $$PREBID_GLOBAL$$.bidderSettings = {};
15
+ sandbox.restore();
13
16
  });
17
+
14
18
  beforeEach(function () {
19
+ element = {
20
+ x: 0,
21
+ y: 0,
22
+ width: 0,
23
+ height: 0,
24
+ getBoundingClientRect: () => {
25
+ return {
26
+ width: element.width,
27
+ height: element.height,
28
+
29
+ left: element.x,
30
+ top: element.y,
31
+ right: element.x + element.width,
32
+ bottom: element.y + element.height
33
+ };
34
+ }
35
+ };
36
+
15
37
  $$PREBID_GLOBAL$$.bidderSettings = {
16
38
  concert: {
17
39
  storageAllowed: true
@@ -56,6 +78,9 @@ describe('ConcertAdapter', function () {
56
78
  ]
57
79
  }
58
80
  }
81
+
82
+ sandbox = sinon.sandbox.create();
83
+ sandbox.stub(document, 'getElementById').withArgs('desktop_leaderboard_variable').returns(element)
59
84
  });
60
85
 
61
86
  describe('spec.isBidRequestValid', function() {
@@ -119,6 +144,37 @@ describe('ConcertAdapter', function () {
119
144
 
120
145
  expect(payload.meta.uid).to.equal('foo');
121
146
  });
147
+
148
+ it('should add uid2 to eids list if available', function() {
149
+ bidRequests[0].userId = { uid2: { id: 'uid123' } }
150
+
151
+ const request = spec.buildRequests(bidRequests, bidRequest);
152
+ const payload = JSON.parse(request.data);
153
+ const meta = payload.meta
154
+
155
+ expect(meta.eids.length).to.equal(1);
156
+ expect(meta.eids[0].uids[0].id).to.equal('uid123')
157
+ expect(meta.eids[0].uids[0].atype).to.equal(3)
158
+ })
159
+
160
+ it('should return empty eids list if none are available', function() {
161
+ bidRequests[0].userId = { testId: { id: 'uid123' } }
162
+ const request = spec.buildRequests(bidRequests, bidRequest);
163
+ const payload = JSON.parse(request.data);
164
+ const meta = payload.meta
165
+
166
+ expect(meta.eids.length).to.equal(0);
167
+ });
168
+
169
+ it('should return x/y offset coordiantes when element is present', function() {
170
+ Object.assign(element, { x: 100, y: 0, width: 400, height: 400 })
171
+ const request = spec.buildRequests(bidRequests, bidRequest);
172
+ const payload = JSON.parse(request.data);
173
+ const slot = payload.slots[0];
174
+
175
+ expect(slot.offsetCoordinates.x).to.equal(100)
176
+ expect(slot.offsetCoordinates.y).to.equal(0)
177
+ })
122
178
  });
123
179
 
124
180
  describe('spec.interpretResponse', function() {
@@ -4,6 +4,7 @@ import {connectIdSubmodule} from 'modules/connectIdSystem.js';
4
4
 
5
5
  describe('Yahoo ConnectID Submodule', () => {
6
6
  const HASHED_EMAIL = '6bda6f2fa268bf0438b5423a9861a2cedaa5dec163c03f743cfe05c08a8397b2';
7
+ const PUBLISHER_USER_ID = '975484817';
7
8
  const PIXEL_ID = '1234';
8
9
  const PROD_ENDPOINT = `https://ups.analytics.yahoo.com/ups/${PIXEL_ID}/fed`;
9
10
  const OVERRIDE_ENDPOINT = 'https://foo/bar';
@@ -48,26 +49,55 @@ describe('Yahoo ConnectID Submodule', () => {
48
49
  return result;
49
50
  }
50
51
 
51
- it('returns undefined if he and pixelId params are not passed', () => {
52
+ it('returns undefined if he, pixelId and puid params are not passed', () => {
52
53
  expect(invokeGetIdAPI({}, consentData)).to.be.undefined;
53
54
  expect(ajaxStub.callCount).to.equal(0);
54
55
  });
55
56
 
56
57
  it('returns undefined if the pixelId param is not passed', () => {
57
58
  expect(invokeGetIdAPI({
58
- he: HASHED_EMAIL
59
+ he: HASHED_EMAIL,
60
+ puid: PUBLISHER_USER_ID
59
61
  }, consentData)).to.be.undefined;
60
62
  expect(ajaxStub.callCount).to.equal(0);
61
63
  });
62
64
 
63
- it('returns undefined if the he param is not passed', () => {
65
+ it('returns undefined if the pixelId param is passed, but the he and puid param are not passed', () => {
64
66
  expect(invokeGetIdAPI({
65
67
  pixelId: PIXEL_ID
66
68
  }, consentData)).to.be.undefined;
67
69
  expect(ajaxStub.callCount).to.equal(0);
68
70
  });
69
71
 
70
- it('returns an object with the callback function if the correct params are passed', () => {
72
+ it('returns an object with the callback function if the endpoint override param and the he params are passed', () => {
73
+ let result = invokeGetIdAPI({
74
+ he: HASHED_EMAIL,
75
+ endpoint: OVERRIDE_ENDPOINT
76
+ }, consentData);
77
+ expect(result).to.be.an('object').that.has.all.keys('callback');
78
+ expect(result.callback).to.be.a('function');
79
+ });
80
+
81
+ it('returns an object with the callback function if the endpoint override param and the puid params are passed', () => {
82
+ let result = invokeGetIdAPI({
83
+ puid: PUBLISHER_USER_ID,
84
+ endpoint: OVERRIDE_ENDPOINT
85
+ }, consentData);
86
+ expect(result).to.be.an('object').that.has.all.keys('callback');
87
+ expect(result.callback).to.be.a('function');
88
+ });
89
+
90
+ it('returns an object with the callback function if the endpoint override param and the puid and he params are passed', () => {
91
+ let result = invokeGetIdAPI({
92
+ he: HASHED_EMAIL,
93
+ puid: PUBLISHER_USER_ID,
94
+ endpoint: OVERRIDE_ENDPOINT
95
+ }, consentData);
96
+ expect(result).to.be.an('object').that.has.all.keys('callback');
97
+ expect(result.callback).to.be.a('function');
98
+ });
99
+
100
+ it('returns an object with the callback function if the pixelId and he params are passed', () => {
71
101
  let result = invokeGetIdAPI({
72
102
  he: HASHED_EMAIL,
73
103
  pixelId: PIXEL_ID
@@ -76,6 +106,25 @@ describe('Yahoo ConnectID Submodule', () => {
76
106
  expect(result.callback).to.be.a('function');
77
107
  });
78
108
 
109
+ it('returns an object with the callback function if the pixelId and puid params are passed', () => {
110
+ let result = invokeGetIdAPI({
111
+ puid: PUBLISHER_USER_ID,
112
+ pixelId: PIXEL_ID
113
+ }, consentData);
114
+ expect(result).to.be.an('object').that.has.all.keys('callback');
115
+ expect(result.callback).to.be.a('function');
116
+ });
117
+
118
+ it('returns an object with the callback function if the pixelId, he and puid params are passed', () => {
119
+ let result = invokeGetIdAPI({
120
+ he: HASHED_EMAIL,
121
+ puid: PUBLISHER_USER_ID,
122
+ pixelId: PIXEL_ID
123
+ }, consentData);
124
+ expect(result).to.be.an('object').that.has.all.keys('callback');
125
+ expect(result.callback).to.be.a('function');
126
+ });
127
+
79
128
  it('returns an undefined if the Yahoo specific opt-out key is present in local storage', () => {
80
129
  localStorage.setItem('connectIdOptOut', '1');
81
130
  expect(invokeGetIdAPI({
@@ -96,13 +145,57 @@ describe('Yahoo ConnectID Submodule', () => {
96
145
  localStorage.removeItem('connectIdOptOut');
97
146
  });
98
147
 
99
- it('Makes an ajax GET request to the production API endpoint with query params', () => {
148
+ it('Makes an ajax GET request to the production API endpoint with pixelId and he query params', () => {
149
+ invokeGetIdAPI({
150
+ he: HASHED_EMAIL,
151
+ pixelId: PIXEL_ID
152
+ }, consentData);
153
+
154
+ const expectedParams = {
155
+ he: HASHED_EMAIL,
156
+ pixelId: PIXEL_ID,
157
+ '1p': '0',
158
+ gdpr: '1',
159
+ gdpr_consent: consentData.gdpr.consentString,
160
+ us_privacy: consentData.uspConsent
161
+ };
162
+ const requestQueryParams = parseQS(ajaxStub.firstCall.args[0].split('?')[1]);
163
+
164
+ expect(ajaxStub.firstCall.args[0].indexOf(`${PROD_ENDPOINT}?`)).to.equal(0);
165
+ expect(requestQueryParams).to.deep.equal(expectedParams);
166
+ expect(ajaxStub.firstCall.args[3]).to.deep.equal({method: 'GET', withCredentials: true});
167
+ });
168
+
169
+ it('Makes an ajax GET request to the production API endpoint with pixelId and puid query params', () => {
100
170
  invokeGetIdAPI({
171
+ puid: PUBLISHER_USER_ID,
172
+ pixelId: PIXEL_ID
173
+ }, consentData);
174
+
175
+ const expectedParams = {
176
+ puid: PUBLISHER_USER_ID,
177
+ pixelId: PIXEL_ID,
178
+ '1p': '0',
179
+ gdpr: '1',
180
+ gdpr_consent: consentData.gdpr.consentString,
181
+ us_privacy: consentData.uspConsent
182
+ };
183
+ const requestQueryParams = parseQS(ajaxStub.firstCall.args[0].split('?')[1]);
184
+
185
+ expect(ajaxStub.firstCall.args[0].indexOf(`${PROD_ENDPOINT}?`)).to.equal(0);
186
+ expect(requestQueryParams).to.deep.equal(expectedParams);
187
+ expect(ajaxStub.firstCall.args[3]).to.deep.equal({method: 'GET', withCredentials: true});
188
+ });
189
+
190
+ it('Makes an ajax GET request to the production API endpoint with pixelId, puid and he query params', () => {
191
+ invokeGetIdAPI({
192
+ puid: PUBLISHER_USER_ID,
101
193
  he: HASHED_EMAIL,
102
194
  pixelId: PIXEL_ID
103
195
  }, consentData);
104
196
 
105
197
  const expectedParams = {
198
+ puid: PUBLISHER_USER_ID,
106
199
  he: HASHED_EMAIL,
107
200
  pixelId: PIXEL_ID,
108
201
  '1p': '0',
@@ -185,6 +278,16 @@ describe('Yahoo ConnectID Submodule', () => {
185
278
  });
186
279
 
187
280
  describe('decode()', () => {
281
+ let userHasOptedOutStub;
282
+ beforeEach(() => {
283
+ userHasOptedOutStub = sinon.stub(connectIdSubmodule, 'userHasOptedOut');
284
+ userHasOptedOutStub.returns(false);
285
+ });
286
+
287
+ afterEach(() => {
288
+ userHasOptedOutStub.restore()
289
+ });
290
+
188
291
  const VALID_API_RESPONSES = [{
189
292
  key: 'connectid',
190
293
  expected: '4567',
@@ -205,5 +308,72 @@ describe('Yahoo ConnectID Submodule', () => {
205
308
  expect(connectIdSubmodule.decode(response)).to.be.undefined;
206
309
  });
207
310
  });
311
+
312
+ it('should return undefined if user has utilised the easy opt-out mechanism', () => {
313
+ userHasOptedOutStub.returns(true);
314
+ expect(connectIdSubmodule.decode(VALID_API_RESPONSES[0].payload)).to.be.undefined;
315
+ })
316
+ });
317
+
318
+ describe('getAjaxFn()', () => {
319
+ it('should return a function', () => {
320
+ expect(connectIdSubmodule.getAjaxFn()).to.be.a('function');
321
+ });
322
+ });
323
+
324
+ describe('isEUConsentRequired()', () => {
325
+ it('should return a function', () => {
326
+ expect(connectIdSubmodule.isEUConsentRequired).to.be.a('function');
327
+ });
328
+
329
+ it('should be false if consent data is empty', () => {
330
+ expect(connectIdSubmodule.isEUConsentRequired({})).to.be.false;
331
+ });
332
+
333
+ it('should be false if consent data.gdpr object is empty', () => {
334
+ expect(connectIdSubmodule.isEUConsentRequired({
335
+ gdpr: {}
336
+ })).to.be.false;
337
+ });
338
+
339
+ it('should return false if consent data.gdpr.applies is false', () => {
340
+ expect(connectIdSubmodule.isEUConsentRequired({
341
+ gdpr: {
342
+ gdprApplies: false
343
+ }
344
+ })).to.be.false;
345
+ });
346
+
347
+ it('should return true if consent data.gdpr.applies is true', () => {
348
+ expect(connectIdSubmodule.isEUConsentRequired({
349
+ gdpr: {
350
+ gdprApplies: true
351
+ }
352
+ })).to.be.true;
353
+ });
354
+ });
355
+
356
+ describe('userHasOptedOut()', () => {
357
+ afterEach(() => {
358
+ localStorage.removeItem('connectIdOptOut');
359
+ });
360
+
361
+ it('should return a function', () => {
362
+ expect(connectIdSubmodule.userHasOptedOut).to.be.a('function');
363
+ });
364
+
365
+ it('should return false when local storage key has not been set function', () => {
366
+ expect(connectIdSubmodule.userHasOptedOut()).to.be.false;
367
+ });
368
+
369
+ it('should return true when local storage key has been set to "1"', () => {
370
+ localStorage.setItem('connectIdOptOut', '1');
371
+ expect(connectIdSubmodule.userHasOptedOut()).to.be.true;
372
+ });
373
+
374
+ it('should return false when local storage key has not been set to "1"', () => {
375
+ localStorage.setItem('connectIdOptOut', 'hello');
376
+ expect(connectIdSubmodule.userHasOptedOut()).to.be.false;
377
+ });
208
378
  });
209
379
  });
@@ -8,8 +8,9 @@ import {
8
8
  } from 'modules/consentManagementUsp.js';
9
9
  import * as utils from 'src/utils.js';
10
10
  import { config } from 'src/config.js';
11
- import {uspDataHandler} from 'src/adapterManager.js';
11
+ import adapterManager, {uspDataHandler} from 'src/adapterManager.js';
12
12
  import 'src/prebid.js';
13
+ import {defer} from '../../../src/utils/promise.js';
13
14
 
14
15
  let expect = require('chai').expect;
15
16
 
@@ -23,6 +24,16 @@ function createIFrameMarker() {
23
24
  }
24
25
 
25
26
  describe('consentManagement', function () {
27
+ let sandbox;
28
+ beforeEach(() => {
29
+ sandbox = sinon.sandbox.create();
30
+ sandbox.stub(adapterManager, 'callDataDeletionRequest');
31
+ });
32
+
33
+ afterEach(() => {
34
+ sandbox.restore();
35
+ });
36
+
26
37
  it('should enable itself on requestBids using default values', (done) => {
27
38
  requestBidsHook(() => {
28
39
  expect(uspDataHandler.enabled).to.be.true;
@@ -301,8 +312,11 @@ describe('consentManagement', function () {
301
312
  describe('USPAPI workflow for iframed page', function () {
302
313
  let ifr = null;
303
314
  let stringifyResponse = false;
315
+ let mockApi, replySent;
304
316
 
305
317
  beforeEach(function () {
318
+ mockApi = sinon.stub();
319
+ replySent = defer();
306
320
  sinon.stub(utils, 'logError');
307
321
  sinon.stub(utils, 'logWarn');
308
322
  ifr = createIFrameMarker();
@@ -322,17 +336,21 @@ describe('consentManagement', function () {
322
336
 
323
337
  function uspapiMessageHandler(event) {
324
338
  if (event && event.data) {
325
- var data = event.data;
339
+ const data = event.data;
326
340
  if (data.__uspapiCall) {
327
- var callId = data.__uspapiCall.callId;
328
- var response = {
329
- __uspapiReturn: {
330
- callId,
331
- returnValue: { uspString: '1YY' },
332
- success: true
341
+ const {command, version, callId} = data.__uspapiCall;
342
+ let response = mockApi(command, version, callId);
343
+ if (response) {
344
+ response = {
345
+ __uspapiReturn: {
346
+ callId,
347
+ returnValue: response,
348
+ success: true
349
+ }
333
350
  }
334
- };
335
- event.source.postMessage(stringifyResponse ? JSON.stringify(response) : response, '*');
351
+ event.source.postMessage(stringifyResponse ? JSON.stringify(response) : response, '*');
352
+ replySent.resolve();
353
+ }
336
354
  }
337
355
  }
338
356
  }
@@ -345,6 +363,11 @@ describe('consentManagement', function () {
345
363
  function testIFramedPage(testName, messageFormatString) {
346
364
  it(`should return the consent string from a postmessage + addEventListener response - ${testName}`, (done) => {
347
365
  stringifyResponse = messageFormatString;
366
+ mockApi.callsFake((cmd) => {
367
+ if (cmd === 'getUSPData') {
368
+ return { uspString: '1YY' }
369
+ }
370
+ })
348
371
  setConsentConfig(goodConfig);
349
372
  requestBidsHook(() => {
350
373
  let consent = uspDataHandler.getConsentData();
@@ -355,6 +378,20 @@ describe('consentManagement', function () {
355
378
  }, {});
356
379
  });
357
380
  }
381
+
382
+ it('fires deletion request on registerDeletion', (done) => {
383
+ mockApi.callsFake((cmd) => {
384
+ return cmd === 'registerDeletion'
385
+ })
386
+ sinon.assert.notCalled(adapterManager.callDataDeletionRequest);
387
+ setConsentConfig(goodConfig);
388
+ replySent.promise.then(() => {
389
+ setTimeout(() => { // defer again to give time for the message to get through
390
+ sinon.assert.calledOnce(adapterManager.callDataDeletionRequest);
391
+ done()
392
+ }, 200)
393
+ })
394
+ });
358
395
  });
359
396
 
360
397
  describe('test without iframe locater', function() {
@@ -400,23 +437,19 @@ describe('consentManagement', function () {
400
437
  });
401
438
 
402
439
  describe('USPAPI workflow for normal pages:', function () {
403
- let uspapiStub = sinon.stub();
404
440
  let ifr = null;
405
441
 
406
442
  beforeEach(function () {
407
443
  didHookReturn = false;
408
444
  ifr = createIFrameMarker();
409
- sinon.stub(utils, 'logError');
410
- sinon.stub(utils, 'logWarn');
445
+ sandbox.stub(utils, 'logError');
446
+ sandbox.stub(utils, 'logWarn');
411
447
  window.__uspapi = function() {};
412
448
  });
413
449
 
414
450
  afterEach(function () {
415
451
  config.resetConfig();
416
452
  $$PREBID_GLOBAL$$.requestBids.removeAll();
417
- uspapiStub.restore();
418
- utils.logError.restore();
419
- utils.logWarn.restore();
420
453
  document.body.removeChild(ifr);
421
454
  delete window.__uspapi;
422
455
  resetConsentData();
@@ -427,7 +460,7 @@ describe('consentManagement', function () {
427
460
  uspString: '1NY'
428
461
  };
429
462
 
430
- uspapiStub = sinon.stub(window, '__uspapi').callsFake((...args) => {
463
+ sandbox.stub(window, '__uspapi').callsFake((...args) => {
431
464
  args[2](testConsentData, true);
432
465
  });
433
466
 
@@ -448,7 +481,7 @@ describe('consentManagement', function () {
448
481
  uspString: '1NY'
449
482
  };
450
483
 
451
- uspapiStub = sinon.stub(window, '__uspapi').callsFake((...args) => {
484
+ sandbox.stub(window, '__uspapi').callsFake((...args) => {
452
485
  args[2](testConsentData, true);
453
486
  });
454
487
 
@@ -463,6 +496,19 @@ describe('consentManagement', function () {
463
496
  expect(consentMeta.usp).to.equal(testConsentData.uspString);
464
497
  expect(consentMeta.generatedAt).to.be.above(1644367751709);
465
498
  });
499
+
500
+ it('registers deletion request event listener', () => {
501
+ let listener;
502
+ sandbox.stub(window, '__uspapi').callsFake((cmd, _, cb) => {
503
+ if (cmd === 'registerDeletion') {
504
+ listener = cb;
505
+ }
506
+ });
507
+ setConsentConfig(goodConfig);
508
+ sinon.assert.notCalled(adapterManager.callDataDeletionRequest);
509
+ listener();
510
+ sinon.assert.calledOnce(adapterManager.callDataDeletionRequest);
511
+ })
466
512
  });
467
513
  });
468
514
  });