prebid.js 9.53.2 → 9.53.4

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 (229) hide show
  1. package/dist/33acrossAnalyticsAdapter.js +1 -1
  2. package/dist/33acrossBidAdapter.js +1 -1
  3. package/dist/33acrossIdSystem.js +1 -1
  4. package/dist/BTBidAdapter.js +1 -1
  5. package/dist/adagioAnalyticsAdapter.js +1 -1
  6. package/dist/adagioBidAdapter.js +1 -1
  7. package/dist/adagioRtdProvider.js +1 -1
  8. package/dist/adagioUtils.js +1 -1
  9. package/dist/addefendBidAdapter.js +1 -1
  10. package/dist/adgenerationBidAdapter.js +1 -1
  11. package/dist/adlooxRtdProvider.js +1 -1
  12. package/dist/adqueryBidAdapter.js +1 -1
  13. package/dist/adrelevantisBidAdapter.js +1 -1
  14. package/dist/adstirBidAdapter.js +1 -1
  15. package/dist/adtrgtmeBidAdapter.js +1 -1
  16. package/dist/adxcgAnalyticsAdapter.js +1 -1
  17. package/dist/adxcgBidAdapter.js +1 -1
  18. package/dist/adyoulikeBidAdapter.js +1 -1
  19. package/dist/agmaAnalyticsAdapter.js +1 -1
  20. package/dist/ajaBidAdapter.js +1 -1
  21. package/dist/amxBidAdapter.js +1 -1
  22. package/dist/amxIdSystem.js +1 -1
  23. package/dist/aniviewBidAdapter.js +1 -1
  24. package/dist/appierAnalyticsAdapter.js +1 -1
  25. package/dist/appnexusBidAdapter.js +1 -1
  26. package/dist/asoBidAdapter.js +1 -1
  27. package/dist/axonixBidAdapter.js +1 -1
  28. package/dist/beopBidAdapter.js +1 -1
  29. package/dist/bidderTimeoutUtils.js +1 -0
  30. package/dist/bidglassBidAdapter.js +1 -1
  31. package/dist/big-richmediaBidAdapter.js +1 -1
  32. package/dist/bitmediaBidAdapter.js +1 -1
  33. package/dist/bridBidAdapter.js +1 -1
  34. package/dist/bridgeuppBidAdapter.js +1 -1
  35. package/dist/bridgewellBidAdapter.js +1 -1
  36. package/dist/brightMountainMediaBidAdapter.js +1 -1
  37. package/dist/carodaBidAdapter.js +1 -1
  38. package/dist/chtnwBidAdapter.js +1 -1
  39. package/dist/chunk-core.js +1 -1
  40. package/dist/concertBidAdapter.js +1 -1
  41. package/dist/connectadBidAdapter.js +1 -1
  42. package/dist/consumableBidAdapter.js +1 -1
  43. package/dist/contxtfulBidAdapter.js +1 -1
  44. package/dist/conversantAnalyticsAdapter.js +1 -1
  45. package/dist/conversantBidAdapter.js +1 -1
  46. package/dist/craftBidAdapter.js +1 -1
  47. package/dist/criteoBidAdapter.js +1 -1
  48. package/dist/cwireBidAdapter.js +1 -1
  49. package/dist/dailymotionBidAdapter.js +1 -1
  50. package/dist/debugging-standalone.js +1 -1
  51. package/dist/dependencies.json +10 -1
  52. package/dist/dspxBidAdapter.js +1 -1
  53. package/dist/dxkultureBidAdapter.js +1 -1
  54. package/dist/eplanningBidAdapter.js +1 -1
  55. package/dist/equativBidAdapter.js +1 -1
  56. package/dist/eskimiBidAdapter.js +1 -1
  57. package/dist/euidIdSystem.js +1 -1
  58. package/dist/exadsBidAdapter.js +1 -1
  59. package/dist/excoBidAdapter.js +1 -1
  60. package/dist/feedadBidAdapter.js +1 -1
  61. package/dist/finativeBidAdapter.js +1 -1
  62. package/dist/freewheel-sspBidAdapter.js +1 -1
  63. package/dist/fwsspBidAdapter.js +1 -1
  64. package/dist/gmosspBidAdapter.js +1 -1
  65. package/dist/greenbidsAnalyticsAdapter.js +1 -1
  66. package/dist/greenbidsBidAdapter.js +1 -1
  67. package/dist/greenbidsRtdProvider.js +1 -1
  68. package/dist/gridBidAdapter.js +1 -1
  69. package/dist/gumgumBidAdapter.js +1 -1
  70. package/dist/h12mediaBidAdapter.js +1 -1
  71. package/dist/hypelabBidAdapter.js +1 -1
  72. package/dist/id5AnalyticsAdapter.js +1 -1
  73. package/dist/id5IdSystem.js +1 -1
  74. package/dist/imdsBidAdapter.js +1 -1
  75. package/dist/improvedigitalBidAdapter.js +1 -1
  76. package/dist/inmobiBidAdapter.js +1 -1
  77. package/dist/insticatorBidAdapter.js +1 -1
  78. package/dist/intentIqAnalyticsAdapter.js +1 -1
  79. package/dist/ixBidAdapter.js +1 -1
  80. package/dist/jixieBidAdapter.js +1 -1
  81. package/dist/justpremiumBidAdapter.js +1 -1
  82. package/dist/kargoBidAdapter.js +1 -1
  83. package/dist/kimberliteBidAdapter.js +1 -1
  84. package/dist/konduitAnalyticsAdapter.js +1 -1
  85. package/dist/kueezBidAdapter.js +1 -1
  86. package/dist/lassoBidAdapter.js +1 -1
  87. package/dist/lifestreetBidAdapter.js +1 -1
  88. package/dist/liveIntentId.js +1 -1
  89. package/dist/logicadBidAdapter.js +1 -1
  90. package/dist/loglyliftBidAdapter.js +1 -1
  91. package/dist/luceadBidAdapter.js +1 -1
  92. package/dist/mabidderBidAdapter.js +1 -1
  93. package/dist/madsenseBidAdapter.js +1 -1
  94. package/dist/magniteAnalyticsAdapter.js +1 -1
  95. package/dist/malltvAnalyticsAdapter.js +1 -1
  96. package/dist/marsmediaBidAdapter.js +1 -1
  97. package/dist/mediafuseBidAdapter.js +1 -1
  98. package/dist/medianetBidAdapter.js +1 -1
  99. package/dist/medianetUtils.js +1 -1
  100. package/dist/mediasquareBidAdapter.js +1 -1
  101. package/dist/mgidBidAdapter.js +1 -1
  102. package/dist/missenaBidAdapter.js +1 -1
  103. package/dist/mobilefuseBidAdapter.js +1 -1
  104. package/dist/nextMillenniumBidAdapter.js +1 -1
  105. package/dist/nexx360Utils.js +1 -1
  106. package/dist/nobidAnalyticsAdapter.js +1 -1
  107. package/dist/nobidBidAdapter.js +1 -1
  108. package/dist/nodalsAiRtdProvider.js +1 -1
  109. package/dist/not-for-prod/prebid.js +178 -175
  110. package/dist/objectGuard.js +1 -1
  111. package/dist/oguryBidAdapter.js +1 -1
  112. package/dist/onetagBidAdapter.js +1 -1
  113. package/dist/ooloAnalyticsAdapter.js +1 -1
  114. package/dist/openxBidAdapter.js +1 -1
  115. package/dist/optableRtdProvider.js +1 -1
  116. package/dist/optidigitalBidAdapter.js +1 -1
  117. package/dist/orbidderBidAdapter.js +1 -1
  118. package/dist/outbrainBidAdapter.js +1 -1
  119. package/dist/pixfutureBidAdapter.js +1 -1
  120. package/dist/publinkIdSystem.js +1 -1
  121. package/dist/pubmaticAnalyticsAdapter.js +1 -1
  122. package/dist/pubmaticBidAdapter.js +1 -1
  123. package/dist/pubmaticIdSystem.js +1 -1
  124. package/dist/pubmaticRtdProvider.js +1 -1
  125. package/dist/pubmaticUtils.js +1 -0
  126. package/dist/pubwiseAnalyticsAdapter.js +1 -1
  127. package/dist/pubxaiAnalyticsAdapter.js +1 -1
  128. package/dist/pxyzBidAdapter.js +1 -1
  129. package/dist/quantcastBidAdapter.js +1 -1
  130. package/dist/readpeakBidAdapter.js +1 -1
  131. package/dist/relaidoBidAdapter.js +1 -1
  132. package/dist/retailspotBidAdapter.js +1 -1
  133. package/dist/rhythmoneBidAdapter.js +1 -1
  134. package/dist/riseUtils.js +1 -1
  135. package/dist/rtdModule.js +1 -1
  136. package/dist/rubiconBidAdapter.js +1 -1
  137. package/dist/seedingAllianceBidAdapter.js +1 -1
  138. package/dist/seedtagBidAdapter.js +1 -1
  139. package/dist/sevioBidAdapter.js +1 -0
  140. package/dist/sharethroughAnalyticsAdapter.js +1 -1
  141. package/dist/sharethroughBidAdapter.js +1 -1
  142. package/dist/showheroes-bsBidAdapter.js +1 -1
  143. package/dist/smaatoBidAdapter.js +1 -1
  144. package/dist/smartadserverBidAdapter.js +1 -1
  145. package/dist/smartxBidAdapter.js +1 -1
  146. package/dist/smilewantedBidAdapter.js +1 -1
  147. package/dist/snigelBidAdapter.js +1 -1
  148. package/dist/sonobiBidAdapter.js +1 -1
  149. package/dist/sovrnBidAdapter.js +1 -1
  150. package/dist/sparteoBidAdapter.js +1 -1
  151. package/dist/sspBCBidAdapter.js +1 -1
  152. package/dist/stvBidAdapter.js +1 -1
  153. package/dist/sublimeBidAdapter.js +1 -1
  154. package/dist/taboolaBidAdapter.js +1 -1
  155. package/dist/tappxBidAdapter.js +1 -1
  156. package/dist/targetVideoBidAdapter.js +1 -1
  157. package/dist/teadsBidAdapter.js +1 -1
  158. package/dist/terceptAnalyticsAdapter.js +1 -1
  159. package/dist/themoneytizerBidAdapter.js +1 -1
  160. package/dist/timeoutRtdProvider.js +1 -1
  161. package/dist/trionBidAdapter.js +1 -1
  162. package/dist/tripleliftBidAdapter.js +1 -1
  163. package/dist/ttdBidAdapter.js +1 -1
  164. package/dist/ucfunnelAnalyticsAdapter.js +1 -1
  165. package/dist/uid2IdSystem.js +1 -1
  166. package/dist/underdogmediaBidAdapter.js +1 -1
  167. package/dist/undertoneBidAdapter.js +1 -1
  168. package/dist/unrulyBidAdapter.js +1 -1
  169. package/dist/userId.js +1 -1
  170. package/dist/vidazooUtils.js +1 -1
  171. package/dist/videobyteBidAdapter.js +1 -1
  172. package/dist/visxBidAdapter.js +1 -1
  173. package/dist/vuukleBidAdapter.js +1 -1
  174. package/dist/widespaceBidAdapter.js +1 -1
  175. package/dist/winrBidAdapter.js +1 -1
  176. package/dist/yahooAdsBidAdapter.js +1 -1
  177. package/dist/yandexBidAdapter.js +1 -1
  178. package/dist/yieldmoBidAdapter.js +1 -1
  179. package/dist/yieldoneAnalyticsAdapter.js +1 -1
  180. package/integrationExamples/gpt/pubmaticRtdProvider_Example.html +161 -0
  181. package/libraries/bidderTimeoutUtils/bidderTimeoutUtils.js +119 -0
  182. package/libraries/objectGuard/objectGuard.js +170 -48
  183. package/libraries/objectGuard/ortbGuard.js +33 -43
  184. package/libraries/pubmaticUtils/plugins/dynamicTimeout.js +209 -0
  185. package/libraries/pubmaticUtils/plugins/floorProvider.js +168 -0
  186. package/libraries/pubmaticUtils/plugins/pluginManager.js +106 -0
  187. package/libraries/pubmaticUtils/plugins/unifiedPricingRule.js +375 -0
  188. package/libraries/pubmaticUtils/pubmaticUtils.js +76 -0
  189. package/modules/adagioAnalyticsAdapter.js +6 -1
  190. package/modules/adagioBidAdapter.js +12 -5
  191. package/modules/adagioRtdProvider.js +41 -35
  192. package/modules/fwsspBidAdapter.js +134 -69
  193. package/modules/fwsspBidAdapter.md +121 -26
  194. package/modules/optableRtdProvider.js +33 -12
  195. package/modules/pubmaticAnalyticsAdapter.js +315 -587
  196. package/modules/pubmaticBidAdapter.js +71 -8
  197. package/modules/pubmaticIdSystem.js +4 -4
  198. package/modules/pubmaticRtdProvider.js +105 -613
  199. package/modules/rtdModule/index.js +23 -6
  200. package/modules/sevioBidAdapter.js +413 -0
  201. package/modules/sevioBidAdapter.md +29 -0
  202. package/modules/sparteoBidAdapter.js +122 -10
  203. package/modules/timeoutRtdProvider.js +2 -105
  204. package/modules/ttdBidAdapter.js +0 -5
  205. package/modules/userId/eids.js +1 -1
  206. package/modules/userId/index.js +32 -1
  207. package/package.json +1 -1
  208. package/src/auction.js +3 -0
  209. package/test/spec/activities/objectGuard_spec.js +189 -32
  210. package/test/spec/activities/ortbGuard_spec.js +10 -15
  211. package/test/spec/libraries/bidderTimeoutUtils/bidderTimeoutUtils_spec.js +213 -0
  212. package/test/spec/libraries/pubmaticUtils/plugins/dynamicTimeout_spec.js +746 -0
  213. package/test/spec/libraries/pubmaticUtils/plugins/floorProvider_spec.js +184 -0
  214. package/test/spec/libraries/pubmaticUtils/plugins/pluginManager_spec.js +489 -0
  215. package/test/spec/libraries/pubmaticUtils/plugins/unifiedPricingRule_spec.js +359 -0
  216. package/test/spec/libraries/pubmaticUtils/pubmaticUtils_spec.js +236 -0
  217. package/test/spec/modules/adagioAnalyticsAdapter_spec.js +94 -24
  218. package/test/spec/modules/adagioRtdProvider_spec.js +17 -17
  219. package/test/spec/modules/fwsspBidAdapter_spec.js +513 -78
  220. package/test/spec/modules/optableRtdProvider_spec.js +55 -5
  221. package/test/spec/modules/pubmaticAnalyticsAdapter_spec.js +634 -916
  222. package/test/spec/modules/pubmaticBidAdapter_spec.js +260 -1
  223. package/test/spec/modules/pubmaticRtdProvider_spec.js +252 -1505
  224. package/test/spec/modules/realTimeDataModule_spec.js +58 -8
  225. package/test/spec/modules/sevioBidAdapter_spec.js +513 -0
  226. package/test/spec/modules/sparteoBidAdapter_spec.js +528 -43
  227. package/test/spec/modules/timeoutRtdProvider_spec.js +1 -201
  228. package/test/spec/modules/ttdBidAdapter_spec.js +0 -33
  229. package/test/spec/modules/userId_spec.js +115 -1
