From 4f805775ab1f36477a7b1e777309195e265ac892 Mon Sep 17 00:00:00 2001 From: Komal Kumari Date: Wed, 28 May 2025 12:26:30 +0530 Subject: [PATCH 1/5] Add depraction warning for getAllPrebidWinningBids API (cherry picked from commit 133b0af724536b9cd550eb928400ee689b80cff8) --- src/prebid.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/prebid.js b/src/prebid.js index ee511e5378b..fd9b59688a6 100644 --- a/src/prebid.js +++ b/src/prebid.js @@ -938,6 +938,7 @@ pbjsInstance.getAllWinningBids = function () { * @return {Array} A list of bids that have won their respective auctions. */ pbjsInstance.getAllPrebidWinningBids = function () { + logWarn('getAllPrebidWinningBids will be deprecated in a future version. Consider Using getAllWinningBids.'); return auctionManager.getBidsReceived() .filter(bid => bid.status === BID_STATUS.BID_TARGETING_SET); }; From 3a1a8b46f1de140bf60575d47bd2b7ca863edc76 Mon Sep 17 00:00:00 2001 From: Patrick McCann Date: Wed, 28 May 2025 08:22:55 -0400 Subject: [PATCH 2/5] Update prebid.js --- src/prebid.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/prebid.js b/src/prebid.js index fd9b59688a6..9b1dc64f289 100644 --- a/src/prebid.js +++ b/src/prebid.js @@ -935,6 +935,7 @@ pbjsInstance.getAllWinningBids = function () { /** * Get all of the bids that have won their respective auctions. + * @deprecated * @return {Array} A list of bids that have won their respective auctions. */ pbjsInstance.getAllPrebidWinningBids = function () { From 3e6b3a275352e2b0781ecf543bd6a0037aab6ea4 Mon Sep 17 00:00:00 2001 From: Patrick McCann Date: Wed, 28 May 2025 08:24:36 -0400 Subject: [PATCH 3/5] Update pbjs_api_spec.js --- test/spec/unit/pbjs_api_spec.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/test/spec/unit/pbjs_api_spec.js b/test/spec/unit/pbjs_api_spec.js index 659f3599248..32c4b0c9a1a 100644 --- a/test/spec/unit/pbjs_api_spec.js +++ b/test/spec/unit/pbjs_api_spec.js @@ -3882,7 +3882,7 @@ describe('Unit: Prebid Module', function () { auctionManagerStub.restore(); }); - it('should return prebid auction winning bids', function () { + it('should warn and return prebid auction winning bids', function () { let bidsReceived = [ createBidReceived({bidder: 'appnexus', cpm: 7, auctionId: 1, responseTimestamp: 100, adUnitCode: 'code-0', adId: 'adid-1', status: 'targetingSet', requestId: 'reqid-1'}), createBidReceived({bidder: 'rubicon', cpm: 6, auctionId: 1, responseTimestamp: 101, adUnitCode: 'code-1', adId: 'adid-2', requestId: 'reqid-2'}), @@ -3892,8 +3892,9 @@ describe('Unit: Prebid Module', function () { auctionManagerStub.returns(bidsReceived) let bids = $$PREBID_GLOBAL$$.getAllPrebidWinningBids(); - expect(bids.length).to.equal(1); sandbox + expect(bids.length).to.equal(1); expect(bids[0].adId).to.equal('adid-1'); + sinon.assert.calledOnce(logWarnSpy); }); }); From 035bce5d304f78da673af08e7aa4827795aab717 Mon Sep 17 00:00:00 2001 From: Patrick McCann Date: Wed, 28 May 2025 08:26:35 -0400 Subject: [PATCH 4/5] Update pbjs_api_spec.js --- test/spec/unit/pbjs_api_spec.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/test/spec/unit/pbjs_api_spec.js b/test/spec/unit/pbjs_api_spec.js index 32c4b0c9a1a..4827f8f7d21 100644 --- a/test/spec/unit/pbjs_api_spec.js +++ b/test/spec/unit/pbjs_api_spec.js @@ -3874,12 +3874,15 @@ describe('Unit: Prebid Module', function () { describe('getAllPrebidWinningBids', function () { let auctionManagerStub; + let logWarnSpy; beforeEach(function () { auctionManagerStub = sinon.stub(auctionManager, 'getBidsReceived'); + logWarnSpy = sandbox.spy(utils, 'logWarn'); }); afterEach(function () { auctionManagerStub.restore(); + logWarnSpy.restore(); }); it('should warn and return prebid auction winning bids', function () { From 780930c537bd2f091e6a2352e271f841709db27f Mon Sep 17 00:00:00 2001 From: Patrick McCann Date: Wed, 28 May 2025 08:34:31 -0400 Subject: [PATCH 5/5] Update prebid.js --- src/prebid.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/prebid.js b/src/prebid.js index 9b1dc64f289..bf11f56d5dd 100644 --- a/src/prebid.js +++ b/src/prebid.js @@ -936,10 +936,10 @@ pbjsInstance.getAllWinningBids = function () { /** * Get all of the bids that have won their respective auctions. * @deprecated - * @return {Array} A list of bids that have won their respective auctions. + * @return {Array} A list of bids that have won their respective auctions but failed to win the ad server auction. */ pbjsInstance.getAllPrebidWinningBids = function () { - logWarn('getAllPrebidWinningBids will be deprecated in a future version. Consider Using getAllWinningBids.'); + logWarn('getAllPrebidWinningBids may be removed or renamed in a future version. This function returns bids that have won in prebid and have had targeting set but have not (yet?) won in the ad server. It excludes bids that have been rendered.'); return auctionManager.getBidsReceived() .filter(bid => bid.status === BID_STATUS.BID_TARGETING_SET); };