prebid.js 7.51.0 → 7.53.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 (277) hide show
  1. package/dist/1plusXRtdProvider.js +1 -1
  2. package/dist/33acrossBidAdapter.js +1 -1
  3. package/dist/33acrossIdSystem.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/adkernelBidAdapter.js +1 -1
  8. package/dist/adqueryBidAdapter.js +1 -1
  9. package/dist/adrelevantisBidAdapter.js +1 -1
  10. package/dist/adriverIdSystem.js +1 -1
  11. package/dist/adtrgtmeBidAdapter.js +1 -1
  12. package/dist/adxcgBidAdapter.js +1 -1
  13. package/dist/adyoulikeBidAdapter.js +1 -1
  14. package/dist/airgridRtdProvider.js +1 -1
  15. package/dist/ajaBidAdapter.js +1 -1
  16. package/dist/allowActivities.js +1 -0
  17. package/dist/amxBidAdapter.js +1 -1
  18. package/dist/amxIdSystem.js +1 -1
  19. package/dist/appierAnalyticsAdapter.js +1 -1
  20. package/dist/appnexusBidAdapter.js +1 -1
  21. package/dist/asoBidAdapter.js +1 -1
  22. package/dist/axonixBidAdapter.js +1 -1
  23. package/dist/beopBidAdapter.js +1 -1
  24. package/dist/bidglassBidAdapter.js +1 -1
  25. package/dist/big-richmediaBidAdapter.js +1 -1
  26. package/dist/bridgewellBidAdapter.js +1 -1
  27. package/dist/brightMountainMediaBidAdapter.js +1 -1
  28. package/dist/carodaBidAdapter.js +1 -1
  29. package/dist/chtnwBidAdapter.js +1 -1
  30. package/dist/conceptxBidAdapter.js +1 -0
  31. package/dist/concertBidAdapter.js +1 -1
  32. package/dist/connectIdSystem.js +1 -1
  33. package/dist/connectadBidAdapter.js +1 -1
  34. package/dist/consumableBidAdapter.js +1 -1
  35. package/dist/conversantAnalyticsAdapter.js +1 -1
  36. package/dist/conversantBidAdapter.js +1 -1
  37. package/dist/craftBidAdapter.js +1 -1
  38. package/dist/criteoBidAdapter.js +1 -1
  39. package/dist/cwireBidAdapter.js +1 -1
  40. package/dist/dependencies.json +6 -0
  41. package/dist/dspxBidAdapter.js +1 -1
  42. package/dist/eplanningBidAdapter.js +1 -1
  43. package/dist/eskimiBidAdapter.js +1 -1
  44. package/dist/euidIdSystem.js +1 -0
  45. package/dist/feedadBidAdapter.js +1 -1
  46. package/dist/finativeBidAdapter.js +1 -1
  47. package/dist/freepassIdSystem.js +1 -0
  48. package/dist/freewheel-sspBidAdapter.js +1 -1
  49. package/dist/gdprEnforcement.js +1 -1
  50. package/dist/glimpseBidAdapter.js +1 -1
  51. package/dist/gmosspBidAdapter.js +1 -1
  52. package/dist/goldbachBidAdapter.js +1 -1
  53. package/dist/greenbidsAnalyticsAdapter.js +1 -1
  54. package/dist/greenbidsRtdProvider.js +1 -1
  55. package/dist/gridBidAdapter.js +1 -1
  56. package/dist/growthCodeRtdProvider.js +1 -0
  57. package/dist/gumgumBidAdapter.js +1 -1
  58. package/dist/h12mediaBidAdapter.js +1 -1
  59. package/dist/id5IdSystem.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/ixBidAdapter.js +1 -1
  64. package/dist/justpremiumBidAdapter.js +1 -1
  65. package/dist/kargoBidAdapter.js +1 -1
  66. package/dist/konduitAnalyticsAdapter.js +1 -1
  67. package/dist/kueezBidAdapter.js +1 -1
  68. package/dist/kueezRtbBidAdapter.js +1 -1
  69. package/dist/kulturemediaBidAdapter.js +1 -1
  70. package/dist/lassoBidAdapter.js +1 -1
  71. package/dist/lifestreetBidAdapter.js +1 -1
  72. package/dist/limelightDigitalBidAdapter.js +1 -1
  73. package/dist/liveyieldAnalyticsAdapter.js +1 -1
  74. package/dist/logicadBidAdapter.js +1 -1
  75. package/dist/loglyliftBidAdapter.js +1 -1
  76. package/dist/magniteAnalyticsAdapter.js +1 -1
  77. package/dist/malltvAnalyticsAdapter.js +1 -1
  78. package/dist/marsmediaBidAdapter.js +1 -1
  79. package/dist/mediafuseBidAdapter.js +1 -1
  80. package/dist/mediasquareBidAdapter.js +1 -1
  81. package/dist/mgidBidAdapter.js +1 -1
  82. package/dist/minutemediaBidAdapter.js +1 -1
  83. package/dist/minutemediaplusBidAdapter.js +1 -1
  84. package/dist/nexx360BidAdapter.js +1 -1
  85. package/dist/not-for-prod/prebid.js +154 -146
  86. package/dist/objectGuard.js +1 -0
  87. package/dist/oguryBidAdapter.js +1 -1
  88. package/dist/onetagBidAdapter.js +1 -1
  89. package/dist/ooloAnalyticsAdapter.js +1 -1
  90. package/dist/optidigitalBidAdapter.js +1 -1
  91. package/dist/outbrainBidAdapter.js +1 -1
  92. package/dist/oxxionAnalyticsAdapter.js +1 -0
  93. package/dist/pairIdSystem.js +1 -1
  94. package/dist/parrableIdSystem.js +1 -1
  95. package/dist/pixfutureBidAdapter.js +1 -1
  96. package/dist/prebid-core.js +1 -1
  97. package/dist/proxistoreBidAdapter.js +1 -1
  98. package/dist/publinkIdSystem.js +1 -1
  99. package/dist/pubmaticBidAdapter.js +1 -1
  100. package/dist/pubwiseAnalyticsAdapter.js +1 -1
  101. package/dist/pxyzBidAdapter.js +1 -1
  102. package/dist/quantcastBidAdapter.js +1 -1
  103. package/dist/readpeakBidAdapter.js +1 -1
  104. package/dist/relaidoBidAdapter.js +1 -1
  105. package/dist/retailspotBidAdapter.js +1 -1
  106. package/dist/rhythmoneBidAdapter.js +1 -1
  107. package/dist/richaudienceBidAdapter.js +1 -1
  108. package/dist/riseBidAdapter.js +1 -1
  109. package/dist/rtdModule.js +1 -1
  110. package/dist/rubiconAnalyticsAdapter.js +1 -1
  111. package/dist/rubiconBidAdapter.js +1 -1
  112. package/dist/schain.js +1 -1
  113. package/dist/seedingAllianceBidAdapter.js +1 -1
  114. package/dist/seedtagBidAdapter.js +1 -1
  115. package/dist/sharethroughAnalyticsAdapter.js +1 -1
  116. package/dist/sharethroughBidAdapter.js +1 -1
  117. package/dist/shinezBidAdapter.js +1 -1
  118. package/dist/sirdataRtdProvider.js +1 -1
  119. package/dist/smaatoBidAdapter.js +1 -1
  120. package/dist/smartadserverBidAdapter.js +1 -1
  121. package/dist/smartxBidAdapter.js +1 -1
  122. package/dist/smilewantedBidAdapter.js +1 -1
  123. package/dist/sonobiBidAdapter.js +1 -1
  124. package/dist/sovrnAnalyticsAdapter.js +1 -1
  125. package/dist/sovrnBidAdapter.js +1 -1
  126. package/dist/sspBCBidAdapter.js +1 -1
  127. package/dist/stroeerCoreBidAdapter.js +1 -1
  128. package/dist/stvBidAdapter.js +1 -1
  129. package/dist/sublimeBidAdapter.js +1 -1
  130. package/dist/synacormediaBidAdapter.js +1 -1
  131. package/dist/targetVideoBidAdapter.js +1 -1
  132. package/dist/teadsBidAdapter.js +1 -1
  133. package/dist/trionBidAdapter.js +1 -1
  134. package/dist/tripleliftBidAdapter.js +1 -1
  135. package/dist/ttdBidAdapter.js +1 -1
  136. package/dist/ucfunnelAnalyticsAdapter.js +1 -1
  137. package/dist/uid2IdSystem.js +1 -1
  138. package/dist/uid2IdSystem_shared.js +1 -0
  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/videobyteBidAdapter.js +1 -1
  144. package/dist/viouslyBidAdapter.js +1 -1
  145. package/dist/visxBidAdapter.js +1 -1
  146. package/dist/vuukleBidAdapter.js +1 -1
  147. package/dist/weboramaRtdProvider.js +1 -1
  148. package/dist/widespaceBidAdapter.js +1 -1
  149. package/dist/winrBidAdapter.js +1 -1
  150. package/dist/yahoosspBidAdapter.js +1 -1
  151. package/dist/yieldlabBidAdapter.js +1 -1
  152. package/dist/yieldmoBidAdapter.js +1 -1
  153. package/dist/yieldoneAnalyticsAdapter.js +1 -1
  154. package/dist/zeta_global_sspBidAdapter.js +1 -1
  155. package/integrationExamples/gpt/growthcode.html +20 -9
  156. package/integrationExamples/gpt/userId_example.html +20 -6
  157. package/libraries/objectGuard/objectGuard.js +108 -0
  158. package/libraries/objectGuard/ortbGuard.js +88 -0
  159. package/modules/.submodules.json +3 -1
  160. package/modules/1plusXRtdProvider.js +31 -60
  161. package/modules/adagioBidAdapter.js +86 -24
  162. package/modules/adgenerationBidAdapter.js +14 -5
  163. package/modules/adkernelBidAdapter.js +2 -2
  164. package/modules/adriverIdSystem.js +1 -1
  165. package/modules/airgridRtdProvider.js +11 -12
  166. package/modules/allowActivities.js +74 -0
  167. package/modules/asoBidAdapter.js +2 -1
  168. package/modules/beopBidAdapter.js +6 -0
  169. package/modules/conceptxBidAdapter.js +70 -0
  170. package/modules/conceptxBidAdapter.md +36 -0
  171. package/modules/connectIdSystem.js +89 -13
  172. package/modules/connectIdSystem.md +4 -7
  173. package/modules/criteoBidAdapter.js +18 -2
  174. package/modules/eskimiBidAdapter.js +171 -41
  175. package/modules/eskimiBidAdapter.md +35 -16
  176. package/modules/euidIdSystem.js +121 -0
  177. package/modules/euidIdSystem.md +131 -0
  178. package/modules/freepassIdSystem.js +61 -0
  179. package/modules/freepassIdSystem.md +47 -0
  180. package/modules/gdprEnforcement.js +98 -169
  181. package/modules/greenbidsAnalyticsAdapter.js +1 -1
  182. package/modules/growthCodeRtdProvider.js +131 -0
  183. package/modules/growthCodeRtdProvider.md +55 -0
  184. package/modules/id5IdSystem.js +3 -5
  185. package/modules/ixBidAdapter.js +17 -3
  186. package/modules/limelightDigitalBidAdapter.js +1 -1
  187. package/modules/logicadBidAdapter.js +14 -1
  188. package/modules/mediasquareBidAdapter.js +13 -5
  189. package/modules/nexx360BidAdapter.js +1 -0
  190. package/modules/oxxionAnalyticsAdapter.js +212 -0
  191. package/modules/oxxionAnalyticsAdapter.md +33 -0
  192. package/modules/pairIdSystem.js +16 -11
  193. package/modules/proxistoreBidAdapter.js +11 -14
  194. package/modules/richaudienceBidAdapter.js +10 -1
  195. package/modules/riseBidAdapter.js +1 -1
  196. package/modules/rtdModule/index.js +12 -1
  197. package/modules/schain.js +2 -2
  198. package/modules/sharethroughBidAdapter.js +2 -2
  199. package/modules/sirdataRtdProvider.js +73 -146
  200. package/modules/smartadserverBidAdapter.js +5 -0
  201. package/modules/sovrnBidAdapter.js +4 -1
  202. package/modules/stroeerCoreBidAdapter.js +55 -6
  203. package/modules/stvBidAdapter.js +34 -1
  204. package/modules/uid2IdSystem.js +27 -210
  205. package/modules/uid2IdSystem.md +104 -23
  206. package/modules/uid2IdSystem_shared.js +232 -0
  207. package/modules/undertoneBidAdapter.js +9 -1
  208. package/modules/userId/eids.js +8 -0
  209. package/modules/userId/index.js +69 -41
  210. package/modules/userId/userId.md +2 -1
  211. package/modules/viouslyBidAdapter.js +2 -2
  212. package/modules/weboramaRtdProvider.js +25 -95
  213. package/modules/weboramaRtdProvider.md +4 -4
  214. package/modules/yahoosspBidAdapter.js +45 -3
  215. package/modules/yahoosspBidAdapter.md +1 -1
  216. package/modules/yieldlabBidAdapter.js +23 -14
  217. package/modules/zeta_global_sspBidAdapter.js +28 -22
  218. package/package.json +1 -1
  219. package/src/activities/activities.js +47 -0
  220. package/src/activities/activityParams.js +8 -0
  221. package/src/activities/modules.js +1 -1
  222. package/src/activities/params.js +59 -0
  223. package/src/activities/redactor.js +157 -0
  224. package/src/activities/rules.js +95 -0
  225. package/src/adapterManager.js +45 -8
  226. package/src/adloader.js +1 -0
  227. package/src/fpd/rootDomain.js +1 -1
  228. package/src/prebid.js +1 -1
  229. package/src/storageManager.js +57 -44
  230. package/src/userSync.js +35 -18
  231. package/test/spec/activities/allowActivites_spec.js +138 -0
  232. package/test/spec/activities/objectGuard_spec.js +144 -0
  233. package/test/spec/activities/ortbGuard_spec.js +140 -0
  234. package/test/spec/activities/params_spec.js +25 -0
  235. package/test/spec/activities/redactor_spec.js +296 -0
  236. package/test/spec/activities/rules_spec.js +135 -0
  237. package/test/spec/modules/1plusXRtdProvider_spec.js +98 -149
  238. package/test/spec/modules/adagioBidAdapter_spec.js +46 -17
  239. package/test/spec/modules/adgenerationBidAdapter_spec.js +52 -12
  240. package/test/spec/modules/airgridRtdProvider_spec.js +2 -0
  241. package/test/spec/modules/beopBidAdapter_spec.js +24 -0
  242. package/test/spec/modules/conceptxBidAdapter_spec.js +136 -0
  243. package/test/spec/modules/connectIdSystem_spec.js +291 -23
  244. package/test/spec/modules/criteoBidAdapter_spec.js +85 -1
  245. package/test/spec/modules/eids_spec.js +15 -0
  246. package/test/spec/modules/eskimiBidAdapter_spec.js +264 -112
  247. package/test/spec/modules/euidIdSystem_spec.js +130 -0
  248. package/test/spec/modules/freepassIdSystem_spec.js +186 -0
  249. package/test/spec/modules/gdprEnforcement_spec.js +127 -414
  250. package/test/spec/modules/growthCodeRtdProvider_spec.js +127 -0
  251. package/test/spec/modules/id5IdSystem_spec.js +10 -3
  252. package/test/spec/modules/ixBidAdapter_spec.js +32 -1
  253. package/test/spec/modules/logicadBidAdapter_spec.js +122 -2
  254. package/test/spec/modules/mediasquareBidAdapter_spec.js +4 -0
  255. package/test/spec/modules/oxxionAnalyticsAdapter_spec.js +324 -0
  256. package/test/spec/modules/pairIdSystem_spec.js +16 -3
  257. package/test/spec/modules/realTimeDataModule_spec.js +1 -1
  258. package/test/spec/modules/richaudienceBidAdapter_spec.js +44 -0
  259. package/test/spec/modules/schain_spec.js +9 -0
  260. package/test/spec/modules/sharethroughBidAdapter_spec.js +1 -1
  261. package/test/spec/modules/sirdataRtdProvider_spec.js +110 -17
  262. package/test/spec/modules/smartadserverBidAdapter_spec.js +42 -0
  263. package/test/spec/modules/sovrnBidAdapter_spec.js +13 -0
  264. package/test/spec/modules/stroeerCoreBidAdapter_spec.js +151 -6
  265. package/test/spec/modules/stvBidAdapter_spec.js +13 -1
  266. package/test/spec/modules/uid2IdSystem_helpers.js +70 -0
  267. package/test/spec/modules/uid2IdSystem_spec.js +131 -86
  268. package/test/spec/modules/undertoneBidAdapter_spec.js +57 -1
  269. package/test/spec/modules/userId_spec.js +96 -33
  270. package/test/spec/modules/weboramaRtdProvider_spec.js +331 -205
  271. package/test/spec/modules/yahoosspBidAdapter_spec.js +103 -51
  272. package/test/spec/modules/yieldlabBidAdapter_spec.js +42 -2
  273. package/test/spec/modules/zeta_global_sspBidAdapter_spec.js +204 -4
  274. package/test/spec/unit/core/adapterManager_spec.js +181 -1
  275. package/test/spec/unit/core/storageManager_spec.js +76 -68
  276. package/test/spec/unit/pbjs_api_spec.js +15 -25
  277. package/test/spec/userSync_spec.js +45 -16
