diff --git a/modules/impactifyBidAdapter.js b/modules/impactifyBidAdapter.js index f446050265a..04a45e64b19 100644 --- a/modules/impactifyBidAdapter.js +++ b/modules/impactifyBidAdapter.js @@ -17,7 +17,7 @@ const AUCTION_URI = '/bidder'; const COOKIE_SYNC_URI = '/static/cookie_sync.html'; const GVL_ID = 606; const GET_CONFIG = config.getConfig; -export const STORAGE = getStorageManager({gvlid: GVL_ID, bidderCode: BIDDER_CODE}); +export const STORAGE = getStorageManager({ gvlid: GVL_ID, bidderCode: BIDDER_CODE }); export const STORAGE_KEY = '_im_str' /** @@ -114,7 +114,7 @@ function createOpenRtbRequest(validBidRequests, bidderRequest) { validBidRequests, cur: [DEFAULT_CURRENCY], imp: [], - source: {tid: bidderRequest.ortb2?.source?.tid} + source: { tid: bidderRequest.ortb2?.source?.tid } }; // Get the url parameters @@ -149,7 +149,7 @@ function createOpenRtbRequest(validBidRequests, bidderRequest) { dnt: (navigator.doNotTrack == 'yes' || navigator.doNotTrack == '1' || navigator.msDoNotTrack == '1') ? 1 : 0, language: ((navigator.language || navigator.userLanguage || '').split('-'))[0] || 'en', }; - request.site = {page: bidderRequest.refererInfo.page}; + request.site = { page: bidderRequest.refererInfo.page }; // Handle privacy settings for GDPR/CCPA/COPPA let gdprApplies = 0; @@ -176,7 +176,6 @@ function createOpenRtbRequest(validBidRequests, bidderRequest) { // Create imps with bids validBidRequests.forEach((bid) => { let bannerObj = deepAccess(bid.mediaTypes, `banner`); - let videoObj = deepAccess(bid.mediaTypes, `video`); let imp = { id: bid.bidId, @@ -184,16 +183,14 @@ function createOpenRtbRequest(validBidRequests, bidderRequest) { ext: helpers.getExtParamsFromBid(bid) }; - if (videoObj) { - imp.video = { - ...helpers.createOrtbImpVideoObj(bid) - } - } - if (bannerObj && typeof imp.ext.impactify.size == 'string') { imp.banner = { ...helpers.createOrtbImpBannerObj(bid, imp.ext.impactify.size) } + } else { + imp.video = { + ...helpers.createOrtbImpVideoObj(bid) + } } if (typeof bid.getFloor === 'function') { @@ -227,8 +224,6 @@ export const spec = { * @return boolean True if this is a valid bid, and false otherwise. */ isBidRequestValid: function (bid) { - let isBanner = deepAccess(bid.mediaTypes, `banner`); - if (typeof bid.params.appId != 'string' || !bid.params.appId) { return false; } @@ -241,9 +236,6 @@ export const spec = { if (bid.params.style !== 'inline' && bid.params.style !== 'impact' && bid.params.style !== 'static') { return false; } - if (isBanner && (typeof bid.params.size != 'string' || !bid.params.size.includes('x') || bid.params.size.split('x').length != 2)) { - return false; - } return true; }, @@ -369,7 +361,7 @@ export const spec = { * Register bidder specific code, which will execute if a bid from this bidder won the auction * @param {Bid} The bid that won the auction */ - onBidWon: function(bid) { + onBidWon: function (bid) { ajax(`${LOGGER_URI}/prebid/won`, null, JSON.stringify(bid), { method: 'POST', contentType: 'application/json' @@ -382,7 +374,7 @@ export const spec = { * Register bidder specific code, which will execute if bidder timed out after an auction * @param {data} Containing timeout specific data */ - onTimeout: function(data) { + onTimeout: function (data) { ajax(`${LOGGER_URI}/prebid/timeout`, null, JSON.stringify(data[0]), { method: 'POST', contentType: 'application/json' diff --git a/test/spec/modules/impactifyBidAdapter_spec.js b/test/spec/modules/impactifyBidAdapter_spec.js index adf968d610d..d9bf4becb22 100644 --- a/test/spec/modules/impactifyBidAdapter_spec.js +++ b/test/spec/modules/impactifyBidAdapter_spec.js @@ -36,7 +36,7 @@ describe('ImpactifyAdapter', function () { localStorageIsEnabledStub = sandbox.stub(STORAGE, 'localStorageIsEnabled'); }); - afterEach(function() { + afterEach(function () { $$PREBID_GLOBAL$$.bidderSettings = {}; document.body.appendChild.restore(); sandbox.restore(); @@ -57,7 +57,6 @@ describe('ImpactifyAdapter', function () { params: { appId: 'example.com', format: 'display', - size: '728x90', style: 'static' } } @@ -282,7 +281,7 @@ describe('ImpactifyAdapter', function () { }; it('should pass bidfloor', function () { - videoBidRequests[0].getFloor = function() { + videoBidRequests[0].getFloor = function () { return { currency: 'USD', floor: 1.23, @@ -342,7 +341,7 @@ describe('ImpactifyAdapter', function () { h: 1, hash: 'test', expiry: 166192938, - meta: {'advertiserDomains': ['testdomain.com']}, + meta: { 'advertiserDomains': ['testdomain.com'] }, ext: { prebid: { 'type': 'video' @@ -418,7 +417,7 @@ describe('ImpactifyAdapter', function () { height: 1, hash: 'test', expiry: 166192938, - meta: {'advertiserDomains': ['testdomain.com']}, + meta: { 'advertiserDomains': ['testdomain.com'] }, ttl: 300, creativeId: '97517771' } @@ -480,7 +479,7 @@ describe('ImpactifyAdapter', function () { h: 1, hash: 'test', expiry: 166192938, - meta: {'advertiserDomains': ['testdomain.com']}, + meta: { 'advertiserDomains': ['testdomain.com'] }, ext: { prebid: { 'type': 'video' @@ -536,8 +535,8 @@ describe('ImpactifyAdapter', function () { const result = spec.getUserSyncs('bad', [], gdprData); expect(result).to.be.empty; }); - it('should append the various values if they exist', function() { - const result = spec.getUserSyncs({iframeEnabled: true}, validResponse, gdprData); + it('should append the various values if they exist', function () { + const result = spec.getUserSyncs({ iframeEnabled: true }, validResponse, gdprData); expect(result[0].url).to.include('gdpr=1'); expect(result[0].url).to.include('gdpr_consent=BOh7mtYOh7mtYAcABBENCU-AAAAncgPIXJiiAoao0PxBFkgCAC8ACIAAQAQQAAIAAAIAAAhBGAAAQAQAEQgAAAAAAABAAAAAAAAAAAAAAACAAAAAAAACgAAAAABAAAAQAAAAAAA'); });