prebid.js 5.18.0 → 6.1.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 (150) hide show
  1. package/.babelrc.js +1 -10
  2. package/README.md +3 -1
  3. package/browsers.json +1 -8
  4. package/gulpfile.js +1 -0
  5. package/integrationExamples/gpt/akamaidap_segments_example.html +132 -0
  6. package/modules/.submodules.json +1 -0
  7. package/modules/adfBidAdapter.js +21 -16
  8. package/modules/adheseBidAdapter.js +7 -2
  9. package/modules/adkernelBidAdapter.js +1 -0
  10. package/modules/adlivetechBidAdapter.md +61 -0
  11. package/modules/adomikAnalyticsAdapter.js +10 -4
  12. package/modules/adtelligentBidAdapter.js +2 -1
  13. package/modules/airgridRtdProvider.js +1 -1
  14. package/modules/akamaiDapRtdProvider.js +474 -0
  15. package/modules/akamaiDapRtdProvider.md +47 -0
  16. package/modules/appnexusBidAdapter.js +9 -3
  17. package/modules/atsAnalyticsAdapter.js +67 -46
  18. package/modules/atsAnalyticsAdapter.md +1 -0
  19. package/modules/betweenBidAdapter.js +20 -3
  20. package/modules/browsiRtdProvider.js +106 -18
  21. package/modules/cleanioRtdProvider.js +192 -0
  22. package/modules/cleanioRtdProvider.md +59 -0
  23. package/modules/codefuelBidAdapter.js +181 -0
  24. package/modules/codefuelBidAdapter.md +111 -0
  25. package/modules/connectIdSystem.js +104 -0
  26. package/modules/connectIdSystem.md +33 -0
  27. package/modules/datablocksBidAdapter.js +3 -3
  28. package/modules/deepintentBidAdapter.js +107 -10
  29. package/modules/deepintentBidAdapter.md +36 -1
  30. package/modules/deltaprojectsBidAdapter.js +252 -0
  31. package/modules/deltaprojectsBidAdapter.md +32 -0
  32. package/modules/engageyaBidAdapter.js +171 -0
  33. package/modules/glimpseBidAdapter.js +31 -16
  34. package/modules/gptPreAuction.js +11 -5
  35. package/modules/gridBidAdapter.js +1 -0
  36. package/modules/gumgumBidAdapter.js +8 -0
  37. package/modules/id5IdSystem.md +6 -6
  38. package/modules/imRtdProvider.js +31 -0
  39. package/modules/inskinBidAdapter.js +7 -3
  40. package/modules/ixBidAdapter.js +174 -22
  41. package/modules/jixieBidAdapter.js +8 -2
  42. package/modules/justpremiumBidAdapter.js +6 -1
  43. package/modules/limelightDigitalBidAdapter.js +22 -2
  44. package/modules/livewrappedAnalyticsAdapter.js +49 -1
  45. package/modules/merkleIdSystem.js +5 -0
  46. package/modules/multibid/index.js +3 -3
  47. package/modules/nativoBidAdapter.js +32 -2
  48. package/modules/nextMillenniumBidAdapter.js +12 -3
  49. package/modules/oguryBidAdapter.js +16 -2
  50. package/modules/openxBidAdapter.js +40 -23
  51. package/modules/operaadsBidAdapter.js +21 -1
  52. package/modules/otmBidAdapter.js +146 -0
  53. package/modules/otmBidAdapter.md +27 -26
  54. package/modules/outbrainBidAdapter.js +5 -0
  55. package/modules/playwireBidAdapter.md +61 -0
  56. package/modules/prebidServerBidAdapter/index.js +3 -3
  57. package/modules/publinkIdSystem.js +11 -6
  58. package/modules/pubmaticBidAdapter.js +2 -0
  59. package/modules/rtdModule/index.js +2 -2
  60. package/modules/saambaaBidAdapter.js +420 -0
  61. package/modules/saambaaBidAdapter.md +65 -68
  62. package/modules/seedtagBidAdapter.js +6 -0
  63. package/modules/smaatoBidAdapter.js +6 -1
  64. package/modules/sonobiBidAdapter.js +7 -0
  65. package/modules/sortableBidAdapter.js +1 -0
  66. package/modules/sspBCBidAdapter.js +34 -3
  67. package/modules/teadsBidAdapter.js +3 -0
  68. package/modules/tripleliftBidAdapter.js +22 -5
  69. package/modules/trustxBidAdapter.js +18 -7
  70. package/modules/undertoneBidAdapter.js +9 -5
  71. package/modules/undertoneBidAdapter.md +5 -1
  72. package/modules/userId/eids.js +18 -0
  73. package/modules/userId/eids.md +7 -0
  74. package/modules/userId/userId.md +12 -0
  75. package/modules/ventesBidAdapter.js +370 -0
  76. package/modules/ventesBidAdapter.md +94 -0
  77. package/modules/videobyteBidAdapter.js +13 -6
  78. package/modules/videobyteBidAdapter.md +49 -0
  79. package/modules/vidoomyBidAdapter.js +51 -100
  80. package/modules/visxBidAdapter.js +1 -1
  81. package/modules/yahoosspBidAdapter.js +6 -6
  82. package/modules/yieldlabBidAdapter.js +41 -10
  83. package/modules/yieldlabBidAdapter.md +91 -48
  84. package/modules/yieldmoSyntheticInventoryModule.js +46 -0
  85. package/modules/yieldmoSyntheticInventoryModule.md +68 -0
  86. package/package.json +6 -1
  87. package/src/adapterManager.js +19 -8
  88. package/src/adapters/bidderFactory.js +4 -3
  89. package/src/auction.js +11 -11
  90. package/src/constants.json +1 -0
  91. package/src/secureCreatives.js +6 -7
  92. package/src/targeting.js +11 -9
  93. package/test/spec/modules/adfBidAdapter_spec.js +83 -29
  94. package/test/spec/modules/adheseBidAdapter_spec.js +27 -1
  95. package/test/spec/modules/adomikAnalyticsAdapter_spec.js +3 -1
  96. package/test/spec/modules/adtelligentBidAdapter_spec.js +1 -0
  97. package/test/spec/modules/akamaiDapRtdProvider_spec.js +246 -0
  98. package/test/spec/modules/appnexusBidAdapter_spec.js +16 -1
  99. package/test/spec/modules/atsAnalyticsAdapter_spec.js +42 -9
  100. package/test/spec/modules/betweenBidAdapter_spec.js +41 -0
  101. package/test/spec/modules/browsiRtdProvider_spec.js +62 -7
  102. package/test/spec/modules/cleanioRtdProvider_spec.js +188 -0
  103. package/test/spec/modules/codefuelBidAdapter_spec.js +316 -0
  104. package/test/spec/modules/connectIdSystem_spec.js +189 -0
  105. package/test/spec/modules/datablocksBidAdapter_spec.js +3 -3
  106. package/test/spec/modules/deepintentBidAdapter_spec.js +153 -3
  107. package/test/spec/modules/deltaprojectsBidAdapter_spec.js +399 -0
  108. package/test/spec/modules/engageyaBidAdapter_spec.js +422 -0
  109. package/test/spec/modules/eplanningBidAdapter_spec.js +8 -8
  110. package/test/spec/modules/glimpseBidAdapter_spec.js +33 -0
  111. package/test/spec/modules/gptPreAuction_spec.js +58 -4
  112. package/test/spec/modules/gumgumBidAdapter_spec.js +5 -1
  113. package/test/spec/modules/imRtdProvider_spec.js +25 -0
  114. package/test/spec/modules/ixBidAdapter_spec.js +298 -5
  115. package/test/spec/modules/jixieBidAdapter_spec.js +13 -11
  116. package/test/spec/modules/justpremiumBidAdapter_spec.js +9 -2
  117. package/test/spec/modules/konduitWrapper_spec.js +0 -1
  118. package/test/spec/modules/limelightDigitalBidAdapter_spec.js +155 -1
  119. package/test/spec/modules/livewrappedAnalyticsAdapter_spec.js +52 -7
  120. package/test/spec/modules/merkleIdSystem_spec.js +18 -0
  121. package/test/spec/modules/multibid_spec.js +31 -31
  122. package/test/spec/modules/nativoBidAdapter_spec.js +35 -18
  123. package/test/spec/modules/nextMillenniumBidAdapter_spec.js +13 -1
  124. package/test/spec/modules/oguryBidAdapter_spec.js +66 -23
  125. package/test/spec/modules/openxBidAdapter_spec.js +90 -13
  126. package/test/spec/modules/operaadsBidAdapter_spec.js +38 -6
  127. package/test/spec/modules/otmBidAdapter_spec.js +67 -0
  128. package/test/spec/modules/outbrainBidAdapter_spec.js +18 -0
  129. package/test/spec/modules/prebidServerBidAdapter_spec.js +19 -2
  130. package/test/spec/modules/publinkIdSystem_spec.js +6 -6
  131. package/test/spec/modules/seedtagBidAdapter_spec.js +3 -0
  132. package/test/spec/modules/smaatoBidAdapter_spec.js +30 -0
  133. package/test/spec/modules/sonobiBidAdapter_spec.js +34 -1
  134. package/test/spec/modules/sortableBidAdapter_spec.js +11 -0
  135. package/test/spec/modules/sspBCBidAdapter_spec.js +33 -3
  136. package/test/spec/modules/teadsBidAdapter_spec.js +132 -0
  137. package/test/spec/modules/tripleliftBidAdapter_spec.js +128 -0
  138. package/test/spec/modules/trustxBidAdapter_spec.js +45 -3
  139. package/test/spec/modules/undertoneBidAdapter_spec.js +52 -0
  140. package/test/spec/modules/ventesBidAdapter_spec.js +845 -0
  141. package/test/spec/modules/videobyteBidAdapter_spec.js +2 -2
  142. package/test/spec/modules/vidoomyBidAdapter_spec.js +32 -13
  143. package/test/spec/modules/visxBidAdapter_spec.js +1 -1
  144. package/test/spec/modules/yieldlabBidAdapter_spec.js +81 -0
  145. package/test/spec/modules/yieldmoSyntheticInventoryModule_spec.js +89 -0
  146. package/test/spec/unit/core/adapterManager_spec.js +56 -6
  147. package/test/spec/unit/core/bidderFactory_spec.js +61 -1
  148. package/test/spec/unit/pbjs_api_spec.js +37 -2
  149. package/test/spec/unit/secureCreatives_spec.js +54 -25
  150. package/wdio.conf.js +1 -1