@@ -348,6 +348,21 @@ describe('eids array generation for known sub-modules', function() {
348
348
  });
349
349
  });
350
350
 
351
+ it('euid', function() {
352
+ const userId = {
353
+ euid: {'id': 'Sample_AD_Token'}
354
+ };
355
+ const newEids = createEidsArray(userId);
356
+ expect(newEids.length).to.equal(1);
357
+ expect(newEids[0]).to.deep.equal({
358
+ source: 'euid.eu',
359
+ uids: [{
360
+ id: 'Sample_AD_Token',
361
+ atype: 3
362
+ }]
363
+ });
364
+ });
365
+
351
366
  it('kpuid', function() {
352
367
  const userId = {
353
368
  kpuid: 'Sample_Token'
@@ -1,155 +1,307 @@
1
- import {expect} from 'chai';
2
- import {spec} from 'modules/eskimiBidAdapter.js';
3
-
4
- const REQUEST = {
5
- 'bidderCode': 'eskimi',
6
- 'auctionId': 'auctionId-56a2-4f71-9098-720a68f2f708',
7
- 'bidderRequestId': 'requestId',
8
- 'bidRequest': [{
9
- 'bidder': 'eskimi',
10
- 'params': {
11
- 'placementId': 1003000,
12
- 'accId': 123
1
+ import { expect } from 'chai';
2
+ import { spec } from 'modules/eskimiBidAdapter.js';
3
+ import * as utils from 'src/utils';
4
+
5
+ const BANNER_BID = {
6
+ bidder: 'eskimi',
7
+ params: {
8
+ placementId: 1003000
9
+ },
10
+ mediaTypes: {
11
+ banner: {
12
+ sizes: [
13
+ [300, 250]
14
+ ],
13
15
  },
14
- 'sizes': [
15
- [300, 250]
16
- ],
17
- 'bidId': 'bidId1',
18
- 'adUnitCode': 'adUnitCode1',
19
- 'bidderRequestId': 'bidderRequestId',
20
- 'auctionId': 'auctionId-56a2-4f71-9098-720a68f2f708'
21
16
  },
22
- {
23
- 'bidder': 'eskimi',
24
- 'params': {
25
- 'placementId': 1003001,
26
- 'accId': 123
17
+ adUnitCode: 'adUnitCode1',
18
+ bidId: 'bidId',
19
+ bidderRequestId: 'bidderRequestId',
20
+ auctionId: 'auctionId-56a2-4f71-9098-720a68f2f708',
21
+ };
22
+
23
+ const VIDEO_BID = {
24
+ bidder: 'eskimi',
25
+ params: {
26
+ placementId: 1003000
27
+ },
28
+ mediaTypes: {
29
+ video: {
30
+ context: 'outstream',
31
+ api: [1, 2, 4, 6],
32
+ mimes: ['video/mp4'],
33
+ playbackmethod: [2, 4, 6],
34
+ playerSize: [[1024, 768]],
35
+ protocols: [3, 4, 7, 8, 10],
36
+ placement: 1,
37
+ minduration: 0,
38
+ maxduration: 60,
39
+ startdelay: 0
27
40
  },
28
- 'sizes': [
29
- [300, 250]
30
- ],
31
- 'bidId': 'bidId2',
32
- 'adUnitCode': 'adUnitCode2',
33
- 'bidderRequestId': 'bidderRequestId',
34
- 'auctionId': 'auctionId-56a2-4f71-9098-720a68f2f708'
35
- }],
36
- 'start': 1487883186070,
37
- 'auctionStart': 1487883186069,
38
- 'timeout': 3000
41
+ },
42
+ adUnitCode: 'adUnitCode1',
43
+ bidId: 'bidId',
44
+ bidderRequestId: 'bidderRequestId',
45
+ auctionId: 'auctionId-56a2-4f71-9098-720a68f2f708',
39
46
  };
40
47
 
41
- const RESPONSE = {
42
- 'headers': null,
43
- 'body': {
44
- 'id': 'requestId',
45
- 'seatbid': [
46
- {
47
- 'bid': [
48
- {
49
- 'id': 'bidId1',
50
- 'impid': 'bidId1',
51
- 'price': 0.18,
52
- 'adm': '<script>adm</script>',
53
- 'adid': '144762342',
54
- 'adomain': [
55
- 'https://dummydomain.com'
56
- ],
57
- 'iurl': 'iurl',
58
- 'cid': '109',
59
- 'crid': 'creativeId',
60
- 'cat': [],
61
- 'w': 300,
62
- 'h': 250,
63
- 'ext': {
64
- 'prebid': {
65
- 'type': 'banner'
66
- },
67
- 'bidder': {
68
- 'eskimi': {
69
- 'brand_id': 334553,
70
- 'auction_id': 514667951122925701,
71
- 'bidder_id': 2,
72
- 'bid_ad_type': 0
73
- }
74
- }
75
- }
76
- }
77
- ],
78
- 'seat': 'seat'
79
- }
80
- ]
48
+ const BIDDER_REQUEST = {
49
+ auctionId: 'auctionId-56a2-4f71-9098-720a68f2f708',
50
+ bidderRequestId: 'bidderRequestId',
51
+ timeout: 3000,
52
+ refererInfo: {
53
+ page: 'https://hello-world-page.com/',
54
+ domain: 'hello-world-page.com',
55
+ ref: 'http://example-domain.com/foo',
81
56
  }
82
57
  };
83
58
 
59
+ const BANNER_BID_RESPONSE = {
60
+ 'id': 'bidderRequestId',
61
+ 'bidId': 'bidid',
62
+ 'seatbid': [
63
+ {
64
+ 'bid': [
65
+ {
66
+ 'id': 'id',
67
+ 'impid': 'bidId',
68
+ 'price': 0.18,
69
+ 'adm': '<script>adm</script>',
70
+ 'adid': '144762342',
71
+ 'burl': 'http://0.0.0.0:8181/burl',
72
+ 'adomain': [
73
+ 'https://dummydomain.com'
74
+ ],
75
+ 'cid': 'cid',
76
+ 'crid': 'crid',
77
+ 'iurl': 'iurl',
78
+ 'cat': [],
79
+ 'w': 300,
80
+ 'h': 250
81
+ }
82
+ ]
83
+ }
84
+ ],
85
+ 'cur': 'USD'
86
+ };
87
+
88
+ const VIDEO_BID_RESPONSE = {
89
+ 'id': 'bidderRequestId',
90
+ 'bidid': 'bidid',
91
+ 'seatbid': [
92
+ {
93
+ 'bid': [
94
+ {
95
+ 'id': 'id',
96
+ 'impid': 'bidId',
97
+ 'price': 1.09,
98
+ 'adid': '144762342',
99
+ 'burl': 'http://0.0.0.0:8181/burl',
100
+ 'adm': '<VAST version="4.2"></VAST>',
101
+ 'adomain': [
102
+ 'https://dummydomain.com'
103
+ ],
104
+ 'cid': 'cid',
105
+ 'crid': 'crid',
106
+ 'iurl': 'iurl',
107
+ 'cat': [],
108
+ 'h': 768,
109
+ 'w': 1024
110
+ }
111
+ ]
112
+ }
113
+ ],
114
+ 'cur': 'USD'
115
+ };
116
+
84
117
  describe('Eskimi bid adapter', function () {
85
- describe('isBidRequestValid', function () {
118
+ describe('isBidRequestValid()', function () {
86
119
  it('should accept request if placementId is passed', function () {
87
120
  let bid = {
88
121
  bidder: 'eskimi',
89
122
  params: {
90
123
  placementId: 123
124
+ },
125
+ mediaTypes: {
126
+ banner: {
127
+ sizes: [[300, 250]]
128
+ }
91
129
  }
92
130
  };
93
131
  expect(spec.isBidRequestValid(bid)).to.equal(true);
94
132
  });
95
- it('reject requests without params', function () {
133
+
134
+ it('should reject requests without params', function () {
96
135
  let bid = {
97
136
  bidder: 'eskimi',
98
137
  params: {}
99
138
  };
100
139
  expect(spec.isBidRequestValid(bid)).to.equal(false);
101
140
  });
102
- });
103
141
 
104
- describe('buildRequests', function () {
105
- it('creates request data', function () {
106
- let request = spec.buildRequests(REQUEST.bidRequest, REQUEST)[0];
107
- expect(request).to.exist.and.to.be.a('object');
108
- const payload = request.data;
109
- expect(payload.imp[0]).to.have.property('id', REQUEST.bidRequest[0].bidId);
110
- expect(payload.imp[1]).to.have.property('id', REQUEST.bidRequest[1].bidId);
142
+ it('should return true when required params found', () => {
143
+ expect(spec.isBidRequestValid(BANNER_BID)).to.equal(true);
144
+ expect(spec.isBidRequestValid(VIDEO_BID)).to.equal(true);
111
145
  });
146
+ });
112
147
 
113
- it('has gdpr data if applicable', function () {
114
- const req = Object.assign({}, REQUEST, {
148
+ describe('buildRequests()', function () {
149
+ it('should have gdpr data if applicable', function () {
150
+ const bid = utils.deepClone(BANNER_BID);
151
+
152
+ const req = Object.assign({}, BIDDER_REQUEST, {
115
153
  gdprConsent: {
116
154
  consentString: 'consentString',
117
155
  gdprApplies: true,
118
156
  }
119
157
  });
120
- let request = spec.buildRequests(REQUEST.bidRequest, req)[0];
158
+ let request = spec.buildRequests([bid], req)[0];
121
159
 
122
160
  const payload = request.data;
123
161
  expect(payload.user.ext).to.have.property('consent', req.gdprConsent.consentString);
124
162
  expect(payload.regs.ext).to.have.property('gdpr', 1);
125
163
  });
126
- });
127
164
 
128
- describe('interpretResponse', function () {
129
- it('has bids', function () {
130
- let request = spec.buildRequests(REQUEST.bidRequest, REQUEST)[0];
131
- let bids = spec.interpretResponse(RESPONSE, request);
132
- expect(bids).to.be.an('array').that.is.not.empty;
133
- validateBidOnIndex(0);
134
-
135
- function validateBidOnIndex(index) {
136
- expect(bids[index]).to.have.property('currency', 'USD');
137
- expect(bids[index]).to.have.property('requestId', RESPONSE.body.seatbid[0].bid[index].id);
138
- expect(bids[index]).to.have.property('cpm', RESPONSE.body.seatbid[0].bid[index].price);
139
- expect(bids[index]).to.have.property('width', RESPONSE.body.seatbid[0].bid[index].w);
140
- expect(bids[index]).to.have.property('height', RESPONSE.body.seatbid[0].bid[index].h);
141
- expect(bids[index]).to.have.property('ad', RESPONSE.body.seatbid[0].bid[index].adm);
142
- expect(bids[index]).to.have.property('creativeId', RESPONSE.body.seatbid[0].bid[index].crid);
143
- expect(bids[index]).to.have.property('ttl', 30);
144
- expect(bids[index]).to.have.property('netRevenue', true);
145
- }
165
+ it('should properly forward ORTB blocking params', function () {
166
+ let bid = utils.deepClone(BANNER_BID);
167
+ bid = utils.mergeDeep(bid, {
168
+ params: { bcat: ['IAB1-1'], badv: ['example.com'], bapp: ['com.example'] },
169
+ mediaTypes: { banner: { battr: [1] } }
170
+ });
171
+
172
+ let [request] = spec.buildRequests([bid], BIDDER_REQUEST);
173
+
174
+ expect(request).to.exist.and.to.be.an('object');
175
+ const payload = request.data;
176
+ expect(payload).to.have.deep.property('bcat', ['IAB1-1']);
177
+ expect(payload).to.have.deep.property('badv', ['example.com']);
178
+ expect(payload).to.have.deep.property('bapp', ['com.example']);
179
+ expect(payload.imp[0].banner).to.have.deep.property('battr', [1]);
180
+ });
181
+
182
+ context('when mediaType is banner', function () {
183
+ it('should build correct request for banner bid with both w, h', () => {
184
+ const bid = utils.deepClone(BANNER_BID);
185
+
186
+ const [request] = spec.buildRequests([bid], BIDDER_REQUEST);
187
+ const requestData = request.data;
188
+
189
+ expect(requestData.imp[0].banner.w).to.equal(300);
190
+ expect(requestData.imp[0].banner.h).to.equal(250);
191
+ });
192
+
193
+ it('should create request data', function () {
194
+ const bid = utils.deepClone(BANNER_BID);
195
+
196
+ let [request] = spec.buildRequests([bid], BIDDER_REQUEST);
197
+ expect(request).to.exist.and.to.be.a('object');
198
+ const payload = request.data;
199
+ expect(payload.imp[0]).to.have.property('id', bid.bidId);
200
+ });
146
201
  });
147
202
 
148
- it('handles empty response', function () {
149
- let request = spec.buildRequests(REQUEST.bidRequest, REQUEST)[0];
150
- const EMPTY_RESP = Object.assign({}, RESPONSE, {'body': {}});
151
- const bids = spec.interpretResponse(EMPTY_RESP, request);
152
- expect(bids).to.be.empty;
203
+ context('when mediaType is video', function () {
204
+ it('should return false when there is no video in mediaTypes', () => {
205
+ const bid = utils.deepClone(VIDEO_BID);
206
+ delete bid.mediaTypes.video;
207
+
208
+ expect(spec.isBidRequestValid(bid)).to.equal(false);
209
+ });
210
+
211
+ it('should reutrn false if player size is not set', () => {
212
+ const bid = utils.deepClone(VIDEO_BID);
213
+ delete bid.mediaTypes.video.playerSize;
214
+
215
+ expect(spec.isBidRequestValid(bid)).to.equal(false);
216
+ });
217
+
218
+ it('should use bidder video params if they are set', () => {
219
+ const videoBidWithParams = utils.deepClone(VIDEO_BID);
220
+ const bidderVideoParams = {
221
+ api: [1, 2],
222
+ mimes: ['video/mp4', 'video/x-flv'],
223
+ playbackmethod: [3, 4],
224
+ protocols: [5, 6],
225
+ placement: 1,
226
+ minduration: 0,
227
+ maxduration: 60,
228
+ w: 1024,
229
+ h: 768,
230
+ startdelay: 0
231
+ };
232
+
233
+ videoBidWithParams.params.video = bidderVideoParams;
234
+
235
+ const requests = spec.buildRequests([videoBidWithParams], BIDDER_REQUEST);
236
+ const request = requests[0].data;
237
+
238
+ expect(request.imp[0]).to.deep.include({
239
+ video: {
240
+ ...bidderVideoParams,
241
+ w: videoBidWithParams.mediaTypes.video.playerSize[0][0],
242
+ h: videoBidWithParams.mediaTypes.video.playerSize[0][1],
243
+ },
244
+ });
245
+ });
153
246
  });
154
247
  });
248
+
249
+ describe('interpretResponse()', function () {
250
+ context('when mediaType is banner', function () {
251
+ it('should correctly interpret valid banner response', function () {
252
+ const bid = utils.deepClone(BANNER_BID);
253
+ const [request] = spec.buildRequests([bid], BIDDER_REQUEST);
254
+ const response = utils.deepClone(BANNER_BID_RESPONSE);
255
+
256
+ const bids = spec.interpretResponse({ body: response }, request);
257
+ expect(bids).to.be.an('array').that.is.not.empty;
258
+
259
+ expect(bids[0].mediaType).to.equal('banner');
260
+ expect(bids[0].burl).to.equal(BANNER_BID_RESPONSE.seatbid[0].bid[0].burl);
261
+ expect(bids[0].currency).to.equal('USD');
262
+ expect(bids[0].requestId).to.equal(BANNER_BID_RESPONSE.seatbid[0].bid[0].impid);
263
+ expect(bids[0].cpm).to.equal(BANNER_BID_RESPONSE.seatbid[0].bid[0].price);
264
+ expect(bids[0].width).to.equal(BANNER_BID_RESPONSE.seatbid[0].bid[0].w);
265
+ expect(bids[0].height).to.equal(BANNER_BID_RESPONSE.seatbid[0].bid[0].h);
266
+ expect(bids[0].ad).to.equal(BANNER_BID_RESPONSE.seatbid[0].bid[0].adm);
267
+ expect(bids[0].creativeId).to.equal(BANNER_BID_RESPONSE.seatbid[0].bid[0].crid);
268
+ expect(bids[0].meta.advertiserDomains[0]).to.equal('https://dummydomain.com');
269
+ expect(bids[0].ttl).to.equal(30);
270
+ expect(bids[0].netRevenue).to.equal(true);
271
+ });
272
+
273
+ it('should handle empty bid response', function () {
274
+ const bid = utils.deepClone(BANNER_BID);
275
+
276
+ let request = spec.buildRequests([bid], BIDDER_REQUEST)[0];
277
+ const EMPTY_RESP = Object.assign({}, BANNER_BID_RESPONSE, { 'body': {} });
278
+ const bids = spec.interpretResponse(EMPTY_RESP, request);
279
+ expect(bids).to.be.empty;
280
+ });
281
+ });
282
+ if (FEATURES.VIDEO) {
283
+ context('when mediaType is video', function () {
284
+ it('should correctly interpret valid instream video response', () => {
285
+ const bid = utils.deepClone(VIDEO_BID);
286
+
287
+ const [request] = spec.buildRequests([bid], BIDDER_REQUEST);
288
+ const bids = spec.interpretResponse({ body: VIDEO_BID_RESPONSE }, request);
289
+ expect(bids).to.be.an('array').that.is.not.empty;
290
+
291
+ expect(bids[0].mediaType).to.equal('video');
292
+ expect(bids[0].burl).to.equal(VIDEO_BID_RESPONSE.seatbid[0].bid[0].burl);
293
+ expect(bids[0].currency).to.equal('USD');
294
+ expect(bids[0].requestId).to.equal(VIDEO_BID_RESPONSE.seatbid[0].bid[0].impid);
295
+ expect(bids[0].cpm).to.equal(VIDEO_BID_RESPONSE.seatbid[0].bid[0].price);
296
+ expect(bids[0].width).to.equal(VIDEO_BID_RESPONSE.seatbid[0].bid[0].w);
297
+ expect(bids[0].height).to.equal(VIDEO_BID_RESPONSE.seatbid[0].bid[0].h);
298
+ expect(bids[0].vastXml).to.equal(VIDEO_BID_RESPONSE.seatbid[0].bid[0].adm);
299
+ expect(bids[0].creativeId).to.equal(VIDEO_BID_RESPONSE.seatbid[0].bid[0].crid);
300
+ expect(bids[0].meta.advertiserDomains[0]).to.equal('https://dummydomain.com');
301
+ expect(bids[0].ttl).to.equal(30);
302
+ expect(bids[0].netRevenue).to.equal(true);
303
+ });
304
+ });
305
+ }
306
+ });
155
307
  });
@@ -0,0 +1,130 @@
1
+ import {coreStorage, init, setSubmoduleRegistry, requestBidsHook} from 'modules/userId/index.js';
2
+ import {config} from 'src/config.js';
3
+ import * as utils from 'src/utils.js';
4
+ import { euidIdSubmodule } from 'modules/euidIdSystem.js';
5
+ import 'modules/consentManagement.js';
6
+ import 'src/prebid.js';
7
+ import { getGlobal } from 'src/prebidGlobal.js';
8
+ import { server } from 'test/mocks/xhr.js';
9
+ import { configureTimerInterceptors } from 'test/mocks/timers.js';
10
+ import { cookieHelpers, runAuction, apiHelpers, setGdprApplies } from './uid2IdSystem_helpers.js';
11
+ import {hook} from 'src/hook.js';
12
+ import {uninstall as uninstallGdprEnforcement} from 'modules/gdprEnforcement.js';
13
+
14
+ let expect = require('chai').expect;
15
+
16
+ // N.B. Most of the EUID code is shared with UID2 - the tests here only cover the happy path.
17
+ // Most of the functionality is covered by the UID2 tests.
18
+
19
+ const moduleCookieName = '__euid_advertising_token';
20
+ const publisherCookieName = '__EUID_SERVER_COOKIE';
21
+ const initialToken = `initial-advertising-token`;
22
+ const legacyToken = 'legacy-advertising-token';
23
+ const refreshedToken = 'refreshed-advertising-token';
24
+ const auctionDelayMs = 10;
25
+
26
+ const makeEuidIdentityContainer = (token) => ({euid: {id: token}});
27
+ const useLocalStorage = true;
28
+ const makePrebidConfig = (params = null, extraSettings = {}, debug = false) => ({
29
+ userSync: { auctionDelay: auctionDelayMs, userIds: [{name: 'euid', params: {storage: useLocalStorage ? 'localStorage' : 'cookie', ...params}, ...extraSettings}] }, debug
30
+ });
31
+
32
+ const apiUrl = 'https://prod.euid.eu/v2/token/refresh';
33
+ const headers = { 'Content-Type': 'application/json' };
34
+ const makeSuccessResponseBody = () => btoa(JSON.stringify({ status: 'success', body: { ...apiHelpers.makeTokenResponse(initialToken), advertising_token: refreshedToken } }));
35
+ const configureEuidResponse = (httpStatus, response) => server.respondWith('POST', apiUrl, (xhr) => xhr.respond(httpStatus, headers, response));
36
+ const expectToken = (bid, token) => expect(bid?.userId ?? {}).to.deep.include(makeEuidIdentityContainer(token));
37
+ const expectNoIdentity = (bid) => expect(bid).to.not.haveOwnProperty('userId');
38
+
39
+ describe('EUID module', function() {
40
+ let suiteSandbox, testSandbox, timerSpy, fullTestTitle, restoreSubtleToUndefined = false;
41
+ before(function() {
42
+ uninstallGdprEnforcement();
43
+ hook.ready();
44
+ suiteSandbox = sinon.sandbox.create();
45
+ if (typeof window.crypto.subtle === 'undefined') {
46
+ restoreSubtleToUndefined = true;
47
+ window.crypto.subtle = { importKey: () => {}, decrypt: () => {} };
48
+ }
49
+ suiteSandbox.stub(window.crypto.subtle, 'importKey').callsFake(() => Promise.resolve());
50
+ suiteSandbox.stub(window.crypto.subtle, 'decrypt').callsFake((settings, key, data) => Promise.resolve(new Uint8Array([...settings.iv, ...data])));
51
+ });
52
+ after(function() {
53
+ suiteSandbox.restore();
54
+ if (restoreSubtleToUndefined) window.crypto.subtle = undefined;
55
+ });
56
+ beforeEach(function() {
57
+ init(config);
58
+ setSubmoduleRegistry([euidIdSubmodule]);
59
+ });
60
+ afterEach(function() {
61
+ $$PREBID_GLOBAL$$.requestBids.removeAll();
62
+ config.resetConfig();
63
+ cookieHelpers.clearCookies(moduleCookieName, publisherCookieName);
64
+ coreStorage.removeDataFromLocalStorage(moduleCookieName);
65
+ });
66
+
67
+ it('When a server-only token value is provided in config but consent is not available, it is not available to the auction.', async function() {
68
+ setGdprApplies();
69
+ config.setConfig(makePrebidConfig(null, {value: makeEuidIdentityContainer(initialToken)}));
70
+ const bid = await runAuction();
71
+ expectNoIdentity(bid);
72
+ });
73
+
74
+ it('When a server-only token value is provided in config, it is available to the auction.', async function() {
75
+ setGdprApplies(true);
76
+ config.setConfig(makePrebidConfig(null, {value: makeEuidIdentityContainer(initialToken)}));
77
+ const bid = await runAuction();
78
+ expectToken(bid, initialToken);
79
+ });
80
+
81
+ it('When a server-only token is provided in the module storage cookie but consent is not available, it is not available to the auction.', async function() {
82
+ setGdprApplies();
83
+ coreStorage.setCookie(moduleCookieName, legacyToken, cookieHelpers.getFutureCookieExpiry());
84
+ config.setConfig({userSync: {auctionDelay: auctionDelayMs, userIds: [{name: 'euid'}]}});
85
+ const bid = await runAuction();
86
+ expectNoIdentity(bid);
87
+ });
88
+
89
+ it('When a server-only token is provided in the module storage cookie, it is available to the auction.', async function() {
90
+ setGdprApplies(true);
91
+ coreStorage.setCookie(moduleCookieName, legacyToken, cookieHelpers.getFutureCookieExpiry());
92
+ config.setConfig({userSync: {auctionDelay: auctionDelayMs, userIds: [{name: 'euid'}]}});
93
+ const bid = await runAuction();
94
+ expectToken(bid, legacyToken);
95
+ })
96
+
97
+ it('When a valid response body is provided in config, it is available to the auction', async function() {
98
+ setGdprApplies(true);
99
+ const euidToken = apiHelpers.makeTokenResponse(initialToken, false, false);
100
+ config.setConfig(makePrebidConfig({euidToken}));
101
+ const bid = await runAuction();
102
+ expectToken(bid, initialToken);
103
+ })
104
+
105
+ it('When a valid response body is provided via cookie, it is available to the auction', async function() {
106
+ setGdprApplies(true);
107
+ const euidToken = apiHelpers.makeTokenResponse(initialToken, false, false);
108
+ cookieHelpers.setPublisherCookie(publisherCookieName, euidToken);
109
+ config.setConfig(makePrebidConfig({euidCookie: publisherCookieName}));
110
+ const bid = await runAuction();
111
+ expectToken(bid, initialToken);
112
+ })
113
+
114
+ it('When an expired token is provided in config, it calls the API.', function() {
115
+ setGdprApplies(true);
116
+ const euidToken = apiHelpers.makeTokenResponse(initialToken, true, true);
117
+ config.setConfig(makePrebidConfig({euidToken}));
118
+ expect(server.requests[0]?.url).to.have.string('https://prod.euid.eu/');
119
+ });
120
+
121
+ it('When an expired token is provided and the API responds in time, the refreshed token is provided to the auction.', async function() {
122
+ setGdprApplies(true);
123
+ const euidToken = apiHelpers.makeTokenResponse(initialToken, true, true);
124
+ configureEuidResponse(200, makeSuccessResponseBody());
125
+ config.setConfig(makePrebidConfig({euidToken}));
126
+ apiHelpers.respondAfterDelay(1);
127
+ const bid = await runAuction();
128
+ expectToken(bid, refreshedToken);
129
+ });
130
+ });