prebid.js 7.20.0 → 7.22.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 (189) hide show
  1. package/dist/1plusXRtdProvider.js +1 -1
  2. package/dist/33acrossBidAdapter.js +1 -1
  3. package/dist/adagioBidAdapter.js +1 -1
  4. package/dist/adbookpspBidAdapter.js +1 -1
  5. package/dist/adgenerationBidAdapter.js +1 -1
  6. package/dist/adrelevantisBidAdapter.js +1 -1
  7. package/dist/adtrgtmeBidAdapter.js +1 -1
  8. package/dist/adxcgBidAdapter.js +1 -1
  9. package/dist/adyoulikeBidAdapter.js +1 -1
  10. package/dist/ajaBidAdapter.js +1 -1
  11. package/dist/amxBidAdapter.js +1 -1
  12. package/dist/amxIdSystem.js +1 -1
  13. package/dist/appierAnalyticsAdapter.js +1 -1
  14. package/dist/appnexusBidAdapter.js +1 -1
  15. package/dist/asoBidAdapter.js +1 -1
  16. package/dist/audiencerunBidAdapter.js +1 -1
  17. package/dist/axonixBidAdapter.js +1 -1
  18. package/dist/bidglassBidAdapter.js +1 -1
  19. package/dist/big-richmediaBidAdapter.js +1 -1
  20. package/dist/bluebillywigBidAdapter.js +1 -1
  21. package/dist/bridgewellBidAdapter.js +1 -1
  22. package/dist/brightMountainMediaBidAdapter.js +1 -1
  23. package/dist/brightcomBidAdapter.js +1 -1
  24. package/dist/carodaBidAdapter.js +1 -1
  25. package/dist/concertBidAdapter.js +1 -1
  26. package/dist/connectadBidAdapter.js +1 -1
  27. package/dist/consumableBidAdapter.js +1 -1
  28. package/dist/conversantBidAdapter.js +1 -1
  29. package/dist/craftBidAdapter.js +1 -1
  30. package/dist/criteoBidAdapter.js +1 -1
  31. package/dist/dacIdSystem.js +1 -1
  32. package/dist/dspxBidAdapter.js +1 -1
  33. package/dist/eplanningBidAdapter.js +1 -1
  34. package/dist/finativeBidAdapter.js +1 -1
  35. package/dist/freewheel-sspBidAdapter.js +1 -1
  36. package/dist/ftrackIdSystem.js +1 -1
  37. package/dist/glimpseBidAdapter.js +1 -1
  38. package/dist/gmosspBidAdapter.js +1 -1
  39. package/dist/goldbachBidAdapter.js +1 -1
  40. package/dist/gridBidAdapter.js +1 -1
  41. package/dist/gridNMBidAdapter.js +1 -1
  42. package/dist/gumgumBidAdapter.js +1 -1
  43. package/dist/h12mediaBidAdapter.js +1 -1
  44. package/dist/iasRtdProvider.js +1 -1
  45. package/dist/id5IdSystem.js +1 -1
  46. package/dist/impactifyBidAdapter.js +1 -1
  47. package/dist/improvedigitalBidAdapter.js +1 -1
  48. package/dist/inmarBidAdapter.js +1 -1
  49. package/dist/insticatorBidAdapter.js +1 -1
  50. package/dist/ixBidAdapter.js +1 -1
  51. package/dist/jixieBidAdapter.js +1 -1
  52. package/dist/justpremiumBidAdapter.js +1 -1
  53. package/dist/konduitAnalyticsAdapter.js +1 -1
  54. package/dist/kueezBidAdapter.js +1 -1
  55. package/dist/lassoBidAdapter.js +1 -1
  56. package/dist/lifestreetBidAdapter.js +1 -1
  57. package/dist/liveyieldAnalyticsAdapter.js +1 -1
  58. package/dist/logicadBidAdapter.js +1 -1
  59. package/dist/loglyliftBidAdapter.js +1 -1
  60. package/dist/magniteAnalyticsAdapter.js +1 -1
  61. package/dist/malltvAnalyticsAdapter.js +1 -1
  62. package/dist/marsmediaBidAdapter.js +1 -1
  63. package/dist/mediafuseBidAdapter.js +1 -1
  64. package/dist/mediakeysBidAdapter.js +1 -1
  65. package/dist/medianetAnalyticsAdapter.js +1 -1
  66. package/dist/medianetBidAdapter.js +1 -1
  67. package/dist/mediasquareBidAdapter.js +1 -1
  68. package/dist/mgidBidAdapter.js +1 -1
  69. package/dist/minutemediaBidAdapter.js +1 -1
  70. package/dist/not-for-prod/prebid.js +127 -127
  71. package/dist/oguryBidAdapter.js +1 -1
  72. package/dist/onetagBidAdapter.js +1 -1
  73. package/dist/ooloAnalyticsAdapter.js +1 -1
  74. package/dist/outbrainBidAdapter.js +1 -1
  75. package/dist/parrableIdSystem.js +1 -1
  76. package/dist/pixfutureBidAdapter.js +1 -1
  77. package/dist/prebid-core.js +1 -1
  78. package/dist/prebidServerBidAdapter.js +1 -1
  79. package/dist/publinkIdSystem.js +1 -1
  80. package/dist/pubmaticBidAdapter.js +1 -1
  81. package/dist/pubwiseAnalyticsAdapter.js +1 -1
  82. package/dist/pubwiseBidAdapter.js +1 -1
  83. package/dist/pulsepointBidAdapter.js +1 -1
  84. package/dist/pxyzBidAdapter.js +1 -1
  85. package/dist/quantcastBidAdapter.js +1 -1
  86. package/dist/readpeakBidAdapter.js +1 -1
  87. package/dist/relaidoBidAdapter.js +1 -1
  88. package/dist/rhythmoneBidAdapter.js +1 -1
  89. package/dist/riseBidAdapter.js +1 -1
  90. package/dist/rubiconAnalyticsAdapter.js +1 -1
  91. package/dist/rubiconBidAdapter.js +1 -1
  92. package/dist/seedingAllianceBidAdapter.js +1 -1
  93. package/dist/seedtagBidAdapter.js +1 -1
  94. package/dist/sharethroughAnalyticsAdapter.js +1 -1
  95. package/dist/sharethroughBidAdapter.js +1 -1
  96. package/dist/shinezBidAdapter.js +1 -1
  97. package/dist/smaatoBidAdapter.js +1 -1
  98. package/dist/smartadserverBidAdapter.js +1 -1
  99. package/dist/smartxBidAdapter.js +1 -1
  100. package/dist/smilewantedBidAdapter.js +1 -1
  101. package/dist/sonobiBidAdapter.js +1 -1
  102. package/dist/sovrnAnalyticsAdapter.js +1 -1
  103. package/dist/sovrnBidAdapter.js +1 -1
  104. package/dist/sspBCBidAdapter.js +1 -1
  105. package/dist/sublimeBidAdapter.js +1 -1
  106. package/dist/synacormediaBidAdapter.js +1 -1
  107. package/dist/targetVideoBidAdapter.js +1 -1
  108. package/dist/teadsBidAdapter.js +1 -1
  109. package/dist/trionBidAdapter.js +1 -1
  110. package/dist/tripleliftBidAdapter.js +1 -1
  111. package/dist/ttdBidAdapter.js +1 -1
  112. package/dist/ucfunnelAnalyticsAdapter.js +1 -1
  113. package/dist/underdogmediaBidAdapter.js +1 -1
  114. package/dist/undertoneBidAdapter.js +1 -1
  115. package/dist/userId.js +1 -1
  116. package/dist/vidazooBidAdapter.js +1 -1
  117. package/dist/videobyteBidAdapter.js +1 -1
  118. package/dist/visxBidAdapter.js +1 -1
  119. package/dist/vuukleBidAdapter.js +1 -1
  120. package/dist/weboramaRtdProvider.js +1 -1
  121. package/dist/widespaceBidAdapter.js +1 -1
  122. package/dist/winrBidAdapter.js +1 -1
  123. package/dist/yahoosspBidAdapter.js +1 -1
  124. package/dist/yieldmoBidAdapter.js +1 -1
  125. package/dist/yieldoneAnalyticsAdapter.js +1 -1
  126. package/dist/yieldoneBidAdapter.js +1 -1
  127. package/integrationExamples/gpt/weboramaRtdProvider_example.html +10 -51
  128. package/modules/1plusXRtdProvider.js +32 -5
  129. package/modules/33acrossBidAdapter.js +18 -11
  130. package/modules/adyoulikeBidAdapter.js +12 -6
  131. package/modules/asoBidAdapter.js +11 -6
  132. package/modules/asoBidAdapter.md +5 -6
  133. package/modules/brightcomBidAdapter.js +30 -10
  134. package/modules/dacIdSystem.js +145 -27
  135. package/modules/dacIdSystem.md +7 -2
  136. package/modules/fledgeForGpt.md +101 -23
  137. package/modules/freewheel-sspBidAdapter.js +48 -7
  138. package/modules/freewheel-sspBidAdapter.md +1 -1
  139. package/modules/ftrackIdSystem.js +28 -9
  140. package/modules/gridBidAdapter.js +1 -0
  141. package/modules/iasRtdProvider.js +21 -6
  142. package/modules/iasRtdProvider.md +1 -1
  143. package/modules/ixBidAdapter.js +9 -4
  144. package/modules/medianetAnalyticsAdapter.js +26 -22
  145. package/modules/medianetBidAdapter.js +5 -1
  146. package/modules/mediasquareBidAdapter.js +42 -3
  147. package/modules/mgidBidAdapter.js +8 -1
  148. package/modules/oguryBidAdapter.js +6 -2
  149. package/modules/prebidServerBidAdapter/index.js +1 -1
  150. package/modules/pubmaticBidAdapter.js +27 -3
  151. package/modules/pubwiseBidAdapter.js +14 -12
  152. package/modules/pulsepointBidAdapter.js +11 -6
  153. package/modules/smaatoBidAdapter.js +54 -5
  154. package/modules/smaatoBidAdapter.md +78 -0
  155. package/modules/teadsBidAdapter.js +26 -8
  156. package/modules/ttdBidAdapter.js +8 -0
  157. package/modules/userId/eids.js +7 -11
  158. package/modules/weboramaRtdProvider.js +800 -643
  159. package/modules/weboramaRtdProvider.md +32 -0
  160. package/modules/yieldoneBidAdapter.js +7 -4
  161. package/package.json +3 -3
  162. package/src/adapters/bidderFactory.js +11 -9
  163. package/src/auction.js +3 -3
  164. package/test/spec/auctionmanager_spec.js +29 -20
  165. package/test/spec/modules/1plusXRtdProvider_spec.js +30 -14
  166. package/test/spec/modules/33acrossBidAdapter_spec.js +44 -1
  167. package/test/spec/modules/adyoulikeBidAdapter_spec.js +1 -1
  168. package/test/spec/modules/asoBidAdapter_spec.js +2 -2
  169. package/test/spec/modules/brightcomBidAdapter_spec.js +94 -1
  170. package/test/spec/modules/dacIdSystem_spec.js +93 -11
  171. package/test/spec/modules/eids_spec.js +11 -7
  172. package/test/spec/modules/freewheel-sspBidAdapter_spec.js +25 -4
  173. package/test/spec/modules/ftrackIdSystem_spec.js +200 -90
  174. package/test/spec/modules/iasRtdProvider_spec.js +57 -1
  175. package/test/spec/modules/ixBidAdapter_spec.js +12 -0
  176. package/test/spec/modules/medianetAnalyticsAdapter_spec.js +50 -8
  177. package/test/spec/modules/medianetBidAdapter_spec.js +76 -0
  178. package/test/spec/modules/mediasquareBidAdapter_spec.js +4 -2
  179. package/test/spec/modules/mgidBidAdapter_spec.js +50 -0
  180. package/test/spec/modules/oguryBidAdapter_spec.js +33 -17
  181. package/test/spec/modules/prebidServerBidAdapter_spec.js +24 -0
  182. package/test/spec/modules/pubmaticBidAdapter_spec.js +60 -5
  183. package/test/spec/modules/pubwiseBidAdapter_spec.js +6 -4
  184. package/test/spec/modules/pulsepointBidAdapter_spec.js +123 -0
  185. package/test/spec/modules/smaatoBidAdapter_spec.js +307 -36
  186. package/test/spec/modules/teadsBidAdapter_spec.js +119 -6
  187. package/test/spec/modules/weboramaRtdProvider_spec.js +382 -0
  188. package/test/spec/modules/yieldoneBidAdapter_spec.js +2 -3
  189. package/test/spec/unit/core/bidderFactory_spec.js +0 -4
