prebid.js 8.52.0 → 8.52.2

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 (159) 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/adbookpspBidAdapter.js +1 -1
  8. package/dist/adgenerationBidAdapter.js +1 -1
  9. package/dist/adqueryBidAdapter.js +1 -1
  10. package/dist/adrelevantisBidAdapter.js +1 -1
  11. package/dist/adstirBidAdapter.js +1 -1
  12. package/dist/adtrgtmeBidAdapter.js +1 -1
  13. package/dist/adxcgBidAdapter.js +1 -1
  14. package/dist/adyoulikeBidAdapter.js +1 -1
  15. package/dist/agmaAnalyticsAdapter.js +1 -1
  16. package/dist/ajaBidAdapter.js +1 -1
  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/bidglassBidAdapter.js +1 -1
  24. package/dist/big-richmediaBidAdapter.js +1 -1
  25. package/dist/bridBidAdapter.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/chunk-core.js +1 -1
  31. package/dist/chunk-paapi.js +1 -1
  32. package/dist/concertBidAdapter.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/dailymotionBidAdapter.js +1 -1
  41. package/dist/dspxBidAdapter.js +1 -1
  42. package/dist/dxkultureBidAdapter.js +1 -1
  43. package/dist/eplanningBidAdapter.js +1 -1
  44. package/dist/euidIdSystem.js +1 -1
  45. package/dist/exadsBidAdapter.js +1 -1
  46. package/dist/feedadBidAdapter.js +1 -1
  47. package/dist/finativeBidAdapter.js +1 -1
  48. package/dist/fledgeForGpt.js +1 -1
  49. package/dist/freewheel-sspBidAdapter.js +1 -1
  50. package/dist/gmosspBidAdapter.js +1 -1
  51. package/dist/goldbachBidAdapter.js +1 -1
  52. package/dist/greenbidsAnalyticsAdapter.js +1 -1
  53. package/dist/greenbidsRtdProvider.js +1 -1
  54. package/dist/gridBidAdapter.js +1 -1
  55. package/dist/gumgumBidAdapter.js +1 -1
  56. package/dist/h12mediaBidAdapter.js +1 -1
  57. package/dist/hypelabBidAdapter.js +1 -1
  58. package/dist/id5IdSystem.js +1 -1
  59. package/dist/illuminBidAdapter.js +1 -1
  60. package/dist/imdsBidAdapter.js +1 -1
  61. package/dist/improvedigitalBidAdapter.js +1 -1
  62. package/dist/insticatorBidAdapter.js +1 -1
  63. package/dist/ixBidAdapter.js +1 -1
  64. package/dist/jixieBidAdapter.js +1 -1
  65. package/dist/justpremiumBidAdapter.js +1 -1
  66. package/dist/kargoBidAdapter.js +1 -1
  67. package/dist/kimberliteBidAdapter.js +1 -1
  68. package/dist/konduitAnalyticsAdapter.js +1 -1
  69. package/dist/kueezBidAdapter.js +1 -1
  70. package/dist/kueezRtbBidAdapter.js +1 -1
  71. package/dist/lassoBidAdapter.js +1 -1
  72. package/dist/lifestreetBidAdapter.js +1 -1
  73. package/dist/liveIntentIdSystem.js +1 -1
  74. package/dist/logicadBidAdapter.js +1 -1
  75. package/dist/loglyliftBidAdapter.js +1 -1
  76. package/dist/luceadBidAdapter.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/mediasquareBidAdapter.js +1 -1
  82. package/dist/mgidBidAdapter.js +1 -1
  83. package/dist/minutemediaBidAdapter.js +1 -1
  84. package/dist/minutemediaplusBidAdapter.js +1 -1
  85. package/dist/missenaBidAdapter.js +1 -1
  86. package/dist/nexx360BidAdapter.js +1 -1
  87. package/dist/nobidAnalyticsAdapter.js +1 -1
  88. package/dist/nobidBidAdapter.js +1 -1
  89. package/dist/not-for-prod/prebid.js +152 -152
  90. package/dist/oguryBidAdapter.js +1 -1
  91. package/dist/onetagBidAdapter.js +1 -1
  92. package/dist/ooloAnalyticsAdapter.js +1 -1
  93. package/dist/openwebBidAdapter.js +1 -1
  94. package/dist/openxBidAdapter.js +1 -1
  95. package/dist/optidigitalBidAdapter.js +1 -1
  96. package/dist/outbrainBidAdapter.js +1 -1
  97. package/dist/parrableIdSystem.js +1 -1
  98. package/dist/pixfutureBidAdapter.js +1 -1
  99. package/dist/prebidServerBidAdapter.js +1 -1
  100. package/dist/publinkIdSystem.js +1 -1
  101. package/dist/publirBidAdapter.js +1 -1
  102. package/dist/pubmaticBidAdapter.js +1 -1
  103. package/dist/pubwiseAnalyticsAdapter.js +1 -1
  104. package/dist/pxyzBidAdapter.js +1 -1
  105. package/dist/quantcastBidAdapter.js +1 -1
  106. package/dist/readpeakBidAdapter.js +1 -1
  107. package/dist/relaidoBidAdapter.js +1 -1
  108. package/dist/retailspotBidAdapter.js +1 -1
  109. package/dist/rhythmoneBidAdapter.js +1 -1
  110. package/dist/riseBidAdapter.js +1 -1
  111. package/dist/rubiconBidAdapter.js +1 -1
  112. package/dist/seedingAllianceBidAdapter.js +1 -1
  113. package/dist/seedtagBidAdapter.js +1 -1
  114. package/dist/sharethroughAnalyticsAdapter.js +1 -1
  115. package/dist/sharethroughBidAdapter.js +1 -1
  116. package/dist/shinezBidAdapter.js +1 -1
  117. package/dist/shinezRtbBidAdapter.js +1 -1
  118. package/dist/smaatoBidAdapter.js +1 -1
  119. package/dist/smartadserverBidAdapter.js +1 -1
  120. package/dist/smartxBidAdapter.js +1 -1
  121. package/dist/smilewantedBidAdapter.js +1 -1
  122. package/dist/sonobiBidAdapter.js +1 -1
  123. package/dist/sovrnAnalyticsAdapter.js +1 -1
  124. package/dist/sovrnBidAdapter.js +1 -1
  125. package/dist/sspBCBidAdapter.js +1 -1
  126. package/dist/stnBidAdapter.js +1 -1
  127. package/dist/stvBidAdapter.js +1 -1
  128. package/dist/sublimeBidAdapter.js +1 -1
  129. package/dist/taboolaBidAdapter.js +1 -1
  130. package/dist/tagorasBidAdapter.js +1 -1
  131. package/dist/targetVideoBidAdapter.js +1 -1
  132. package/dist/teadsBidAdapter.js +1 -1
  133. package/dist/themoneytizerBidAdapter.js +1 -1
  134. package/dist/trionBidAdapter.js +1 -1
  135. package/dist/tripleliftBidAdapter.js +1 -1
  136. package/dist/ttdBidAdapter.js +1 -1
  137. package/dist/twistDigitalBidAdapter.js +1 -1
  138. package/dist/ucfunnelAnalyticsAdapter.js +1 -1
  139. package/dist/uid2IdSystem.js +1 -1
  140. package/dist/underdogmediaBidAdapter.js +1 -1
  141. package/dist/undertoneBidAdapter.js +1 -1
  142. package/dist/unrulyBidAdapter.js +1 -1
  143. package/dist/vidazooBidAdapter.js +1 -1
  144. package/dist/videobyteBidAdapter.js +1 -1
  145. package/dist/visxBidAdapter.js +1 -1
  146. package/dist/vuukleBidAdapter.js +1 -1
  147. package/dist/widespaceBidAdapter.js +1 -1
  148. package/dist/winrBidAdapter.js +1 -1
  149. package/dist/yahoosspBidAdapter.js +1 -1
  150. package/dist/yieldmoBidAdapter.js +1 -1
  151. package/dist/yieldoneAnalyticsAdapter.js +1 -1
  152. package/modules/fledgeForGpt.js +18 -14
  153. package/modules/paapi.js +2 -1
  154. package/modules/prebidServerBidAdapter/index.js +1 -1
  155. package/package.json +1 -1
  156. package/src/secureCreatives.js +1 -1
  157. package/src/targeting.js +33 -27
  158. package/test/spec/modules/fledgeForGpt_spec.js +93 -72
  159. package/test/spec/unit/core/targeting_spec.js +70 -0