@@ -1,208 +1,8 @@
1
- import { timeoutRtdFunctions, timeoutSubmodule } from '../../../modules/timeoutRtdProvider'
1
+ import { timeoutRtdFunctions, timeoutSubmodule } from '../../../modules/timeoutRtdProvider.js'
2
2
  import { expect } from 'chai';
3
3
  import * as ajax from 'src/ajax.js';
4
4
  import * as prebidGlobal from 'src/prebidGlobal.js';
5
5
 
6
- const DEFAULT_USER_AGENT = window.navigator.userAgent;
7
- const DEFAULT_CONNECTION = window.navigator.connection;
8
-
9
- const PC_USER_AGENT = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/42.0.2311.135 Safari/537.36 Edge/12.246';
10
- const MOBILE_USER_AGENT = 'Mozilla/5.0 (iPhone; CPU iPhone OS 10_3_1 like Mac OS X) AppleWebKit/603.1.30 (KHTML, like Gecko) Version/10.0 Mobile/14E304 Safari/602.1';
11
- const TABLET_USER_AGENT = 'Mozilla/5.0 (iPad; CPU OS 12_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148';
12
-
13
- function resetUserAgent() {
14
- window.navigator.__defineGetter__('userAgent', () => DEFAULT_USER_AGENT);
15
- };
16
-
17
- function setUserAgent(userAgent) {
18
- window.navigator.__defineGetter__('userAgent', () => userAgent);
19
- }
20
-
21
- function resetConnection() {
22
- window.navigator.__defineGetter__('connection', () => DEFAULT_CONNECTION);
23
- }
24
- function setConnectionType(connectionType) {
25
- window.navigator.__defineGetter__('connection', () => { return {'type': connectionType} });
26
- }
27
-
28
- describe('getDeviceType', () => {
29
- afterEach(() => {
30
- resetUserAgent();
31
- });
32
-
33
- [
34
- // deviceType, userAgent, deviceTypeNum
35
- ['pc', PC_USER_AGENT, 2],
36
- ['mobile', MOBILE_USER_AGENT, 4],
37
- ['tablet', TABLET_USER_AGENT, 5],
38
- ].forEach(function(args) {
39
- const [deviceType, userAgent, deviceTypeNum] = args;
40
- it(`should be able to recognize ${deviceType} devices`, () => {
41
- setUserAgent(userAgent);
42
- const res = timeoutRtdFunctions.getDeviceType();
43
- expect(res).to.equal(deviceTypeNum)
44
- })
45
- })
46
- });
47
-
48
- describe('getConnectionSpeed', () => {
49
- afterEach(() => {
50
- resetConnection();
51
- });
52
- [
53
- // connectionType, connectionSpeed
54
- ['slow-2g', 'slow'],
55
- ['2g', 'slow'],
56
- ['3g', 'medium'],
57
- ['bluetooth', 'fast'],
58
- ['cellular', 'fast'],
59
- ['ethernet', 'fast'],
60
- ['wifi', 'fast'],
61
- ['wimax', 'fast'],
62
- ['4g', 'fast'],
63
- ['not known', 'unknown'],
64
- [undefined, 'unknown'],
65
- ].forEach(function(args) {
66
- const [connectionType, connectionSpeed] = args;
67
- it(`should be able to categorize connection speed when the connection type is ${connectionType}`, () => {
68
- setConnectionType(connectionType);
69
- const res = timeoutRtdFunctions.getConnectionSpeed();
70
- expect(res).to.equal(connectionSpeed)
71
- })
72
- })
73
- });
74
-
75
- describe('Timeout modifier calculations', () => {
76
- let sandbox;
77
- beforeEach(() => {
78
- sandbox = sinon.createSandbox();
79
- });
80
-
81
- afterEach(() => {
82
- sandbox.restore();
83
- });
84
-
85
- it('should be able to detect video ad units', () => {
86
- let adUnits = []
87
- let res = timeoutRtdFunctions.checkVideo(adUnits);
88
- expect(res).to.be.false;
89
-
90
- adUnits = [{
91
- mediaTypes: {
92
- video: []
93
- }
94
- }];
95
- res = timeoutRtdFunctions.checkVideo(adUnits);
96
- expect(res).to.be.true;
97
-
98
- adUnits = [{
99
- mediaTypes: {
100
- banner: []
101
- }
102
- }];
103
- res = timeoutRtdFunctions.checkVideo(adUnits);
104
- expect(res).to.be.false;
105
- });
106
-
107
- it('should calculate the timeout modifier for video', () => {
108
- sandbox.stub(timeoutRtdFunctions, 'checkVideo').returns(true);
109
- const rules = {
110
- includesVideo: {
111
- 'true': 200,
112
- 'false': 50
113
- }
114
- }
115
- const res = timeoutRtdFunctions.calculateTimeoutModifier([], rules);
116
- expect(res).to.equal(200)
117
- });
118
-
119
- it('should calculate the timeout modifier for connectionSpeed', () => {
120
- sandbox.stub(timeoutRtdFunctions, 'getConnectionSpeed').returns('slow');
121
- const rules = {
122
- connectionSpeed: {
123
- 'slow': 200,
124
- 'medium': 100,
125
- 'fast': 50
126
- }
127
- }
128
- const res = timeoutRtdFunctions.calculateTimeoutModifier([], rules);
129
- expect(res).to.equal(200);
130
- });
131
-
132
- it('should calculate the timeout modifier for deviceType', () => {
133
- sandbox.stub(timeoutRtdFunctions, 'getDeviceType').returns(4);
134
- const rules = {
135
- deviceType: {
136
- '2': 50,
137
- '4': 100,
138
- '5': 200
139
- },
140
- }
141
- const res = timeoutRtdFunctions.calculateTimeoutModifier([], rules);
142
- expect(res).to.equal(100)
143
- });
144
-
145
- it('should calculate the timeout modifier for ranged numAdunits', () => {
146
- const rules = {
147
- numAdUnits: {
148
- '1-5': 100,
149
- '6-10': 200,
150
- '11-15': 300,
151
- }
152
- }
153
- const adUnits = [1, 2, 3, 4, 5, 6];
154
- const res = timeoutRtdFunctions.calculateTimeoutModifier(adUnits, rules);
155
- expect(res).to.equal(200)
156
- });
157
-
158
- it('should calculate the timeout modifier for exact numAdunits', () => {
159
- const rules = {
160
- numAdUnits: {
161
- '1': 100,
162
- '2': 200,
163
- '3': 300,
164
- '4-5': 400,
165
- }
166
- }
167
- const adUnits = [1, 2];
168
- const res = timeoutRtdFunctions.calculateTimeoutModifier(adUnits, rules);
169
- expect(res).to.equal(200);
170
- });
171
-
172
- it('should add up all the modifiers when all the rules are present', () => {
173
- sandbox.stub(timeoutRtdFunctions, 'getConnectionSpeed').returns('slow');
174
- sandbox.stub(timeoutRtdFunctions, 'getDeviceType').returns(4);
175
- const rules = {
176
- connectionSpeed: {
177
- 'slow': 200,
178
- 'medium': 100,
179
- 'fast': 50
180
- },
181
- deviceType: {
182
- '2': 50,
183
- '4': 100,
184
- '5': 200
185
- },
186
- includesVideo: {
187
- 'true': 200,
188
- 'false': 50
189
- },
190
- numAdUnits: {
191
- '1': 100,
192
- '2': 200,
193
- '3': 300,
194
- '4-5': 400,
195
- }
196
- }
197
- const res = timeoutRtdFunctions.calculateTimeoutModifier([{
198
- mediaTypes: {
199
- video: []
200
- }
201
- }], rules);
202
- expect(res).to.equal(600);
203
- });
204
- });
205
-
206
6
  describe('Timeout RTD submodule', () => {
207
7
  let sandbox;
208
8
  beforeEach(() => {
@@ -559,17 +559,6 @@ describe('ttdBidAdapter', function () {
559
559
  expect(requestBody.source.ext.schain).to.deep.equal(schain);
560
560
  });
561
561
 
562
- it('no longer uses userId', function () {
563
- const TDID = '00000000-0000-0000-0000-000000000000';
564
- let clonedBannerRequests = deepClone(baseBannerBidRequests);
565
- clonedBannerRequests[0].userId = {
566
- tdid: TDID
567
- };
568
-
569
- const requestBody = testBuildRequests(clonedBannerRequests, baseBidderRequest).data;
570
- expect(requestBody.user.buyeruid).to.be.undefined;
571
- });
572
-
573
562
  it('adds unified ID and UID2 info to user.ext.eids in the request', function () {
574
563
  const TDID = '00000000-0000-0000-0000-000000000000';
575
564
  const UID2 = '99999999-9999-9999-9999-999999999999';
@@ -601,28 +590,6 @@ describe('ttdBidAdapter', function () {
601
590
 
602
591
  const requestBody = testBuildRequests(clonedBannerRequests, baseBidderRequest).data;
603
592
  expect(requestBody.user.ext.eids).to.deep.equal(expectedEids);
604
- expect(requestBody.user.buyeruid).to.equal(TDID);
605
- });
606
-
607
- it('has an empty buyeruid if tdid not found in userIdAsEids', function () {
608
- const UID2 = '99999999-9999-9999-9999-999999999999';
609
- let clonedBannerRequests = deepClone(baseBannerBidRequests);
610
- clonedBannerRequests[0].userIdAsEids = [
611
- {
612
- source: 'uidapi.com',
613
- uids: [
614
- {
615
- atype: 3,
616
- id: UID2
617
- }
618
- ]
619
- }
620
- ];
621
- const expectedEids = clonedBannerRequests[0].userIdAsEids;
622
-
623
- const requestBody = testBuildRequests(clonedBannerRequests, baseBidderRequest).data;
624
- expect(requestBody.user.ext.eids).to.deep.equal(expectedEids);
625
- expect(requestBody.user.buyeruid).to.be.undefined;
626
593
  });
627
594
 
628
595
  it('adds first party site data to the request', function () {
@@ -11,7 +11,7 @@ import {
11
11
  requestDataDeletion,
12
12
  setStoredValue,
13
13
  setSubmoduleRegistry,
14
- syncDelay,
14
+ syncDelay, adUnitEidsHook,
15
15
  } from 'modules/userId/index.js';
16
16
  import {UID1_EIDS} from 'libraries/uid1Eids/uid1Eids.js';
17
17
  import {createEidsArray, EID_CONFIG} from 'modules/userId/eids.js';
@@ -419,6 +419,34 @@ describe('User ID', function () {
419
419
  ]);
420
420
  });
421
421
 
422
+ it('should not alter values returned by adapters', () => {
423
+ let eid = {
424
+ source: 'someid.org',
425
+ uids: [{id: 'id-1'}]
426
+ };
427
+ const config = new Map([
428
+ ['someId', function () {
429
+ return eid;
430
+ }]
431
+ ]);
432
+ const userid = {
433
+ someId: 'id-1',
434
+ pubProvidedId: [{
435
+ source: 'someid.org',
436
+ uids: [{id: 'id-2'}]
437
+ }],
438
+ }
439
+ createEidsArray(userid, config);
440
+ const allEids = createEidsArray(userid, config);
441
+ expect(allEids).to.eql([
442
+ {
443
+ source: 'someid.org',
444
+ uids: [{id: 'id-1'}, {id: 'id-2'}]
445
+ }
446
+ ])
447
+ expect(eid.uids).to.eql([{'id': 'id-1'}])
448
+ });
449
+
422
450
  it('should filter out entire EID if none of the uids are strings', () => {
423
451
  const eids = createEidsArray({
424
452
  mockId2v3: [null],
@@ -2976,4 +3004,90 @@ describe('User ID', function () {
2976
3004
  });
2977
3005
  })
2978
3006
  });
3007
+ describe('adUnitEidsHook', () => {
3008
+ let next, auction, adUnits, ortb2Fragments;
3009
+ beforeEach(() => {
3010
+ next = sinon.stub();
3011
+ adUnits = [
3012
+ {
3013
+ code: 'au1',
3014
+ bids: [
3015
+ {
3016
+ bidder: 'bidderA'
3017
+ },
3018
+ {
3019
+ bidder: 'bidderB'
3020
+ }
3021
+ ]
3022
+ },
3023
+ {
3024
+ code: 'au2',
3025
+ bids: [
3026
+ {
3027
+ bidder: 'bidderC'
3028
+ }
3029
+ ]
3030
+ }
3031
+ ]
3032
+ ortb2Fragments = {}
3033
+ auction = {
3034
+ getAdUnits: () => adUnits,
3035
+ getFPD: () => ortb2Fragments
3036
+ }
3037
+ });
3038
+ it('should not set userIdAsEids when no eids are provided', () => {
3039
+ adUnitEidsHook(next, auction);
3040
+ auction.getAdUnits().flatMap(au => au.bids).forEach(bid => {
3041
+ expect(bid.userIdAsEids).to.not.exist;
3042
+ })
3043
+ });
3044
+ it('should add global eids', () => {
3045
+ ortb2Fragments.global = {
3046
+ user: {
3047
+ ext: {
3048
+ eids: ['some-eid']
3049
+ }
3050
+ }
3051
+ };
3052
+ adUnitEidsHook(next, auction);
3053
+ auction.getAdUnits().flatMap(au => au.bids).forEach(bid => {
3054
+ expect(bid.userIdAsEids).to.eql(['some-eid']);
3055
+ })
3056
+ })
3057
+ it('should add bidder-specific eids', () => {
3058
+ ortb2Fragments.global = {
3059
+ user: {
3060
+ ext: {
3061
+ eids: ['global']
3062
+ }
3063
+ }
3064
+ };
3065
+ ortb2Fragments.bidder = {
3066
+ bidderA: {
3067
+ user: {
3068
+ ext: {
3069
+ eids: ['bidder']
3070
+ }
3071
+ }
3072
+ }
3073
+ }
3074
+ adUnitEidsHook(next, auction);
3075
+ auction.getAdUnits().flatMap(au => au.bids).forEach(bid => {
3076
+ const expected = bid.bidder === 'bidderA' ? ['global', 'bidder'] : ['global'];
3077
+ expect(bid.userIdAsEids).to.eql(expected);
3078
+ })
3079
+ });
3080
+ it('should add global eids to bidderless bids', () => {
3081
+ ortb2Fragments.global = {
3082
+ user: {
3083
+ ext: {
3084
+ eids: ['global']
3085
+ }
3086
+ }
3087
+ }
3088
+ delete adUnits[0].bids[0].bidder;
3089
+ adUnitEidsHook(next, auction);
3090
+ expect(adUnits[0].bids[0].userIdAsEids).to.eql(['global']);
3091
+ })
3092
+ });
2979
3093
  });