@@ -109,6 +109,7 @@ On this section we will explain the `params.weboCtxConf` subconfiguration:
109
109
  | :------------ | :------------ | :------------ |:------------ |
110
110
  | token | String | Security Token provided by Weborama, unique per client | Mandatory |
111
111
  | targetURL | String | Url to be profiled in the contextual api | Optional. Defaults to `document.URL` |
112
+ | assetID | Function or String | if provided, we will call the document-profile api using this asset id. |Optional|
112
113
  | setPrebidTargeting|Various|If true, will use the contextual profile to set the prebid (GPT/GAM or AST) targeting of all adunits managed by prebid.js| Optional. Default is `params.setPrebidTargeting` (if any) or `true`.|
113
114
  | sendToBidders|Various|If true, will send the contextual profile to all bidders. If an array, will specify the bidders to send data| Optional. Default is `params.sendToBidders` (if any) or `true`.|
114
115
  | defaultProfile | Object | default value of the profile to be used when there are no response from contextual api (such as timeout)| Optional. Default is `{}` |
@@ -383,6 +384,37 @@ pbjs.que.push(function () {
383
384
  });
384
385
  ```
385
386
 
387
+ An alternative version, using asset id instead of target url on contextual, can be found here:
388
+
389
+ ```javascript
390
+ var pbjs = pbjs || {};
391
+ pbjs.que = pbjs.que || [];
392
+
393
+ pbjs.que.push(function () {
394
+ pbjs.setConfig({
395
+ debug: true,
396
+ realTimeData: {
397
+ auctionDelay: 1000,
398
+ dataProviders: [{
399
+ name: "weborama",
400
+ waitForIt: true,
401
+ params: {
402
+ weboCtxConf: {
403
+ token: "<<to-be-defined>>", // mandatory
404
+ assetID: "datasource:docId", // can be a callback to be executed in runtime and returns the identifier
405
+ setPrebidTargeting: true, // override param.setPrebidTargeting. default is true
406
+ sendToBidders: true, // override param.sendToBidders. default is true
407
+ defaultProfile: { // optional, used if nothing is found
408
+ webo_ctx: [ ... ], // contextual segments
409
+ webo_ds: [ ...], // data science segments
410
+ },
411
+ enabled: true,
412
+ },
413
+ ...
414
+ });
415
+ });
416
+ ```
417
+
386
418
  Imagine we need to configure the following options using the previous example, we can write the configuration like the one below.
387
419
 
388
420
  ||contextual|wam|lite|
@@ -74,10 +74,13 @@ export const spec = {
74
74
  }
75
75
 
76
76
  // DACID
77
- const dacId = deepAccess(bidRequest, 'userId.dacId.id');
78
- if (isStr(dacId) && !isEmpty(dacId)) {
79
- payload.dac_id = dacId;
80
- payload.fuuid = dacId;
77
+ const fuuid = deepAccess(bidRequest, 'userId.dacId.fuuid');
78
+ const dacid = deepAccess(bidRequest, 'userId.dacId.id');
79
+ if (isStr(fuuid) && !isEmpty(fuuid)) {
80
+ payload.fuuid = fuuid;
81
+ }
82
+ if (isStr(dacid) && !isEmpty(dacid)) {
83
+ payload.dac_id = dacid;
81
84
  }
82
85
 
83
86
  // ID5
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "prebid.js",
3
- "version": "7.20.0",
3
+ "version": "7.22.0",
4
4
  "description": "Header Bidding Management Library",
5
5
  "main": "src/prebid.js",
6
6
  "scripts": {
@@ -64,7 +64,7 @@
64
64
  "faker": "^5.5.3",
65
65
  "fs.extra": "^1.3.2",
66
66
  "gulp": "^4.0.0",
67
- "gulp-clean": "^0.3.2",
67
+ "gulp-clean": "^0.4.0",
68
68
  "gulp-concat": "^2.6.0",
69
69
  "gulp-connect": "^5.7.0",
70
70
  "gulp-eslint": "^6.0.0",
@@ -97,7 +97,7 @@
97
97
  "karma-spec-reporter": "^0.0.32",
98
98
  "karma-webpack": "^5.0.0",
99
99
  "lodash": "^4.17.21",
100
- "mocha": "^5.0.0",
100
+ "mocha": "^10.0.0",
101
101
  "morgan": "^1.10.0",
102
102
  "opn": "^5.4.0",
103
103
  "resolve-from": "^5.0.0",
@@ -545,22 +545,24 @@ export function getIabSubCategory(bidderCode, category) {
545
545
 
546
546
  // check that the bid has a width and height set
547
547
  function validBidSize(adUnitCode, bid, {index = auctionManager.index} = {}) {
548
- const bidRequest = index.getBidRequest(bid);
549
- const mediaTypes = index.getMediaTypes(bid);
550
-
551
- const sizes = (bidRequest && bidRequest.sizes) || (mediaTypes && mediaTypes.banner && mediaTypes.banner.sizes);
552
- const parsedSizes = parseSizesInput(sizes).map(sz => sz.split('x').map(n => parseInt(n, 10)));
553
-
554
548
  if ((bid.width || parseInt(bid.width, 10) === 0) && (bid.height || parseInt(bid.height, 10) === 0)) {
555
549
  bid.width = parseInt(bid.width, 10);
556
550
  bid.height = parseInt(bid.height, 10);
557
- return parsedSizes.length === 0 || parsedSizes.some(([w, h]) => bid.width === w && bid.height === h);
551
+ return true;
558
552
  }
559
553
 
554
+ const bidRequest = index.getBidRequest(bid);
555
+ const mediaTypes = index.getMediaTypes(bid);
556
+
557
+ const sizes = (bidRequest && bidRequest.sizes) || (mediaTypes && mediaTypes.banner && mediaTypes.banner.sizes);
558
+ const parsedSizes = parseSizesInput(sizes);
559
+
560
560
  // if a banner impression has one valid size, we assign that size to any bid
561
561
  // response that does not explicitly set width or height
562
562
  if (parsedSizes.length === 1) {
563
- ([bid.width, bid.height] = parsedSizes[0]);
563
+ const [ width, height ] = parsedSizes[0].split('x');
564
+ bid.width = parseInt(width, 10);
565
+ bid.height = parseInt(height, 10);
564
566
  return true;
565
567
  }
566
568
 
@@ -602,7 +604,7 @@ export function isValid(adUnitCode, bid, {index = auctionManager.index} = {}) {
602
604
  return false;
603
605
  }
604
606
  if (bid.mediaType === 'banner' && !validBidSize(adUnitCode, bid, {index})) {
605
- logError(errorMessage(`Banner bids require a width and height that match one of the requested sizes`));
607
+ logError(errorMessage(`Banner bids require a width and height`));
606
608
  return false;
607
609
  }
608
610
 
package/src/auction.js CHANGED
@@ -690,7 +690,7 @@ function getPreparedBidForAuction(bid, {index = auctionManager.index} = {}) {
690
690
  events.emit(CONSTANTS.EVENTS.BID_ADJUSTMENT, bid);
691
691
 
692
692
  // a publisher-defined renderer can be used to render bids
693
- const adUnitRenderer = index.getAdUnit(bid).renderer;
693
+ const bidRenderer = index.getBidRequest(bid)?.renderer || index.getAdUnit(bid).renderer;
694
694
 
695
695
  // a publisher can also define a renderer for a mediaType
696
696
  const bidObjectMediaType = bid.mediaType;
@@ -704,8 +704,8 @@ function getPreparedBidForAuction(bid, {index = auctionManager.index} = {}) {
704
704
  // the renderer for the mediaType takes precendence
705
705
  if (mediaTypeRenderer && mediaTypeRenderer.url && mediaTypeRenderer.render && !(mediaTypeRenderer.backupOnly === true && bid.renderer)) {
706
706
  renderer = mediaTypeRenderer;
707
- } else if (adUnitRenderer && adUnitRenderer.url && adUnitRenderer.render && !(adUnitRenderer.backupOnly === true && bid.renderer)) {
708
- renderer = adUnitRenderer;
707
+ } else if (bidRenderer && bidRenderer.url && bidRenderer.render && !(bidRenderer.backupOnly === true && bid.renderer)) {
708
+ renderer = bidRenderer;
709
709
  }
710
710
 
711
711
  if (renderer) {
@@ -736,6 +736,7 @@ describe('auctionmanager.js', function () {
736
736
  let auction;
737
737
  let ajaxStub;
738
738
  let bids;
739
+ let bidderRequests;
739
740
  let makeRequestsStub;
740
741
 
741
742
  before(function () {
@@ -759,7 +760,8 @@ describe('auctionmanager.js', function () {
759
760
  adUnitCodes = [ADUNIT_CODE];
760
761
  auction = auctionModule.newAuction({adUnits, adUnitCodes, callback: function() {}, cbTimeout: 3000});
761
762
  bids = TEST_BIDS.slice();
762
- makeRequestsStub.returns(bids.map(b => mockBidRequest(b, {auctionId: auction.getAuctionId()})));
763
+ bidderRequests = bids.map(b => mockBidRequest(b, {auctionId: auction.getAuctionId()}));
764
+ makeRequestsStub.returns(bidderRequests);
763
765
  indexAuctions = [auction];
764
766
  createAuctionStub = sinon.stub(auctionModule, 'newAuction');
765
767
  createAuctionStub.returns(auction);
@@ -813,25 +815,32 @@ describe('auctionmanager.js', function () {
813
815
  assert.equal(registeredBid.adserverTargeting.extra, 'stuff');
814
816
  });
815
817
 
816
- it('installs publisher-defined renderers on bids', function () {
817
- let renderer = {
818
- url: 'renderer.js',
819
- render: (bid) => bid
820
- };
821
- Object.assign(adUnits[0], {renderer});
822
-
823
- let bids1 = Object.assign({},
824
- bids[0],
825
- {
826
- bidderCode: BIDDER_CODE,
827
- mediaType: 'video-outstream',
828
- }
829
- );
830
- spec.interpretResponse.returns(bids1);
831
- auction.callBids();
832
- const addedBid = auction.getBidsReceived().pop();
833
- assert.equal(addedBid.renderer.url, 'renderer.js');
834
- });
818
+ describe('install publisher-defined renderers', () => {
819
+ Object.entries({
820
+ 'on adUnit': () => adUnits[0],
821
+ 'on bid': () => bidderRequests[0].bids[0],
822
+ }).forEach(([t, getObj]) => {
823
+ it(t, () => {
824
+ let renderer = {
825
+ url: 'renderer.js',
826
+ render: (bid) => bid
827
+ };
828
+
829
+ let bids1 = Object.assign({},
830
+ bids[0],
831
+ {
832
+ bidderCode: BIDDER_CODE,
833
+ mediaType: 'video-outstream',
834
+ }
835
+ );
836
+ Object.assign(getObj(), {renderer});
837
+ spec.interpretResponse.returns(bids1);
838
+ auction.callBids();
839
+ const addedBid = auction.getBidsReceived().pop();
840
+ assert.equal(addedBid.renderer.url, 'renderer.js');
841
+ })
842
+ })
843
+ })
835
844
 
836
845
  it('installs publisher-defined backup renderers on bids', function () {
837
846
  let renderer = {
@@ -9,6 +9,8 @@ import {
9
9
  extractConsent,
10
10
  getPapiUrl
11
11
  } from 'modules/1plusXRtdProvider';
12
+ import assert from 'assert';
13
+ import { extractFpid } from '../../../modules/1plusXRtdProvider';
12
14
 
13
15
  describe('1plusXRtdProvider', () => {
14
16
  // Fake server config
@@ -276,41 +278,50 @@ describe('1plusXRtdProvider', () => {
276
278
 
277
279
  it('throws an error if the consent is malformed', () => {
278
280
  const consent1 = {
279
- gdpr: {
280
- gdprApplies: 1
281
- }
282
- }
283
- const consent2 = {
284
281
  gdpr: {
285
282
  consentString: 'myConsent'
286
283
  }
287
284
  }
288
- const consent3 = {
285
+ const consent2 = {
289
286
  gdpr: {
290
287
  gdprApplies: 1,
291
288
  consentString: 3
292
289
  }
293
290
  }
294
- const consent4 = {
291
+ const consent3 = {
295
292
  gdpr: {
296
293
  gdprApplies: 'yes',
297
294
  consentString: 'myConsent'
298
295
  }
299
296
  }
300
- const consent5 = {
301
- gdprApplies: 1,
302
- consentString: 'myConsent'
297
+ const consent4 = {
298
+ gdpr: {}
303
299
  }
304
300
 
305
- for (const consent in [consent1, consent2, consent3, consent4, consent5]) {
301
+ for (const consent of [consent1, consent2, consent3, consent4]) {
302
+ var failed = false;
306
303
  try {
307
304
  extractConsent(consent)
308
- assert(false, 'Should be throwing an exception')
309
- } catch (e) { }
305
+ } catch (e) {
306
+ failed = true;
307
+ } finally {
308
+ assert(failed, 'Should be throwing an exception')
309
+ }
310
310
  }
311
311
  })
312
312
  })
313
313
 
314
+ describe('extractFpid', () => {
315
+ it('correctly extracts an ope fpid if present', () => {
316
+ window.localStorage.setItem('ope_fpid', 'oneplusx_test_key')
317
+ const id1 = extractFpid()
318
+ window.localStorage.removeItem('ope_fpid')
319
+ const id2 = extractFpid()
320
+ expect(id1).to.equal('oneplusx_test_key')
321
+ expect(id2).to.equal(null)
322
+ })
323
+ })
324
+
314
325
  describe('getPapiUrl', () => {
315
326
  const customer = 'acme'
316
327
  const consent = {
@@ -320,11 +331,16 @@ describe('1plusXRtdProvider', () => {
320
331
  }
321
332
  }
322
333
 
323
- it('correctly builds URLs based on consent', () => {
334
+ it('correctly builds URLs if gdpr parameters are present', () => {
324
335
  const url1 = getPapiUrl(customer)
325
336
  const url2 = getPapiUrl(customer, extractConsent(consent))
326
337
  expect(['&consent_string=myConsent&gdpr_applies=1', '&gdpr_applies=1&consent_string=myConsent']).to.contain(url2.replace(url1, ''))
327
338
  })
339
+
340
+ it('correctly builds URLs if fpid parameters are present')
341
+ const url1 = getPapiUrl(customer)
342
+ const url2 = getPapiUrl(customer, {}, 'my_first_party_id')
343
+ expect(url2.replace(url1, '')).to.equal('&fpid=my_first_party_id')
328
344
  })
329
345
 
330
346
  describe('updateBidderConfig', () => {
@@ -43,6 +43,17 @@ describe('33acrossBidAdapter:', function () {
43
43
  ah: 500,
44
44
  mtp: 0
45
45
  }
46
+ },
47
+ sua: {
48
+ browsers: [{
49
+ brand: 'Google Chrome',
50
+ version: ['104', '0', '5112', '79']
51
+ }],
52
+ platform: {
53
+ brand: 'macOS',
54
+ version: ['11', '6', '8']
55
+ },
56
+ model: ''
46
57
  }
47
58
  },
48
59
  id: 'r1',
@@ -305,7 +316,23 @@ describe('33acrossBidAdapter:', function () {
305
316
  adUnitCode: 'div-id',
306
317
  auctionId: 'r1',
307
318
  mediaTypes: {},
308
- transactionId: 't1'
319
+ transactionId: 't1',
320
+ ortb2: {
321
+ device: {
322
+ sua: {
323
+ browsers: [{
324
+ brand: 'Google Chrome',
325
+ version: ['104', '0', '5112', '79']
326
+ }],
327
+ platform: {
328
+ brand: 'macOS',
329
+ version: ['11', '6', '8']
330
+ },
331
+ model: '',
332
+ mobile: false
333
+ }
334
+ }
335
+ }
309
336
  }
310
337
  ];
311
338
 
@@ -322,6 +349,22 @@ describe('33acrossBidAdapter:', function () {
322
349
  auctionId: 'r1',
323
350
  mediaTypes: {},
324
351
  transactionId: 't2',
352
+ ortb2: {
353
+ device: {
354
+ sua: {
355
+ browsers: [{
356
+ brand: 'Google Chrome',
357
+ version: ['104', '0', '5112', '79']
358
+ }],
359
+ platform: {
360
+ brand: 'macOS',
361
+ version: ['11', '6', '8']
362
+ },
363
+ model: '',
364
+ mobile: false
365
+ }
366
+ }
367
+ },
325
368
  ...bidParams
326
369
  });
327
370
 
@@ -18,7 +18,7 @@ describe('Adyoulike Adapter', function () {
18
18
  consentString: consentString,
19
19
  gdprApplies: true
20
20
  },
21
- refererInfo: {location: referrerUrl, canonicalUrl, domain},
21
+ refererInfo: {location: referrerUrl, canonicalUrl, domain, topmostLocation: 'fakePageURL'},
22
22
  ortb2: {site: {page: pageUrl, ref: referrerUrl}}
23
23
  };
24
24
  const bidRequestWithEmptyPlacement = [
@@ -125,7 +125,7 @@ describe('Adserver.Online bidding adapter', function () {
125
125
  expect(parsedRequestUrl.pathname).to.equal('/prebid/bidder');
126
126
 
127
127
  const query = parsedRequestUrl.search;
128
- expect(query.pbjs).to.equal('$prebid.version$');
128
+ expect(query.pbjs).to.contain('$prebid.version$');
129
129
  expect(query.zid).to.equal('1');
130
130
 
131
131
  expect(request.data).to.exist;
@@ -162,7 +162,7 @@ describe('Adserver.Online bidding adapter', function () {
162
162
  expect(parsedRequestUrl.pathname).to.equal('/prebid/bidder');
163
163
 
164
164
  const query = parsedRequestUrl.search;
165
- expect(query.pbjs).to.equal('$prebid.version$');
165
+ expect(query.pbjs).to.contain('$prebid.version$');
166
166
  expect(query.zid).to.equal('2');
167
167
 
168
168
  expect(request.data).to.not.be.empty;
@@ -2,6 +2,7 @@ import { expect } from 'chai';
2
2
  import * as utils from 'src/utils.js';
3
3
  import { spec } from 'modules/brightcomBidAdapter.js';
4
4
  import { newBidder } from 'src/adapters/bidderFactory.js';
5
+ import {config} from '../../../src/config';
5
6
 
6
7
  const URL = 'https://brightcombid.marphezis.com/hb';
7
8
 
@@ -52,7 +53,21 @@ describe('brightcomBidAdapter', function() {
52
53
  },
53
54
  'bidId': '5fb26ac22bde4',
54
55
  'bidderRequestId': '4bf93aeb730cb9',
55
- 'auctionId': 'ffe9a1f7-7b67-4bda-a8e0-9ee5dc9f442e'
56
+ 'auctionId': 'ffe9a1f7-7b67-4bda-a8e0-9ee5dc9f442e',
57
+ 'schain': {
58
+ 'ver': '1.0',
59
+ 'complete': 1,
60
+ 'nodes': [
61
+ {
62
+ 'asi': 'exchange1.com',
63
+ 'sid': '1234',
64
+ 'hp': 1,
65
+ 'rid': 'bid-request-1',
66
+ 'name': 'publisher',
67
+ 'domain': 'publisher.com'
68
+ }
69
+ ]
70
+ },
56
71
  }];
57
72
 
58
73
  sandbox = sinon.sandbox.create();
@@ -167,6 +182,84 @@ describe('brightcomBidAdapter', function() {
167
182
  expect(data.user.ext.consent).to.equal(consentString);
168
183
  });
169
184
 
185
+ it('sends us_privacy', function () {
186
+ const bidderRequest = {
187
+ uspConsent: '1YYY'
188
+ };
189
+ const data = JSON.parse(spec.buildRequests(bidRequests, bidderRequest).data)
190
+
191
+ expect(data.regs).to.not.equal(null);
192
+ expect(data.regs.ext).to.not.equal(null);
193
+ expect(data.regs.ext.us_privacy).to.equal('1YYY');
194
+ });
195
+
196
+ it('sends coppa', function () {
197
+ sandbox.stub(config, 'getConfig').withArgs('coppa').returns(true);
198
+
199
+ const data = JSON.parse(spec.buildRequests(bidRequests).data)
200
+ expect(data.regs).to.not.be.undefined;
201
+ expect(data.regs.coppa).to.equal(1);
202
+ });
203
+
204
+ it('sends schain', function () {
205
+ const data = JSON.parse(spec.buildRequests(bidRequests).data);
206
+ expect(data).to.not.be.undefined;
207
+ expect(data.source).to.not.be.undefined;
208
+ expect(data.source.ext).to.not.be.undefined;
209
+ expect(data.source.ext.schain).to.not.be.undefined;
210
+ expect(data.source.ext.schain.complete).to.equal(1);
211
+ expect(data.source.ext.schain.ver).to.equal('1.0');
212
+ expect(data.source.ext.schain.nodes).to.not.be.undefined;
213
+ expect(data.source.ext.schain.nodes).to.lengthOf(1);
214
+ expect(data.source.ext.schain.nodes[0].asi).to.equal('exchange1.com');
215
+ expect(data.source.ext.schain.nodes[0].sid).to.equal('1234');
216
+ expect(data.source.ext.schain.nodes[0].hp).to.equal(1);
217
+ expect(data.source.ext.schain.nodes[0].rid).to.equal('bid-request-1');
218
+ expect(data.source.ext.schain.nodes[0].name).to.equal('publisher');
219
+ expect(data.source.ext.schain.nodes[0].domain).to.equal('publisher.com');
220
+ });
221
+
222
+ it('sends user eid parameters', function () {
223
+ bidRequests[0].userIdAsEids = [{
224
+ source: 'pubcid.org',
225
+ uids: [{
226
+ id: 'userid_pubcid'
227
+ }]
228
+ }, {
229
+ source: 'adserver.org',
230
+ uids: [{
231
+ id: 'userid_ttd',
232
+ ext: {
233
+ rtiPartner: 'TDID'
234
+ }
235
+ }]
236
+ }
237
+ ];
238
+
239
+ const data = JSON.parse(spec.buildRequests(bidRequests).data);
240
+
241
+ expect(data.user).to.not.be.undefined;
242
+ expect(data.user.ext).to.not.be.undefined;
243
+ expect(data.user.ext.eids).to.not.be.undefined;
244
+ expect(data.user.ext.eids).to.deep.equal(bidRequests[0].userIdAsEids);
245
+ });
246
+
247
+ it('sends user id parameters', function () {
248
+ const userId = {
249
+ sharedid: {
250
+ id: '01*******',
251
+ third: '01E*******'
252
+ }
253
+ };
254
+
255
+ bidRequests[0].userId = userId;
256
+
257
+ const data = JSON.parse(spec.buildRequests(bidRequests).data);
258
+ expect(data.user).to.not.be.undefined;
259
+ expect(data.user.ext).to.not.be.undefined;
260
+ expect(data.user.ext.ids).is.deep.equal(userId);
261
+ });
262
+
170
263
  context('when element is fully in view', function() {
171
264
  it('returns 100', function() {
172
265
  Object.assign(element, { width: 600, height: 400 });
@@ -1,8 +1,16 @@
1
- import { dacIdSystemSubmodule, storage, cookieKey } from 'modules/dacIdSystem.js';
1
+ import {
2
+ dacIdSystemSubmodule,
3
+ storage,
4
+ FUUID_COOKIE_NAME,
5
+ AONEID_COOKIE_NAME
6
+ } from 'modules/dacIdSystem.js';
7
+ import { server } from 'test/mocks/xhr.js';
2
8
 
3
- const DACID_DUMMY_VALUE = 'dacIdTest';
9
+ const FUUID_DUMMY_VALUE = 'dacIdTest';
10
+ const AONEID_DUMMY_VALUE = '12345'
4
11
  const DACID_DUMMY_OBJ = {
5
- dacId: DACID_DUMMY_VALUE
12
+ fuuid: FUUID_DUMMY_VALUE,
13
+ uid: AONEID_DUMMY_VALUE
6
14
  };
7
15
 
8
16
  describe('dacId module', function () {
@@ -23,24 +31,98 @@ describe('dacId module', function () {
23
31
  ''
24
32
  ]
25
33
 
34
+ const configParamTestCase = {
35
+ params: {
36
+ oid: [
37
+ '637c1b6fc26bfad0', // valid
38
+ 'e8316b39c08029e1' // invalid
39
+ ]
40
+ }
41
+ }
42
+
26
43
  describe('getId()', function () {
27
- it('should return the uid when it exists in cookie', function () {
28
- getCookieStub.withArgs(cookieKey).returns(DACID_DUMMY_VALUE);
44
+ it('should return undefined when oid & fuuid not exist', function () {
45
+ // no oid, no fuuid
29
46
  const id = dacIdSystemSubmodule.getId();
30
- expect(id).to.be.deep.equal({id: {dacId: DACID_DUMMY_VALUE}});
47
+ expect(id).to.equal(undefined);
31
48
  });
32
49
 
33
- cookieTestCasesForEmpty.forEach(testCase => it('should return the uid when it not exists in cookie', function () {
34
- getCookieStub.withArgs(cookieKey).returns(testCase);
50
+ it('should return fuuid when oid not exists but fuuid exists', function () {
51
+ // no oid, fuuid
52
+ getCookieStub.withArgs(FUUID_COOKIE_NAME).returns(FUUID_DUMMY_VALUE);
35
53
  const id = dacIdSystemSubmodule.getId();
36
- expect(id).to.be.deep.equal(undefined);
54
+ expect(id).to.be.deep.equal({
55
+ id: {
56
+ fuuid: FUUID_DUMMY_VALUE,
57
+ uid: undefined
58
+ }
59
+ });
60
+ });
61
+
62
+ it('should return fuuid when oid is invalid but fuuid exists', function () {
63
+ // invalid oid, fuuid, no AoneId
64
+ getCookieStub.withArgs(FUUID_COOKIE_NAME).returns(FUUID_DUMMY_VALUE);
65
+ const id = dacIdSystemSubmodule.getId(configParamTestCase.params.oid[1]);
66
+ expect(id).to.be.deep.equal({
67
+ id: {
68
+ fuuid: FUUID_DUMMY_VALUE,
69
+ uid: undefined
70
+ }
71
+ });
72
+ });
73
+
74
+ cookieTestCasesForEmpty.forEach(testCase => it('should return undefined when fuuid not exists', function () {
75
+ // valid oid, no fuuid, no AoneId
76
+ getCookieStub.withArgs(FUUID_COOKIE_NAME).returns(testCase);
77
+ const id = dacIdSystemSubmodule.getId(configParamTestCase.params.oid[0]);
78
+ expect(id).to.equal(undefined);
37
79
  }));
80
+
81
+ it('should return AoneId when AoneId not exists', function () {
82
+ // valid oid, fuuid, no AoneId
83
+ getCookieStub.withArgs(FUUID_COOKIE_NAME).returns(FUUID_DUMMY_VALUE);
84
+ const callbackSpy = sinon.spy();
85
+ const callback = dacIdSystemSubmodule.getId({params: {oid: configParamTestCase.params.oid[0]}}).callback;
86
+ callback(callbackSpy);
87
+ const request = server.requests[0];
88
+ request.respond(200, { 'Content-Type': 'application/json' }, JSON.stringify({'uid': AONEID_DUMMY_VALUE}));
89
+ expect(callbackSpy.lastCall.lastArg).to.deep.equal({fuuid: 'dacIdTest', uid: AONEID_DUMMY_VALUE});
90
+ });
91
+
92
+ cookieTestCasesForEmpty.forEach(testCase => it('should return undefined when AoneId not exists & API result is empty', function () {
93
+ // valid oid, fuuid, no AoneId, API result empty
94
+ getCookieStub.withArgs(FUUID_COOKIE_NAME).returns(FUUID_DUMMY_VALUE);
95
+ const callbackSpy = sinon.spy();
96
+ const callback = dacIdSystemSubmodule.getId({params: {oid: configParamTestCase.params.oid[0]}}).callback;
97
+ callback(callbackSpy);
98
+ const request = server.requests[0];
99
+ request.respond(200, { 'Content-Type': 'application/json' }, JSON.stringify({'uid': testCase}));
100
+ expect(callbackSpy.lastCall.lastArg).to.deep.equal({fuuid: 'dacIdTest', uid: undefined});
101
+ }));
102
+
103
+ it('should return the fuuid & AoneId when they exist', function () {
104
+ // valid oid, fuuid, AoneId
105
+ getCookieStub.withArgs(FUUID_COOKIE_NAME).returns(FUUID_DUMMY_VALUE);
106
+ getCookieStub.withArgs(AONEID_COOKIE_NAME).returns(AONEID_DUMMY_VALUE);
107
+ const id = dacIdSystemSubmodule.getId(configParamTestCase.params.oid[0]);
108
+ expect(id).to.be.deep.equal({
109
+ id: {
110
+ fuuid: FUUID_DUMMY_VALUE,
111
+ uid: AONEID_DUMMY_VALUE
112
+ }
113
+ });
114
+ });
38
115
  });
39
116
 
40
117
  describe('decode()', function () {
41
- it('should return the uid when it exists in cookie', function () {
118
+ it('should return fuuid & AoneId when they exist', function () {
42
119
  const decoded = dacIdSystemSubmodule.decode(DACID_DUMMY_OBJ);
43
- expect(decoded).to.be.deep.equal({dacId: {id: DACID_DUMMY_VALUE}});
120
+ expect(decoded).to.be.deep.equal({
121
+ dacId: {
122
+ fuuid: FUUID_DUMMY_VALUE,
123
+ id: AONEID_DUMMY_VALUE
124
+ }
125
+ });
44
126
  });
45
127
 
46
128
  it('should return the undefined when decode id is not "string"', function () {