@@ -4,7 +4,6 @@ import {
4
4
  setPAAPIConfigFactory,
5
5
  slotConfigurator
6
6
  } from 'modules/fledgeForGpt.js';
7
- import * as gptUtils from '../../../libraries/gptUtils/gptUtils.js';
8
7
  import 'modules/appnexusBidAdapter.js';
9
8
  import 'modules/rubiconBidAdapter.js';
10
9
  import {deepSetValue} from '../../../src/utils.js';
@@ -25,81 +24,94 @@ describe('fledgeForGpt module', () => {
25
24
  });
26
25
 
27
26
  describe('slotConfigurator', () => {
28
- let mockGptSlot, setGptConfig;
29
- beforeEach(() => {
30
- mockGptSlot = {
27
+ let setGptConfig;
28
+ function mockGptSlot(auPath) {
29
+ return {
31
30
  setConfig: sinon.stub(),
32
- getAdUnitPath: () => 'mock/gpt/au'
33
- };
34
- sandbox.stub(gptUtils, 'getGptSlotForAdUnitCode').callsFake(() => mockGptSlot);
31
+ getAdUnitPath: () => auPath
32
+ }
33
+ }
34
+ beforeEach(() => {
35
35
  setGptConfig = slotConfigurator();
36
36
  });
37
- it('should set GPT slot config', () => {
38
- setGptConfig('au', [fledgeAuctionConfig]);
39
- sinon.assert.calledWith(gptUtils.getGptSlotForAdUnitCode, 'au');
40
- sinon.assert.calledWith(mockGptSlot.setConfig, {
41
- componentAuction: [{
42
- configKey: 'bidder',
43
- auctionConfig: fledgeAuctionConfig,
44
- }]
45
- });
46
- });
47
37
 
48
- describe('when reset = true', () => {
49
- it('should reset GPT slot config', () => {
50
- setGptConfig('au', [fledgeAuctionConfig]);
51
- mockGptSlot.setConfig.resetHistory();
52
- gptUtils.getGptSlotForAdUnitCode.resetHistory();
53
- setGptConfig('au', [], true);
54
- sinon.assert.calledWith(gptUtils.getGptSlotForAdUnitCode, 'au');
55
- sinon.assert.calledWith(mockGptSlot.setConfig, {
56
- componentAuction: [{
57
- configKey: 'bidder',
58
- auctionConfig: null
59
- }]
38
+ Object.entries({
39
+ 'single slot': [mockGptSlot('mock/gpt/au')],
40
+ 'multiple slots': [mockGptSlot('mock/gpt/au'), mockGptSlot('mock/gpt/au2')]
41
+ }).forEach(([t, gptSlots]) => {
42
+ describe(`when ad unit code matches ${t}`, () => {
43
+ it('should set GPT slot config', () => {
44
+ setGptConfig('au', gptSlots, [fledgeAuctionConfig]);
45
+ gptSlots.forEach(slot => {
46
+ sinon.assert.calledWith(slot.setConfig, {
47
+ componentAuction: [{
48
+ configKey: 'bidder',
49
+ auctionConfig: fledgeAuctionConfig,
50
+ }]
51
+ });
52
+ })
60
53
  });
61
- });
54
+ describe('when reset = true', () => {
55
+ it('should reset GPT slot config', () => {
56
+ setGptConfig('au', gptSlots, [fledgeAuctionConfig]);
57
+ gptSlots.forEach(slot => slot.setConfig.resetHistory());
58
+ setGptConfig('au', gptSlots, [], true);
59
+ gptSlots.forEach(slot => {
60
+ sinon.assert.calledWith(slot.setConfig, {
61
+ componentAuction: [{
62
+ configKey: 'bidder',
63
+ auctionConfig: null
64
+ }]
65
+ });
66
+ })
67
+ });
62
68
 
63
- it('should reset only sellers with no fresh config', () => {
64
- setGptConfig('au', [{seller: 's1'}, {seller: 's2'}]);
65
- mockGptSlot.setConfig.resetHistory();
66
- setGptConfig('au', [{seller: 's1'}], true);
67
- sinon.assert.calledWith(mockGptSlot.setConfig, {
68
- componentAuction: [{
69
- configKey: 's1',
70
- auctionConfig: {seller: 's1'}
71
- }, {
72
- configKey: 's2',
73
- auctionConfig: null
74
- }]
75
- })
76
- });
69
+ it('should reset only sellers with no fresh config', () => {
70
+ setGptConfig('au', gptSlots, [{seller: 's1'}, {seller: 's2'}]);
71
+ gptSlots.forEach(slot => slot.setConfig.resetHistory());
72
+ setGptConfig('au', gptSlots, [{seller: 's1'}], true);
73
+ gptSlots.forEach(slot => {
74
+ sinon.assert.calledWith(slot.setConfig, {
75
+ componentAuction: [{
76
+ configKey: 's1',
77
+ auctionConfig: {seller: 's1'}
78
+ }, {
79
+ configKey: 's2',
80
+ auctionConfig: null
81
+ }]
82
+ })
83
+ })
84
+ });
77
85
 
78
- it('should not reset sellers that were already reset', () => {
79
- setGptConfig('au', [{seller: 's1'}]);
80
- setGptConfig('au', [], true);
81
- mockGptSlot.setConfig.resetHistory();
82
- setGptConfig('au', [], true);
83
- sinon.assert.notCalled(mockGptSlot.setConfig);
84
- })
86
+ it('should not reset sellers that were already reset', () => {
87
+ setGptConfig('au', gptSlots, [{seller: 's1'}]);
88
+ setGptConfig('au', gptSlots, [], true);
89
+ gptSlots.forEach(slot => slot.setConfig.resetHistory());
90
+ setGptConfig('au', gptSlots, [], true);
91
+ gptSlots.forEach(slot => sinon.assert.notCalled(slot.setConfig));
92
+ })
85
93
 
86
- it('should keep track of configuration history by slot', () => {
87
- setGptConfig('au1', [{seller: 's1'}]);
88
- setGptConfig('au1', [{seller: 's2'}], false);
89
- setGptConfig('au2', [{seller: 's3'}]);
90
- mockGptSlot.setConfig.resetHistory();
91
- setGptConfig('au1', [], true);
92
- sinon.assert.calledWith(mockGptSlot.setConfig, {
93
- componentAuction: [{
94
- configKey: 's1',
95
- auctionConfig: null
96
- }, {
97
- configKey: 's2',
98
- auctionConfig: null
99
- }]
94
+ it('should keep track of configuration history by ad unit', () => {
95
+ setGptConfig('au1', gptSlots, [{seller: 's1'}]);
96
+ setGptConfig('au1', gptSlots, [{seller: 's2'}], false);
97
+ setGptConfig('au2', gptSlots, [{seller: 's3'}]);
98
+ gptSlots.forEach(slot => slot.setConfig.resetHistory());
99
+ setGptConfig('au1', gptSlots, [], true);
100
+ gptSlots.forEach(slot => {
101
+ sinon.assert.calledWith(slot.setConfig, {
102
+ componentAuction: [{
103
+ configKey: 's1',
104
+ auctionConfig: null
105
+ }, {
106
+ configKey: 's2',
107
+ auctionConfig: null
108
+ }]
109
+ });
110
+ })
111
+ })
100
112
  });
101
113
  })
102
- });
114
+ })
103
115
  });
104
116
  describe('onAuctionConfig', () => {
105
117
  [
@@ -124,12 +136,14 @@ describe('fledgeForGpt module', () => {
124
136
 
125
137
  it(`should ${shouldSetConfig ? '' : 'NOT'} set GPT slot configuration`, () => {
126
138
  const auctionConfig = {componentAuctions: [{seller: 'mock1'}, {seller: 'mock2'}]};
139
+ const mockSlot = {};
140
+ const getSlot = sinon.stub().returns({});
127
141
  const setGptConfig = sinon.stub();
128
142
  const markAsUsed = sinon.stub();
129
- onAuctionConfigFactory(setGptConfig)('aid', {au1: auctionConfig, au2: null}, markAsUsed);
143
+ onAuctionConfigFactory(setGptConfig, getSlot)('aid', {au1: auctionConfig, au2: null}, markAsUsed);
130
144
  if (shouldSetConfig) {
131
- sinon.assert.calledWith(setGptConfig, 'au1', auctionConfig.componentAuctions);
132
- sinon.assert.calledWith(setGptConfig, 'au2', []);
145
+ sinon.assert.calledWith(setGptConfig, 'au1', [mockSlot], auctionConfig.componentAuctions);
146
+ sinon.assert.calledWith(setGptConfig, 'au2', [mockSlot], []);
133
147
  sinon.assert.calledWith(markAsUsed, 'au1');
134
148
  } else {
135
149
  sinon.assert.notCalled(setGptConfig);
@@ -142,11 +156,12 @@ describe('fledgeForGpt module', () => {
142
156
  })
143
157
  });
144
158
  describe('setPAAPIConfigForGpt', () => {
145
- let getPAAPIConfig, setGptConfig, setPAAPIConfigForGPT;
159
+ let getPAAPIConfig, setGptConfig, getSlots, setPAAPIConfigForGPT;
146
160
  beforeEach(() => {
147
161
  getPAAPIConfig = sinon.stub();
148
162
  setGptConfig = sinon.stub();
149
- setPAAPIConfigForGPT = setPAAPIConfigFactory(getPAAPIConfig, setGptConfig);
163
+ getSlots = sinon.stub().callsFake((codes) => Object.fromEntries(codes.map(code => [code, ['mock-slot']])))
164
+ setPAAPIConfigForGPT = setPAAPIConfigFactory(getPAAPIConfig, setGptConfig, getSlots);
150
165
  });
151
166
 
152
167
  Object.entries({
@@ -161,6 +176,12 @@ describe('fledgeForGpt module', () => {
161
176
  })
162
177
  });
163
178
 
179
+ it('passes customSlotMatching to getSlots', () => {
180
+ getPAAPIConfig.returns({au1: {}});
181
+ setPAAPIConfigForGPT('mock-filters', 'mock-custom-matching');
182
+ sinon.assert.calledWith(getSlots, ['au1'], 'mock-custom-matching');
183
+ })
184
+
164
185
  it('sets GPT slot config for each ad unit that has PAAPI config, and resets the rest', () => {
165
186
  const cfg = {
166
187
  au1: {
@@ -175,7 +196,7 @@ describe('fledgeForGpt module', () => {
175
196
  setPAAPIConfigForGPT('mock-filters');
176
197
  sinon.assert.calledWith(getPAAPIConfig, 'mock-filters');
177
198
  Object.entries(cfg).forEach(([au, config]) => {
178
- sinon.assert.calledWith(setGptConfig, au, config?.componentAuctions ?? [], true);
199
+ sinon.assert.calledWith(setGptConfig, au, ['mock-slot'], config?.componentAuctions ?? [], true);
179
200
  })
180
201
  });
181
202
  });
@@ -1,5 +1,6 @@
1
1
  import {expect} from 'chai';
2
2
  import {
3
+ getGPTSlotsForAdUnits,
3
4
  filters,
4
5
  getHighestCpmBidsFromBidPool,
5
6
  sortByDealAndPriceBucketOrCpm,
@@ -1310,6 +1311,17 @@ describe('targeting tests', function () {
1310
1311
  describe('setTargetingForAst', function () {
1311
1312
  let sandbox,
1312
1313
  apnTagStub;
1314
+
1315
+ before(() => {
1316
+ if (window.apntag?.setKeywords == null) {
1317
+ const orig = window.apntag;
1318
+ window.apntag = {setKeywords: () => {}}
1319
+ after(() => {
1320
+ window.apntag = orig;
1321
+ })
1322
+ }
1323
+ });
1324
+
1313
1325
  beforeEach(function() {
1314
1326
  sandbox = sinon.createSandbox();
1315
1327
  sandbox.stub(targetingInstance, 'resetPresetTargetingAST');
@@ -1346,4 +1358,62 @@ describe('targeting tests', function () {
1346
1358
  expect(apnTagStub.getCall(1).args[1]).to.deep.equal({HB_BIDDER: 'appnexus'});
1347
1359
  });
1348
1360
  });
1361
+
1362
+ describe('getGPTSlotsForAdUnits', () => {
1363
+ function mockSlot(path, elId) {
1364
+ return {
1365
+ getAdUnitPath() {
1366
+ return path;
1367
+ },
1368
+ getSlotElementId() {
1369
+ return elId;
1370
+ }
1371
+ }
1372
+ }
1373
+
1374
+ let slots;
1375
+
1376
+ beforeEach(() => {
1377
+ slots = [
1378
+ mockSlot('slot/1', 'div-1'),
1379
+ mockSlot('slot/2', 'div-2'),
1380
+ ]
1381
+ });
1382
+
1383
+ Object.entries({
1384
+ 'ad unit path': ['slot/1', 'slot/2'],
1385
+ 'element id': ['div-1', 'div-2']
1386
+ }).forEach(([t, adUnitCodes]) => {
1387
+ it(`can find slots by ${t}`, () => {
1388
+ expect(getGPTSlotsForAdUnits(adUnitCodes, null, () => slots)).to.eql(Object.fromEntries(adUnitCodes.map((au, i) => [au, [slots[i]]])));
1389
+ })
1390
+ });
1391
+
1392
+ it('returns empty list on no match', () => {
1393
+ expect(getGPTSlotsForAdUnits(['missing', 'slot/2'], null, () => slots)).to.eql({
1394
+ missing: [],
1395
+ 'slot/2': [slots[1]]
1396
+ });
1397
+ });
1398
+
1399
+ it('can use customSlotMatching', () => {
1400
+ const csm = (slot) => {
1401
+ if (slot.getAdUnitPath() === 'slot/1') {
1402
+ return (au) => {
1403
+ return au === 'custom'
1404
+ }
1405
+ }
1406
+ }
1407
+ expect(getGPTSlotsForAdUnits(['div-2', 'custom'], csm, () => slots)).to.eql({
1408
+ 'custom': [slots[0]],
1409
+ 'div-2': [slots[1]]
1410
+ })
1411
+ });
1412
+
1413
+ it('can handle repeated adUnitCodes', () => {
1414
+ expect(getGPTSlotsForAdUnits(['div-1', 'div-1'], null, () => slots)).to.eql({
1415
+ 'div-1': [slots[0]]
1416
+ })
1417
+ })
1418
+ })
1349
1419
  });