@@ -8,29 +8,46 @@ import { spec } from 'modules/nativoBidAdapter.js'
8
8
  describe('nativoBidAdapterTests', function () {
9
9
  describe('isBidRequestValid', function () {
10
10
  let bid = {
11
- bidder: 'nativo',
12
- params: {
13
- placementId: '10433394',
14
- },
15
- adUnitCode: 'adunit-code',
16
- sizes: [
17
- [300, 250],
18
- [300, 600],
19
- ],
20
- bidId: '27b02036ccfa6e',
21
- bidderRequestId: '1372cd8bd8d6a8',
22
- auctionId: 'cfc467e4-2707-48da-becb-bcaab0b2c114',
11
+ bidder: 'nativo'
23
12
  }
24
13
 
25
- it('should return true when required params found', function () {
14
+ it('should return true if no params found', function () {
15
+ expect(spec.isBidRequestValid(bid)).to.equal(true)
16
+ })
17
+
18
+ it('should return true for valid placementId value', function () {
19
+ bid.params = {
20
+ placementId: '10433394',
21
+ }
22
+ expect(spec.isBidRequestValid(bid)).to.equal(true)
23
+ })
24
+
25
+ it('should return true for valid placementId value', function () {
26
+ bid.params = {
27
+ placementId: 10433394,
28
+ }
29
+ expect(spec.isBidRequestValid(bid)).to.equal(true)
30
+ })
31
+
32
+ it('should return false for invalid placementId value', function () {
33
+ bid.params = {
34
+ placementId: true,
35
+ }
36
+ expect(spec.isBidRequestValid(bid)).to.equal(false)
37
+ })
38
+
39
+ it('should return true for valid placementId value', function () {
40
+ bid.params = {
41
+ url: 'www.test.com',
42
+ }
26
43
  expect(spec.isBidRequestValid(bid)).to.equal(true)
27
44
  })
28
45
 
29
- it('should return true when params are not passed', function () {
30
- let bid2 = Object.assign({}, bid)
31
- delete bid2.params
32
- bid2.params = {}
33
- expect(spec.isBidRequestValid(bid2)).to.equal(true)
46
+ it('should return false for invalid placementId value', function () {
47
+ bid.params = {
48
+ url: 4567890,
49
+ }
50
+ expect(spec.isBidRequestValid(bid)).to.equal(false)
34
51
  })
35
52
  })
36
53
 
@@ -8,10 +8,22 @@ describe('nextMillenniumBidAdapterTests', function() {
8
8
  auctionId: 'b06c5141-fe8f-4cdf-9d7d-54415490a917',
9
9
  bidder: 'nextMillennium',
10
10
  params: { placement_id: '-1' },
11
- sizes: [[300, 250]]
11
+ sizes: [[300, 250]],
12
+ uspConsent: '1---',
13
+ gdprConsent: {
14
+ consentString: 'kjfdniwjnifwenrif3',
15
+ gdprApplies: true
16
+ }
12
17
  }
13
18
  ];
14
19
 
20
+ it('Request params check with GDPR Consent', function () {
21
+ const request = spec.buildRequests(bidRequestData, bidRequestData[0]);
22
+ expect(JSON.parse(request[0].data).user.ext.consent).to.equal('kjfdniwjnifwenrif3');
23
+ expect(JSON.parse(request[0].data).regs.ext.us_privacy).to.equal('1---');
24
+ expect(JSON.parse(request[0].data).regs.ext.gdpr).to.equal(1);
25
+ });
26
+
15
27
  it('validate_generated_params', function() {
16
28
  const request = spec.buildRequests(bidRequestData);
17
29
  expect(request[0].bidId).to.equal('bid1234');
@@ -1,6 +1,6 @@
1
1
  import { expect } from 'chai';
2
2
  import { spec } from 'modules/oguryBidAdapter';
3
- import { deepClone } from 'src/utils.js';
3
+ import * as utils from 'src/utils.js';
4
4
 
5
5
  const BID_URL = 'https://mweb-hb.presage.io/api/header-bidding-request';
6
6
  const TIMEOUT_URL = 'https://ms-ads-monitoring-events.presage.io/bid_timeout'
@@ -68,14 +68,14 @@ describe('OguryBidAdapter', function () {
68
68
 
69
69
  describe('isBidRequestValid', function () {
70
70
  it('should validate correct bid', () => {
71
- let validBid = deepClone(bidRequests[0]);
71
+ let validBid = utils.deepClone(bidRequests[0]);
72
72
 
73
73
  let isValid = spec.isBidRequestValid(validBid);
74
74
  expect(isValid).to.equal(true);
75
75
  });
76
76
 
77
77
  it('should not validate incorrect bid', () => {
78
- let invalidBid = deepClone(bidRequests[0]);
78
+ let invalidBid = utils.deepClone(bidRequests[0]);
79
79
  delete invalidBid.sizes;
80
80
  delete invalidBid.mediaTypes;
81
81
 
@@ -84,7 +84,7 @@ describe('OguryBidAdapter', function () {
84
84
  });
85
85
 
86
86
  it('should not validate bid if adunit is not present', () => {
87
- let invalidBid = deepClone(bidRequests[0]);
87
+ let invalidBid = utils.deepClone(bidRequests[0]);
88
88
  delete invalidBid.params.adUnitId;
89
89
 
90
90
  let isValid = spec.isBidRequestValid(invalidBid);
@@ -92,7 +92,7 @@ describe('OguryBidAdapter', function () {
92
92
  });
93
93
 
94
94
  it('should not validate bid if assetKet is not present', () => {
95
- let invalidBid = deepClone(bidRequests[0]);
95
+ let invalidBid = utils.deepClone(bidRequests[0]);
96
96
  delete invalidBid.params.assetKey;
97
97
 
98
98
  let isValid = spec.isBidRequestValid(invalidBid);
@@ -100,7 +100,7 @@ describe('OguryBidAdapter', function () {
100
100
  });
101
101
 
102
102
  it('should validate bid if getFloor is not present', () => {
103
- let invalidBid = deepClone(bidRequests[1]);
103
+ let invalidBid = utils.deepClone(bidRequests[1]);
104
104
  delete invalidBid.getFloor;
105
105
 
106
106
  let isValid = spec.isBidRequestValid(invalidBid);
@@ -119,7 +119,7 @@ describe('OguryBidAdapter', function () {
119
119
  };
120
120
  });
121
121
 
122
- it('should return sync array with two elements of type image', () => {
122
+ it('should return syncs array with two elements of type image', () => {
123
123
  const userSyncs = spec.getUserSyncs(syncOptions, [], gdprConsent);
124
124
 
125
125
  expect(userSyncs).to.have.lengthOf(2);
@@ -129,7 +129,7 @@ describe('OguryBidAdapter', function () {
129
129
  expect(userSyncs[1].url).to.contain('https://ms-cookie-sync.presage.io/ttd/init-sync');
130
130
  });
131
131
 
132
- it('should set the same source as query param', () => {
132
+ it('should set the source as query param', () => {
133
133
  const userSyncs = spec.getUserSyncs(syncOptions, [], gdprConsent);
134
134
  expect(userSyncs[0].url).to.contain('source=prebid');
135
135
  expect(userSyncs[1].url).to.contain('source=prebid');
@@ -146,7 +146,7 @@ describe('OguryBidAdapter', function () {
146
146
  expect(spec.getUserSyncs(syncOptions, [], gdprConsent)).to.have.lengthOf(0);
147
147
  });
148
148
 
149
- it('should return sync array with two elements of type image when consentString is undefined', () => {
149
+ it('should return syncs array with two elements of type image when consentString is undefined', () => {
150
150
  gdprConsent = {
151
151
  gdprApplies: true,
152
152
  consentString: undefined
@@ -160,7 +160,7 @@ describe('OguryBidAdapter', function () {
160
160
  expect(userSyncs[1].url).to.equal('https://ms-cookie-sync.presage.io/ttd/init-sync?iab_string=&source=prebid')
161
161
  });
162
162
 
163
- it('should return sync array with two elements of type image when consentString is null', () => {
163
+ it('should return syncs array with two elements of type image when consentString is null', () => {
164
164
  gdprConsent = {
165
165
  gdprApplies: true,
166
166
  consentString: null
@@ -174,7 +174,7 @@ describe('OguryBidAdapter', function () {
174
174
  expect(userSyncs[1].url).to.equal('https://ms-cookie-sync.presage.io/ttd/init-sync?iab_string=&source=prebid')
175
175
  });
176
176
 
177
- it('should return sync array with two elements of type image when gdprConsent is undefined', () => {
177
+ it('should return syncs array with two elements of type image when gdprConsent is undefined', () => {
178
178
  gdprConsent = undefined;
179
179
 
180
180
  const userSyncs = spec.getUserSyncs(syncOptions, [], gdprConsent);
@@ -185,7 +185,7 @@ describe('OguryBidAdapter', function () {
185
185
  expect(userSyncs[1].url).to.equal('https://ms-cookie-sync.presage.io/ttd/init-sync?iab_string=&source=prebid')
186
186
  });
187
187
 
188
- it('should return sync array with two elements of type image when gdprConsent is null', () => {
188
+ it('should return syncs array with two elements of type image when gdprConsent is null', () => {
189
189
  gdprConsent = null;
190
190
 
191
191
  const userSyncs = spec.getUserSyncs(syncOptions, [], gdprConsent);
@@ -196,7 +196,7 @@ describe('OguryBidAdapter', function () {
196
196
  expect(userSyncs[1].url).to.equal('https://ms-cookie-sync.presage.io/ttd/init-sync?iab_string=&source=prebid')
197
197
  });
198
198
 
199
- it('should return sync array with two elements of type image when gdprConsent is null and gdprApplies is false', () => {
199
+ it('should return syncs array with two elements of type image when gdprConsent is null and gdprApplies is false', () => {
200
200
  gdprConsent = {
201
201
  gdprApplies: false,
202
202
  consentString: null
@@ -210,7 +210,7 @@ describe('OguryBidAdapter', function () {
210
210
  expect(userSyncs[1].url).to.equal('https://ms-cookie-sync.presage.io/ttd/init-sync?iab_string=&source=prebid')
211
211
  });
212
212
 
213
- it('should return sync array with two elements of type image when gdprConsent is empty string and gdprApplies is false', () => {
213
+ it('should return syncs array with two elements of type image when gdprConsent is empty string and gdprApplies is false', () => {
214
214
  gdprConsent = {
215
215
  gdprApplies: false,
216
216
  consentString: ''
@@ -240,7 +240,8 @@ describe('OguryBidAdapter', function () {
240
240
  w: 300,
241
241
  h: 250
242
242
  }]
243
- }
243
+ },
244
+ ext: bidRequests[0].params
244
245
  }, {
245
246
  id: bidRequests[1].bidId,
246
247
  tagid: bidRequests[1].params.adUnitId,
@@ -250,7 +251,8 @@ describe('OguryBidAdapter', function () {
250
251
  w: 600,
251
252
  h: 500
252
253
  }]
253
- }
254
+ },
255
+ ext: bidRequests[1].params
254
256
  }],
255
257
  regs: {
256
258
  ext: {
@@ -270,7 +272,7 @@ describe('OguryBidAdapter', function () {
270
272
  };
271
273
 
272
274
  it('sends bid request to ENDPOINT via POST', function () {
273
- const validBidRequests = deepClone(bidRequests)
275
+ const validBidRequests = utils.deepClone(bidRequests)
274
276
 
275
277
  const request = spec.buildRequests(validBidRequests, bidderRequest);
276
278
  expect(request.url).to.equal(BID_URL);
@@ -278,7 +280,7 @@ describe('OguryBidAdapter', function () {
278
280
  });
279
281
 
280
282
  it('bid request object should be conform', function () {
281
- const validBidRequests = deepClone(bidRequests)
283
+ const validBidRequests = utils.deepClone(bidRequests)
282
284
 
283
285
  const request = spec.buildRequests(validBidRequests, bidderRequest);
284
286
  expect(request.data).to.deep.equal(expectedRequestObject);
@@ -316,7 +318,7 @@ describe('OguryBidAdapter', function () {
316
318
  ...expectedRequestObject
317
319
  };
318
320
 
319
- const validBidRequests = deepClone(bidRequests);
321
+ const validBidRequests = utils.deepClone(bidRequests);
320
322
  validBidRequests[1] = {
321
323
  ...validBidRequests[1],
322
324
  getFloor: undefined
@@ -331,7 +333,7 @@ describe('OguryBidAdapter', function () {
331
333
  ...expectedRequestObject
332
334
  };
333
335
 
334
- let validBidRequests = deepClone(bidRequests);
336
+ let validBidRequests = utils.deepClone(bidRequests);
335
337
  validBidRequests[1] = {
336
338
  ...validBidRequests[1],
337
339
  getFloor: 'getFloor'
@@ -342,9 +344,9 @@ describe('OguryBidAdapter', function () {
342
344
  });
343
345
 
344
346
  it('should handle bidFloor when currency is not USD', () => {
345
- const expectedRequestWithUnsupportedFloorCurrency = deepClone(expectedRequestObject)
347
+ const expectedRequestWithUnsupportedFloorCurrency = utils.deepClone(expectedRequestObject)
346
348
  expectedRequestWithUnsupportedFloorCurrency.imp[0].bidfloor = 0;
347
- let validBidRequests = deepClone(bidRequests);
349
+ let validBidRequests = utils.deepClone(bidRequests);
348
350
  validBidRequests[0] = {
349
351
  ...validBidRequests[0],
350
352
  getFloor: ({ size, currency, mediaType }) => {
@@ -490,6 +492,47 @@ describe('OguryBidAdapter', function () {
490
492
  expect(requests[0].url).to.equal(nurl);
491
493
  expect(requests[0].method).to.equal('GET')
492
494
  })
495
+
496
+ it('Should trigger getWindowContext method', function() {
497
+ const bidSample = {
498
+ id: 'advertId',
499
+ impid: 'bidId',
500
+ price: 100,
501
+ nurl: 'url',
502
+ adm: `<html><head><title>test creative</title></head><body style="margin: 0;"><div><img style="width: 300px; height: 250px;" src="https://assets.afcdn.com/recipe/20190529/93153_w1024h768c1cx2220cy1728cxt0cyt0cxb4441cyb3456.jpg" alt="cookies" /></div></body></html>`,
503
+ adomain: ['renault.fr'],
504
+ ext: {
505
+ adcontent: 'sample_creative',
506
+ advertid: '1a278c48-b79a-4bbf-b69f-3824803e7d87',
507
+ campaignid: '31724',
508
+ mediatype: 'image',
509
+ userid: 'ab4aabed-5230-49d9-9f1a-f06280d28366',
510
+ usersync: true,
511
+ advertiserid: '1',
512
+ isomidcompliant: false
513
+ },
514
+ w: 180,
515
+ h: 101
516
+ }
517
+ spec.onBidWon(bidSample)
518
+ expect(window.top.OG_PREBID_BID_OBJECT).to.deep.equal(bidSample)
519
+ })
520
+ })
521
+
522
+ describe('getWindowContext', function() {
523
+ it('Should return top window if exist', function() {
524
+ const res = spec.getWindowContext()
525
+ expect(res).to.equal(window.top)
526
+ expect(res).to.not.be.undefined;
527
+ })
528
+
529
+ it('Should return self window if getting top window throw an error', function() {
530
+ const stub = sinon.stub(utils, 'getWindowTop')
531
+ stub.throws()
532
+ const res = spec.getWindowContext()
533
+ expect(res).to.equal(window.self)
534
+ utils.getWindowTop.restore()
535
+ })
493
536
  })
494
537
 
495
538
  describe('onTimeout', function () {
@@ -508,7 +551,7 @@ describe('OguryBidAdapter', function () {
508
551
  xhr.restore()
509
552
  })
510
553
 
511
- it('should send notification on bid timeout', function() {
554
+ it('should send on bid timeout notification', function() {
512
555
  const bid = {
513
556
  ad: '<img style="width: 300px; height: 250px;" src="https://assets.afcdn.com/recipe/20190529/93153_w1024h768c1cx2220cy1728cxt0cyt0cxb4441cyb3456.jpg" alt="cookies" />',
514
557
  cpm: 3
@@ -1085,7 +1085,7 @@ describe('OpenxAdapter', function () {
1085
1085
  intentIqId: '1111-intentiqid',
1086
1086
  lipb: {lipbid: '1111-lipb'},
1087
1087
  lotamePanoramaId: '1111-lotameid',
1088
- merkleId: '1111-merkleid',
1088
+ merkleId: {id: '1111-merkleid'},
1089
1089
  netId: 'fH5A3n2O8_CZZyPoJVD-eabc6ECb7jhxCicsds7qSg',
1090
1090
  parrableId: { eid: 'eidVersion.encryptionKeyReference.encryptedValue' },
1091
1091
  pubcid: '1111-pubcid',
@@ -1102,6 +1102,11 @@ describe('OpenxAdapter', function () {
1102
1102
  mwOpenLinkId: '1111-mwopenlinkid',
1103
1103
  dapId: '1111-dapId',
1104
1104
  amxId: '1111-amxid',
1105
+ kpuid: '1111-kpuid',
1106
+ publinkId: '1111-publinkid',
1107
+ naveggId: '1111-naveggid',
1108
+ imuid: '1111-imuid',
1109
+ adtelligentId: '1111-adtelligentid'
1105
1110
  };
1106
1111
 
1107
1112
  // generates the same set of tests for each id provider
@@ -1139,6 +1144,9 @@ describe('OpenxAdapter', function () {
1139
1144
  let userIdValue;
1140
1145
  // handle cases where userId key refers to an object
1141
1146
  switch (userIdProviderKey) {
1147
+ case 'merkleId':
1148
+ userIdValue = EXAMPLE_DATA_BY_ATTR.merkleId.id;
1149
+ break;
1142
1150
  case 'flocId':
1143
1151
  userIdValue = EXAMPLE_DATA_BY_ATTR.flocId.id;
1144
1152
  break;
@@ -1545,7 +1553,7 @@ describe('OpenxAdapter', function () {
1545
1553
  describe('with segments', function () {
1546
1554
  const TESTS = [
1547
1555
  {
1548
- name: 'should send proprietary segment data from first party config',
1556
+ name: 'should send proprietary segment data from ortb2.user.data',
1549
1557
  config: {
1550
1558
  ortb2: {
1551
1559
  user: {
@@ -1556,10 +1564,51 @@ describe('OpenxAdapter', function () {
1556
1564
  }
1557
1565
  }
1558
1566
  },
1559
- expect: 'dmp1/4:foo|bar,dmp2:baz',
1567
+ expect: {sm: 'dmp1/4:foo|bar,dmp2:baz'},
1560
1568
  },
1561
1569
  {
1562
- name: 'should combine same provider segment data from first party config',
1570
+ name: 'should send proprietary segment data from ortb2.site.content.data',
1571
+ config: {
1572
+ ortb2: {
1573
+ site: {
1574
+ content: {
1575
+ data: [
1576
+ {name: 'dmp1', ext: {segtax: 4}, segment: [{id: 'foo'}, {id: 'bar'}]},
1577
+ {name: 'dmp2', segment: [{id: 'baz'}]},
1578
+ ]
1579
+ }
1580
+ }
1581
+ }
1582
+ },
1583
+ expect: {scsm: 'dmp1/4:foo|bar,dmp2:baz'},
1584
+ },
1585
+ {
1586
+ name: 'should send proprietary segment data from both ortb2.site.content.data and ortb2.user.data',
1587
+ config: {
1588
+ ortb2: {
1589
+ user: {
1590
+ data: [
1591
+ {name: 'dmp1', ext: {segtax: 4}, segment: [{id: 'foo'}, {id: 'bar'}]},
1592
+ {name: 'dmp2', segment: [{id: 'baz'}]},
1593
+ ]
1594
+ },
1595
+ site: {
1596
+ content: {
1597
+ data: [
1598
+ {name: 'dmp3', ext: {segtax: 5}, segment: [{id: 'foo2'}, {id: 'bar2'}]},
1599
+ {name: 'dmp4', segment: [{id: 'baz2'}]},
1600
+ ]
1601
+ }
1602
+ }
1603
+ }
1604
+ },
1605
+ expect: {
1606
+ sm: 'dmp1/4:foo|bar,dmp2:baz',
1607
+ scsm: 'dmp3/5:foo2|bar2,dmp4:baz2'
1608
+ },
1609
+ },
1610
+ {
1611
+ name: 'should combine same provider segment data from ortb2.user.data',
1563
1612
  config: {
1564
1613
  ortb2: {
1565
1614
  user: {
@@ -1570,7 +1619,23 @@ describe('OpenxAdapter', function () {
1570
1619
  }
1571
1620
  }
1572
1621
  },
1573
- expect: 'dmp1/4:foo|bar,dmp1:baz',
1622
+ expect: {sm: 'dmp1/4:foo|bar,dmp1:baz'},
1623
+ },
1624
+ {
1625
+ name: 'should combine same provider segment data from ortb2.site.content.data',
1626
+ config: {
1627
+ ortb2: {
1628
+ site: {
1629
+ content: {
1630
+ data: [
1631
+ {name: 'dmp1', ext: {segtax: 4}, segment: [{id: 'foo'}, {id: 'bar'}]},
1632
+ {name: 'dmp1', ext: {}, segment: [{id: 'baz'}]},
1633
+ ]
1634
+ }
1635
+ }
1636
+ }
1637
+ },
1638
+ expect: {scsm: 'dmp1/4:foo|bar,dmp1:baz'},
1574
1639
  },
1575
1640
  {
1576
1641
  name: 'should not send any segment data if first party config is incomplete',
@@ -1595,6 +1660,14 @@ describe('OpenxAdapter', function () {
1595
1660
  {name: 'dmp1', segment: [{id: 'foo'}, {id: 'bar'}]},
1596
1661
  {name: 'dmp2', segment: [{id: 'baz'}]},
1597
1662
  ]
1663
+ },
1664
+ site: {
1665
+ content: {
1666
+ data: [
1667
+ {name: 'dmp3', ext: {segtax: 5}, segment: [{id: 'foo2'}, {id: 'bar2'}]},
1668
+ {name: 'dmp4', segment: [{id: 'baz2'}]},
1669
+ ]
1670
+ }
1598
1671
  }
1599
1672
  }
1600
1673
  },
@@ -1606,7 +1679,10 @@ describe('OpenxAdapter', function () {
1606
1679
  },
1607
1680
  },
1608
1681
  },
1609
- expect: 'dmp1:foo|bar,dmp2:baz,liveintent:l1|l2',
1682
+ expect: {
1683
+ sm: 'dmp1:foo|bar,dmp2:baz,liveintent:l1|l2',
1684
+ scsm: 'dmp3/5:foo2|bar2,dmp4:baz2'
1685
+ },
1610
1686
  },
1611
1687
  {
1612
1688
  name: 'should send just liveintent segment from request if no first party config',
@@ -1619,7 +1695,7 @@ describe('OpenxAdapter', function () {
1619
1695
  },
1620
1696
  },
1621
1697
  },
1622
- expect: 'liveintent:l1|l2',
1698
+ expect: {sm: 'liveintent:l1|l2'},
1623
1699
  },
1624
1700
  {
1625
1701
  name: 'should send nothing if lipb section does not contain segments',
@@ -1636,13 +1712,11 @@ describe('OpenxAdapter', function () {
1636
1712
  utils._each(TESTS, (t) => {
1637
1713
  context('in ortb2.user.data', function () {
1638
1714
  let bidRequests;
1639
- let configStub;
1640
-
1641
1715
  beforeEach(function () {
1642
1716
  let fpdConfig = t.config
1643
- configStub = sinon
1717
+ sinon
1644
1718
  .stub(config, 'getConfig')
1645
- .withArgs('ortb2.user.data')
1719
+ .withArgs(sinon.match(/^ortb2\.user\.data$|^ortb2\.site\.content\.data$/))
1646
1720
  .callsFake((key) => {
1647
1721
  return utils.deepAccess(fpdConfig, key);
1648
1722
  });
@@ -1658,10 +1732,13 @@ describe('OpenxAdapter', function () {
1658
1732
  const request = spec.buildRequests(bidRequests, mockBidderRequest)
1659
1733
  expect(request.length).to.equal(1);
1660
1734
  if (t.expect) {
1661
- expect(request[0].data.sm).to.exist;
1662
- expect(request[0].data.sm).to.equal(encodeURIComponent(t.expect));
1735
+ for (const key in t.expect) {
1736
+ expect(request[0].data[key]).to.exist;
1737
+ expect(request[0].data[key]).to.equal(t.expect[key]);
1738
+ }
1663
1739
  } else {
1664
1740
  expect(request[0].data.sm).to.not.exist;
1741
+ expect(request[0].data.scsm).to.not.exist;
1665
1742
  }
1666
1743
  });
1667
1744
  });
@@ -369,7 +369,7 @@ describe('Opera Ads Bid Adapter', function () {
369
369
  requestData = JSON.parse(reqs[0].data);
370
370
  }).to.not.throw();
371
371
 
372
- expect(requestData.user.id).to.equal(bidRequests[0].userId.sharedid.id);
372
+ expect(requestData.user.buyeruid).to.equal(bidRequests[0].userId.sharedid.id);
373
373
  });
374
374
 
375
375
  it('pubcid should be used when sharedid is empty', function () {
@@ -406,7 +406,7 @@ describe('Opera Ads Bid Adapter', function () {
406
406
  requestData = JSON.parse(reqs[0].data);
407
407
  }).to.not.throw();
408
408
 
409
- expect(requestData.user.id).to.equal(bidRequests[0].userId.pubcid);
409
+ expect(requestData.user.buyeruid).to.equal(bidRequests[0].userId.pubcid);
410
410
  });
411
411
 
412
412
  it('random uid will be generate when userId is empty', function () {
@@ -433,7 +433,7 @@ describe('Opera Ads Bid Adapter', function () {
433
433
  requestData = JSON.parse(reqs[0].data);
434
434
  }).to.not.throw();
435
435
 
436
- expect(requestData.user.id).to.not.be.empty;
436
+ expect(requestData.user.buyeruid).to.not.be.empty;
437
437
  })
438
438
  });
439
439
 
@@ -679,9 +679,41 @@ describe('Opera Ads Bid Adapter', function () {
679
679
  });
680
680
  });
681
681
 
682
- describe('Test getUserSyncs', function () {
683
- it('getUserSyncs should return empty array', function () {
684
- expect(spec.getUserSyncs()).to.be.an('array').that.is.empty;
682
+ describe('Test getUserSyncs with both iframe and pixel disabled', function () {
683
+ it('getUserSyncs should return an empty array', function () {
684
+ const syncOptions = {};
685
+ expect(spec.getUserSyncs(syncOptions)).to.be.an('array').that.is.empty;
686
+ });
687
+ });
688
+
689
+ describe('Test getUserSyncs with iframe enabled', function () {
690
+ it('getUserSyncs should return array', function () {
691
+ const syncOptions = {
692
+ iframeEnabled: true
693
+ }
694
+ const userSyncPixels = spec.getUserSyncs(syncOptions)
695
+ expect(userSyncPixels).to.have.lengthOf(1);
696
+ expect(userSyncPixels[0].url).to.equal('https://s.adx.opera.com/usersync/page')
697
+ });
698
+ });
699
+
700
+ describe('Test getUserSyncs with pixel enabled', function () {
701
+ it('getUserSyncs should return array', function () {
702
+ const serverResponse = {
703
+ body: {
704
+ 'pixels': [
705
+ 'https://b1.com/usersync',
706
+ 'https://b2.com/usersync'
707
+ ]
708
+ }
709
+ };
710
+ const syncOptions = {
711
+ pixelEnabled: true
712
+ }
713
+ const userSyncPixels = spec.getUserSyncs(syncOptions, [serverResponse])
714
+ expect(userSyncPixels).to.have.lengthOf(2);
715
+ expect(userSyncPixels[0].url).to.equal('https://b1.com/usersync')
716
+ expect(userSyncPixels[1].url).to.equal('https://b2.com/usersync')
685
717
  });
686
718
  });
687
719
 
@@ -0,0 +1,67 @@
1
+ import {expect} from 'chai';
2
+ import {spec} from 'modules/otmBidAdapter';
3
+
4
+ describe('otmBidAdapter', function () {
5
+ it('validate_pub_params', function () {
6
+ expect(spec.isBidRequestValid({
7
+ bidder: 'otm',
8
+ params: {
9
+ tid: '123',
10
+ bidfloor: 20
11
+ }
12
+ })).to.equal(true);
13
+ });
14
+
15
+ it('validate_generated_params', function () {
16
+ let bidRequestData = [{
17
+ bidId: 'bid1234',
18
+ bidder: 'otm',
19
+ params: {
20
+ tid: '123',
21
+ bidfloor: 20
22
+ },
23
+ sizes: [[240, 400]]
24
+ }];
25
+
26
+ let request = spec.buildRequests(bidRequestData);
27
+ let req_data = request[0].data;
28
+
29
+ expect(req_data.bidid).to.equal('bid1234');
30
+ });
31
+
32
+ it('validate_response_params', function () {
33
+ let bidRequestData = {
34
+ data: {
35
+ bidId: 'bid1234'
36
+ }
37
+ };
38
+
39
+ let serverResponse = {
40
+ body: [
41
+ {
42
+ 'auctionid': '3c6f8e22-541b-485c-9214-e974d9fb1b6f',
43
+ 'cpm': 847.097,
44
+ 'ad': '<html><body>test html</body></html>',
45
+ 'w': 240,
46
+ 'h': 400,
47
+ 'currency': 'RUB',
48
+ 'ttl': 300,
49
+ 'creativeid': '1_7869053',
50
+ 'bidid': '101f211def7c99',
51
+ 'transactionid': 'transaction_id_1'
52
+ }
53
+ ]
54
+ };
55
+
56
+ let bids = spec.interpretResponse(serverResponse, bidRequestData);
57
+ expect(bids).to.have.lengthOf(1);
58
+ let bid = bids[0];
59
+ expect(bid.cpm).to.equal(847.097);
60
+ expect(bid.currency).to.equal('RUB');
61
+ expect(bid.width).to.equal(240);
62
+ expect(bid.height).to.equal(400);
63
+ expect(bid.netRevenue).to.equal(true);
64
+ expect(bid.requestId).to.equal('101f211def7c99');
65
+ expect(bid.ad).to.equal('<html><body>test html</body></html>');
66
+ });
67
+ });