From e388cc3811c37c5d5dd1e7037121ad1d54d09ddc Mon Sep 17 00:00:00 2001 From: Jeremy Sadwith Date: Fri, 14 Apr 2023 17:34:10 -0400 Subject: [PATCH 01/10] KargoBidAdapter: GPP Support --- modules/kargoBidAdapter.js | 26 +++++++++++++++++++---- test/spec/modules/kargoBidAdapter_spec.js | 21 ++++++++++-------- 2 files changed, 34 insertions(+), 13 deletions(-) diff --git a/modules/kargoBidAdapter.js b/modules/kargoBidAdapter.js index ecc40b26aa2..b612c88bb12 100644 --- a/modules/kargoBidAdapter.js +++ b/modules/kargoBidAdapter.js @@ -47,7 +47,7 @@ const SUA_ATTRIBUTES = [ const CERBERUS = Object.freeze({ KEY: 'krg_crb', - SYNC_URL: 'https://crb.kargo.com/api/v1/initsyncrnd/{UUID}?seed={SEED}&idx={INDEX}&gdpr={GDPR}&gdpr_consent={GDPR_CONSENT}&us_privacy={US_PRIVACY}', + SYNC_URL: 'https://crb.kargo.com/api/v1/initsyncrnd/{UUID}?seed={SEED}&idx={INDEX}&gdpr={GDPR}&gdpr_consent={GDPR_CONSENT}&us_privacy={US_PRIVACY}&gpp={GPP_STRING}&gpp_sid={GPP_SID}', SYNC_COUNT: 5, PAGE_VIEW_ID: 'pageViewId', PAGE_VIEW_TIMESTAMP: 'pageViewTimestamp', @@ -94,7 +94,7 @@ function buildRequests(validBidRequests, bidderRequest) { ] }, imp: impressions, - user: getUserIds(tdidAdapter, bidderRequest.uspConsent, bidderRequest.gdprConsent, firstBidRequest.userIdAsEids), + user: getUserIds(tdidAdapter, bidderRequest.uspConsent, bidderRequest.gdprConsent, firstBidRequest.userIdAsEids, bidderRequest.gppConsent), }); const reqCount = getRequestCount() @@ -229,7 +229,7 @@ function interpretResponse(response, bidRequest) { return bidResponses; } -function getUserSyncs(syncOptions, responses, gdprConsent, usPrivacy) { +function getUserSyncs(syncOptions, _, gdprConsent, usPrivacy, gppConsent) { const syncs = []; const seed = _generateRandomUUID(); const clientId = getClientId(); @@ -237,6 +237,9 @@ function getUserSyncs(syncOptions, responses, gdprConsent, usPrivacy) { var gdpr = (gdprConsent && gdprConsent.gdprApplies) ? 1 : 0; var gdprConsentString = (gdprConsent && gdprConsent.consentString) ? gdprConsent.consentString : ''; + var gppString = (gppConsent && gppConsent.consentString) ? gppConsent.consentString : ''; + var gppApplicableSections = (gppConsent && gppConsent.applicableSections && Array.isArray(gppConsent.applicableSections)) ? gppConsent.applicableSections.join(',') : ''; + // don't sync if opted out via usPrivacy if (typeof usPrivacy == 'string' && usPrivacy.length == 4 && usPrivacy[0] == 1 && usPrivacy[2] == 'Y') { return syncs; @@ -251,6 +254,8 @@ function getUserSyncs(syncOptions, responses, gdprConsent, usPrivacy) { .replace('{GDPR}', gdpr) .replace('{GDPR_CONSENT}', gdprConsentString) .replace('{US_PRIVACY}', usPrivacy || '') + .replace('{GPP_STRING}', gppString) + .replace('{GPP_SID}', gppApplicableSections) }); } } @@ -329,7 +334,7 @@ function getLocalStorageSafely(key) { } } -function getUserIds(tdidAdapter, usp, gdpr, eids) { +function getUserIds(tdidAdapter, usp, gdpr, eids, gpp) { const crb = spec._getCrb(); const userIds = { crbIDs: crb.syncIds || {} @@ -375,6 +380,19 @@ function getUserIds(tdidAdapter, usp, gdpr, eids) { userIds.sharedIDEids = eids; } + if (gpp) { + const parsedGPP = {} + if (gpp && gpp.consentString) { + parsedGPP.gppString = gpp.consentString + } + if (gpp && gpp.applicableSections) { + parsedGPP.applicableSections = gpp.applicableSections + } + if (!isEmpty(parsedGPP)) { + userIds.gpp = parsedGPP + } + } + return userIds; } diff --git a/test/spec/modules/kargoBidAdapter_spec.js b/test/spec/modules/kargoBidAdapter_spec.js index 260ac6c2132..d692cc67e26 100644 --- a/test/spec/modules/kargoBidAdapter_spec.js +++ b/test/spec/modules/kargoBidAdapter_spec.js @@ -524,9 +524,7 @@ describe('kargo adapter tests', function () { } const reqCount = requestCount++; - if (reqCount > 0) { - base.requestCount = reqCount - } + base.requestCount = reqCount if (expectedCRB != null) { if (expectedCRB.rawCRB != null) { @@ -894,8 +892,8 @@ describe('kargo adapter tests', function () { }); }); - function getUserSyncsWhenAllowed(gdprConsent, usPrivacy) { - return spec.getUserSyncs({iframeEnabled: true}, null, gdprConsent, usPrivacy); + function getUserSyncsWhenAllowed(gdprConsent, usPrivacy, gppConsent) { + return spec.getUserSyncs({iframeEnabled: true}, null, gdprConsent, usPrivacy, gppConsent); } function getUserSyncsWhenForbidden() { @@ -910,17 +908,17 @@ describe('kargo adapter tests', function () { shouldSimulateOutdatedBrowser = true; } - function getSyncUrl(index, gdprApplies, gdprConsentString, usPrivacy) { + function getSyncUrl(index, gdprApplies, gdprConsentString, usPrivacy, gpp, gppSid) { return { type: 'iframe', - url: `https://crb.kargo.com/api/v1/initsyncrnd/${clientId}?seed=3205e885-8d37-4139-b47e-f82cff268000&idx=${index}&gdpr=${gdprApplies}&gdpr_consent=${gdprConsentString}&us_privacy=${usPrivacy}` + url: `https://crb.kargo.com/api/v1/initsyncrnd/${clientId}?seed=3205e885-8d37-4139-b47e-f82cff268000&idx=${index}&gdpr=${gdprApplies}&gdpr_consent=${gdprConsentString}&us_privacy=${usPrivacy}&gpp=${gpp}&gpp_sid=${gppSid}` }; } - function getSyncUrls(gdprApplies, gdprConsentString, usPrivacy) { + function getSyncUrls(gdprApplies, gdprConsentString, usPrivacy, gpp, gppSid) { var syncs = []; for (var i = 0; i < 5; i++) { - syncs[i] = getSyncUrl(i, gdprApplies || 0, gdprConsentString || '', usPrivacy || ''); + syncs[i] = getSyncUrl(i, gdprApplies || 0, gdprConsentString || '', usPrivacy || '', gpp || '', gppSid || ''); } return syncs; } @@ -957,6 +955,11 @@ describe('kargo adapter tests', function () { safelyRun(() => expect(getUserSyncsWhenAllowed({ gdprApplies: true, consentString: 'consentstring' })).to.deep.equal(getSyncUrls(1, 'consentstring', ''))); }); + it('pass through gpp consent', function () { + turnOnClientId(); + safelyRun(() => expect(getUserSyncsWhenAllowed(null, null, { consentString: 'gppString', applicableSections: [-1] })).to.deep.equal(getSyncUrls('', '', '', 'gppString', '-1'))); + }); + it('no user syncs when there is outdated browser', function() { turnOnClientId(); simulateOutdatedBrowser(); From b03324ac6507f6ea7363c1103d4eae0e298ce377 Mon Sep 17 00:00:00 2001 From: Julian Gan Date: Mon, 10 Jul 2023 16:24:52 -0400 Subject: [PATCH 02/10] kargo adapter to forward schain object (#21) --- modules/kargoBidAdapter.js | 1 + 1 file changed, 1 insertion(+) diff --git a/modules/kargoBidAdapter.js b/modules/kargoBidAdapter.js index b612c88bb12..743c3805a49 100644 --- a/modules/kargoBidAdapter.js +++ b/modules/kargoBidAdapter.js @@ -95,6 +95,7 @@ function buildRequests(validBidRequests, bidderRequest) { }, imp: impressions, user: getUserIds(tdidAdapter, bidderRequest.uspConsent, bidderRequest.gdprConsent, firstBidRequest.userIdAsEids, bidderRequest.gppConsent), + schain: firstBidRequest.schain, }); const reqCount = getRequestCount() From a901875f48df50a3c5a7474875e34ae1be2d515c Mon Sep 17 00:00:00 2001 From: Julian Gan Date: Tue, 11 Jul 2023 09:56:48 -0400 Subject: [PATCH 03/10] wrap in if statement (#22) --- modules/kargoBidAdapter.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/modules/kargoBidAdapter.js b/modules/kargoBidAdapter.js index b864b42fd66..1dde4453222 100644 --- a/modules/kargoBidAdapter.js +++ b/modules/kargoBidAdapter.js @@ -95,9 +95,12 @@ function buildRequests(validBidRequests, bidderRequest) { }, imp: impressions, user: getUserIds(tdidAdapter, bidderRequest.uspConsent, bidderRequest.gdprConsent, firstBidRequest.userIdAsEids, bidderRequest.gppConsent), - schain: firstBidRequest.schain, }); + if (firstBidRequest.schain && firstBidRequest.schain.nodes) { + krakenParams.schain = firstBidRequest.schain + } + const reqCount = getRequestCount() if (reqCount != null) { krakenParams.requestCount = reqCount; From cf27337877d50343cae568d183a35906772801a3 Mon Sep 17 00:00:00 2001 From: Julian Gan Date: Tue, 11 Jul 2023 17:50:33 -0400 Subject: [PATCH 04/10] KRKPD-572: Add spec for schain (#23) * wrap in if statement * update test for schain, file formatting --- test/spec/modules/kargoBidAdapter_spec.js | 227 ++++++++++++---------- 1 file changed, 121 insertions(+), 106 deletions(-) diff --git a/test/spec/modules/kargoBidAdapter_spec.js b/test/spec/modules/kargoBidAdapter_spec.js index dae2640d224..9f7a4854063 100644 --- a/test/spec/modules/kargoBidAdapter_spec.js +++ b/test/spec/modules/kargoBidAdapter_spec.js @@ -1,10 +1,21 @@ -import {expect, assert} from 'chai'; -import {spec} from 'modules/kargoBidAdapter.js'; -import {config} from 'src/config.js'; +import { expect, assert } from 'chai'; +import { spec } from 'modules/kargoBidAdapter.js'; +import { config } from 'src/config.js'; const utils = require('src/utils'); describe('kargo adapter tests', function () { var sandbox, clock, frozenNow = new Date(); + const testSchain = { + complete: 1, + nodes: [ + { + 'asi': 'test-page.com', + 'hp': 1, + 'rid': '57bdd953-6e57-4d5b-9351-ed67ca238890', + 'sid': '8190248274' + } + ] + } beforeEach(function () { sandbox = sinon.sandbox.create(); @@ -16,25 +27,25 @@ describe('kargo adapter tests', function () { clock.restore(); }); - describe('bid request validity', function() { - it('passes when the bid includes a placement ID', function() { - assert(spec.isBidRequestValid({params: {placementId: 'foo'}}) === true); + describe('bid request validity', function () { + it('passes when the bid includes a placement ID', function () { + assert(spec.isBidRequestValid({ params: { placementId: 'foo' } }) === true); }); - it('fails when the bid does not include a placement ID', function() { - assert(spec.isBidRequestValid({params: {}}) === false); + it('fails when the bid does not include a placement ID', function () { + assert(spec.isBidRequestValid({ params: {} }) === false); }); - it('fails when bid is falsey', function() { + it('fails when bid is falsey', function () { assert(spec.isBidRequestValid() === false); }); - it('fails when the bid has no params at all', function() { + it('fails when the bid has no params at all', function () { assert(spec.isBidRequestValid({}) === false); }); }); - describe('build request', function() { + describe('build request', function () { var bids, undefinedCurrency, noAdServerCurrency, nonUSDAdServerCurrency, cookies = [], localStorageItems = [], sessionIds = [], requestCount = 0; beforeEach(function () { @@ -46,7 +57,7 @@ describe('kargo adapter tests', function () { undefinedCurrency = false; noAdServerCurrency = false; nonUSDAdServerCurrency = false; - sandbox.stub(config, 'getConfig').callsFake(function(key) { + sandbox.stub(config, 'getConfig').callsFake(function (key) { if (key === 'currency') { if (undefinedCurrency) { return undefined; @@ -55,9 +66,9 @@ describe('kargo adapter tests', function () { return {}; } if (nonUSDAdServerCurrency) { - return {adServerCurrency: 'EUR'}; + return { adServerCurrency: 'EUR' }; } - return {adServerCurrency: 'USD'}; + return { adServerCurrency: 'USD' }; } if (key === 'debug') return true; if (key === 'deviceAccess') return true; @@ -85,6 +96,7 @@ describe('kargo adapter tests', function () { bidRequestsCount: 1, bidderRequestsCount: 2, bidderWinsCount: 3, + schain: testSchain, userId: { tdid: 'ed1562d5-e52b-406f-8e65-e5ab3ed5583c' }, @@ -110,20 +122,20 @@ describe('kargo adapter tests', function () { sua: { platform: { brand: 'macOS', - version: [ '12', '6', '0' ] + version: ['12', '6', '0'] }, browsers: [ { brand: 'Chromium', - version: [ '106', '0', '5249', '119' ] + version: ['106', '0', '5249', '119'] }, { brand: 'Google Chrome', - version: [ '106', '0', '5249', '119' ] + version: ['106', '0', '5249', '119'] }, { brand: 'Not;A=Brand', - version: [ '99', '0', '0', '0' ] + version: ['99', '0', '0', '0'] } ], mobile: 1, @@ -397,6 +409,7 @@ describe('kargo adapter tests', function () { url: 'https://www.prebid.org', timeout: 200, ts: frozenNow.getTime(), + schain: testSchain, device: { size: [ screen.width, @@ -405,20 +418,20 @@ describe('kargo adapter tests', function () { sua: { platform: { brand: 'macOS', - version: [ '12', '6', '0' ] + version: ['12', '6', '0'] }, browsers: [ { brand: 'Chromium', - version: [ '106', '0', '5249', '119' ] + version: ['106', '0', '5249', '119'] }, { brand: 'Google Chrome', - version: [ '106', '0', '5249', '119' ] + version: ['106', '0', '5249', '119'] }, { brand: 'Not;A=Brand', - version: [ '99', '0', '0', '0' ] + version: ['99', '0', '0', '0'] } ], mobile: 1, @@ -571,84 +584,84 @@ describe('kargo adapter tests', function () { } } - it('works when all params and localstorage and cookies are correctly set', function() { + it('works when all params and localstorage and cookies are correctly set', function () { initializeKrgCrb(); initializePageView(); testBuildRequests(getExpectedKrakenParams(generateRawCRB(getKrgCrbOldStyle(), getKrgCrb()), generatePageView())); }); - it('works when all params and cookies are correctly set but no localstorage', function() { + it('works when all params and cookies are correctly set but no localstorage', function () { initializeKrgCrb(true); testBuildRequests(getExpectedKrakenParams(generateRawCRB(getKrgCrbOldStyle()))); }); - it('gracefully handles nothing being set', function() { + it('gracefully handles nothing being set', function () { testBuildRequests(getExpectedKrakenParams(undefined, undefined, true)); }); - it('gracefully handles browsers without localStorage', function() { + it('gracefully handles browsers without localStorage', function () { simulateNoLocalStorage(); testBuildRequests(getExpectedKrakenParams(undefined, undefined, true)); }); - it('handles empty yet valid Kargo CRB', function() { + it('handles empty yet valid Kargo CRB', function () { initializeEmptyKrgCrb(); initializeEmptyKrgCrbCookie(); initializePageView(); testBuildRequests(getExpectedKrakenParams(generateRawCRB(getEmptyKrgCrbOldStyle(), getEmptyKrgCrb()), generatePageView(), true)); }); - it('handles broken Kargo CRBs where base64 encoding is invalid', function() { + it('handles broken Kargo CRBs where base64 encoding is invalid', function () { initializeInvalidKrgCrbType1(); initializePageView(); testBuildRequests(getExpectedKrakenParams(generateRawCRB(undefined, getInvalidKrgCrbType1()), generatePageView(), true)); }); - it('handles broken Kargo CRBs where top level JSON is invalid on cookie', function() { + it('handles broken Kargo CRBs where top level JSON is invalid on cookie', function () { initializeInvalidKrgCrbType1Cookie(); initializePageView(); testBuildRequests(getExpectedKrakenParams(generateRawCRB(getInvalidKrgCrbType1()), generatePageView(), true)); }); - it('handles broken Kargo CRBs where decoded JSON is invalid', function() { + it('handles broken Kargo CRBs where decoded JSON is invalid', function () { initializeInvalidKrgCrbType2(); initializePageView(); testBuildRequests(getExpectedKrakenParams(generateRawCRB(undefined, getInvalidKrgCrbType2()), generatePageView(), true)); }); - it('handles broken Kargo CRBs where inner base 64 is invalid on cookie', function() { + it('handles broken Kargo CRBs where inner base 64 is invalid on cookie', function () { initializeInvalidKrgCrbType2Cookie(); initializePageView(); testBuildRequests(getExpectedKrakenParams(generateRawCRB(getInvalidKrgCrbType2OldStyle()), generatePageView(), true)); }); - it('handles broken Kargo CRBs where inner JSON is invalid on cookie', function() { + it('handles broken Kargo CRBs where inner JSON is invalid on cookie', function () { initializeInvalidKrgCrbType3Cookie(); initializePageView(); testBuildRequests(getExpectedKrakenParams(generateRawCRB(getInvalidKrgCrbType3OldStyle()), generatePageView(), true)); }); - it('handles broken Kargo CRBs where inner JSON is falsey', function() { + it('handles broken Kargo CRBs where inner JSON is falsey', function () { initializeInvalidKrgCrbType4Cookie(); initializePageView(); testBuildRequests(getExpectedKrakenParams(generateRawCRB(getInvalidKrgCrbType4OldStyle()), generatePageView(), true)); }); - it('handles a non-existant currency object on the config', function() { + it('handles a non-existant currency object on the config', function () { simulateNoCurrencyObject(); initializeKrgCrb(); initializePageView(); testBuildRequests(getExpectedKrakenParams(generateRawCRB(getKrgCrbOldStyle(), getKrgCrb()), generatePageView())); }); - it('handles no ad server currency being set on the currency object in the config', function() { + it('handles no ad server currency being set on the currency object in the config', function () { simulateNoAdServerCurrency(); initializeKrgCrb(); initializePageView(); testBuildRequests(getExpectedKrakenParams(generateRawCRB(getKrgCrbOldStyle(), getKrgCrb()), generatePageView())); }); - it('handles non-USD ad server currency being set on the currency object in the config', function() { + it('handles non-USD ad server currency being set on the currency object in the config', function () { simulateNonUSDAdServerCurrency(); initializeKrgCrb(); initializePageView(); @@ -663,67 +676,69 @@ describe('kargo adapter tests', function () { }); }); - describe('response handler', function() { - it('handles bid responses', function() { - var resp = spec.interpretResponse({body: { - 1: { - id: 'foo', - cpm: 3, - adm: '
', - width: 320, - height: 50, - metadata: {} - }, - 2: { - id: 'bar', - cpm: 2.5, - adm: '
', - width: 300, - height: 250, - targetingCustom: 'dmpmptest1234', - metadata: { - landingPageDomain: ['https://foobar.com'] + describe('response handler', function () { + it('handles bid responses', function () { + var resp = spec.interpretResponse({ + body: { + 1: { + id: 'foo', + cpm: 3, + adm: '
', + width: 320, + height: 50, + metadata: {} + }, + 2: { + id: 'bar', + cpm: 2.5, + adm: '
', + width: 300, + height: 250, + targetingCustom: 'dmpmptest1234', + metadata: { + landingPageDomain: ['https://foobar.com'] + } + }, + 3: { + id: 'bar', + cpm: 2.5, + adm: '
', + width: 300, + height: 250 + }, + 4: { + id: 'bar', + cpm: 2.5, + adm: '
', + width: 300, + height: 250, + mediaType: 'banner', + metadata: {}, + currency: 'EUR' + }, + 5: { + id: 'bar', + cpm: 2.5, + adm: '', + width: 300, + height: 250, + mediaType: 'video', + metadata: {}, + currency: 'EUR' + }, + 6: { + id: 'bar', + cpm: 2.5, + adm: '', + admUrl: 'https://foobar.com/vast_adm', + width: 300, + height: 250, + mediaType: 'video', + metadata: {}, + currency: 'EUR' } - }, - 3: { - id: 'bar', - cpm: 2.5, - adm: '
', - width: 300, - height: 250 - }, - 4: { - id: 'bar', - cpm: 2.5, - adm: '
', - width: 300, - height: 250, - mediaType: 'banner', - metadata: {}, - currency: 'EUR' - }, - 5: { - id: 'bar', - cpm: 2.5, - adm: '', - width: 300, - height: 250, - mediaType: 'video', - metadata: {}, - currency: 'EUR' - }, - 6: { - id: 'bar', - cpm: 2.5, - adm: '', - admUrl: 'https://foobar.com/vast_adm', - width: 300, - height: 250, - mediaType: 'video', - metadata: {}, - currency: 'EUR' } - }}, { + }, { currency: 'USD', bids: [{ bidId: 1, @@ -854,7 +869,7 @@ describe('kargo adapter tests', function () { }); }); - describe('user sync handler', function() { + describe('user sync handler', function () { const clientId = '74c81cbb-7d07-46d9-be9b-68ccb291c949'; var shouldSimulateOutdatedBrowser, crb, isActuallyOutdatedBrowser; @@ -875,7 +890,7 @@ describe('kargo adapter tests', function () { if (!window.crypto) { isActuallyOutdatedBrowser = true; } else { - sandbox.stub(crypto, 'getRandomValues').callsFake(function(buf) { + sandbox.stub(crypto, 'getRandomValues').callsFake(function (buf) { if (shouldSimulateOutdatedBrowser) { throw new Error('Could not generate random values'); } @@ -887,13 +902,13 @@ describe('kargo adapter tests', function () { }); } - sandbox.stub(spec, '_getCrb').callsFake(function() { + sandbox.stub(spec, '_getCrb').callsFake(function () { return crb; }); }); function getUserSyncsWhenAllowed(gdprConsent, usPrivacy, gppConsent) { - return spec.getUserSyncs({iframeEnabled: true}, null, gdprConsent, usPrivacy, gppConsent); + return spec.getUserSyncs({ iframeEnabled: true }, null, gdprConsent, usPrivacy, gppConsent); } function getUserSyncsWhenForbidden() { @@ -931,26 +946,26 @@ describe('kargo adapter tests', function () { } } - it('handles user syncs when there is a client id', function() { + it('handles user syncs when there is a client id', function () { turnOnClientId(); safelyRun(() => expect(getUserSyncsWhenAllowed()).to.deep.equal(getSyncUrls())); }); - it('no user syncs when there is no client id', function() { + it('no user syncs when there is no client id', function () { safelyRun(() => expect(getUserSyncsWhenAllowed()).to.be.an('array').that.is.empty); }); - it('no user syncs when there is no us privacy consent', function() { + it('no user syncs when there is no us privacy consent', function () { turnOnClientId(); safelyRun(() => expect(getUserSyncsWhenAllowed(null, '1YYY')).to.be.an('array').that.is.empty); }); - it('pass through us privacy consent', function() { + it('pass through us privacy consent', function () { turnOnClientId(); safelyRun(() => expect(getUserSyncsWhenAllowed(null, '1YNY')).to.deep.equal(getSyncUrls(0, '', '1YNY'))); }); - it('pass through gdpr consent', function() { + it('pass through gdpr consent', function () { turnOnClientId(); safelyRun(() => expect(getUserSyncsWhenAllowed({ gdprApplies: true, consentString: 'consentstring' })).to.deep.equal(getSyncUrls(1, 'consentstring', ''))); }); @@ -960,13 +975,13 @@ describe('kargo adapter tests', function () { safelyRun(() => expect(getUserSyncsWhenAllowed(null, null, { consentString: 'gppString', applicableSections: [-1] })).to.deep.equal(getSyncUrls('', '', '', 'gppString', '-1'))); }); - it('no user syncs when there is outdated browser', function() { + it('no user syncs when there is outdated browser', function () { turnOnClientId(); simulateOutdatedBrowser(); safelyRun(() => expect(getUserSyncsWhenAllowed()).to.be.an('array').that.is.empty); }); - it('no user syncs when no iframe syncing allowed', function() { + it('no user syncs when no iframe syncing allowed', function () { turnOnClientId(); safelyRun(() => expect(getUserSyncsWhenForbidden()).to.be.an('array').that.is.empty); }); From 85145c07cf2c096622253333264dabcdd2c37669 Mon Sep 17 00:00:00 2001 From: Neil Flynn Date: Mon, 2 Oct 2023 19:04:39 +0100 Subject: [PATCH 05/10] Adding site to Kargo adapter. --- modules/kargoBidAdapter.js | 1 + test/spec/modules/kargoBidAdapter_spec.js | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/modules/kargoBidAdapter.js b/modules/kargoBidAdapter.js index 1dde4453222..835f2ec9d71 100644 --- a/modules/kargoBidAdapter.js +++ b/modules/kargoBidAdapter.js @@ -95,6 +95,7 @@ function buildRequests(validBidRequests, bidderRequest) { }, imp: impressions, user: getUserIds(tdidAdapter, bidderRequest.uspConsent, bidderRequest.gdprConsent, firstBidRequest.userIdAsEids, bidderRequest.gppConsent), + site: firstBidRequest.site }); if (firstBidRequest.schain && firstBidRequest.schain.nodes) { diff --git a/test/spec/modules/kargoBidAdapter_spec.js b/test/spec/modules/kargoBidAdapter_spec.js index 9f7a4854063..9a7e9898dc3 100644 --- a/test/spec/modules/kargoBidAdapter_spec.js +++ b/test/spec/modules/kargoBidAdapter_spec.js @@ -144,6 +144,10 @@ describe('kargo adapter tests', function () { } } }, + site: { + id: '1234', + name: 'SiteName' + }, ortb2Imp: { ext: { tid: '10101', @@ -439,6 +443,10 @@ describe('kargo adapter tests', function () { source: 1 }, }, + site: { + id: '1234', + name: 'SiteName' + }, imp: [ { code: '101', From 5477a26701b380f195302d258c747e996382bf5f Mon Sep 17 00:00:00 2001 From: Neil Flynn Date: Wed, 4 Oct 2023 12:34:44 +0100 Subject: [PATCH 06/10] KRKPD-619 Updating Site object. --- modules/kargoBidAdapter.js | 2 +- test/spec/modules/kargoBidAdapter_spec.js | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/modules/kargoBidAdapter.js b/modules/kargoBidAdapter.js index 835f2ec9d71..feb4aac6896 100644 --- a/modules/kargoBidAdapter.js +++ b/modules/kargoBidAdapter.js @@ -95,7 +95,7 @@ function buildRequests(validBidRequests, bidderRequest) { }, imp: impressions, user: getUserIds(tdidAdapter, bidderRequest.uspConsent, bidderRequest.gdprConsent, firstBidRequest.userIdAsEids, bidderRequest.gppConsent), - site: firstBidRequest.site + site: firstBidRequest.ortb2.site }); if (firstBidRequest.schain && firstBidRequest.schain.nodes) { diff --git a/test/spec/modules/kargoBidAdapter_spec.js b/test/spec/modules/kargoBidAdapter_spec.js index 9a7e9898dc3..4d1b7da2ad5 100644 --- a/test/spec/modules/kargoBidAdapter_spec.js +++ b/test/spec/modules/kargoBidAdapter_spec.js @@ -142,12 +142,12 @@ describe('kargo adapter tests', function () { model: 'model', source: 1, } + }, + site: { + id: '1234', + name: 'SiteName' } }, - site: { - id: '1234', - name: 'SiteName' - }, ortb2Imp: { ext: { tid: '10101', From 1e4221d2f4726f905e4950ad176fc615b1d3ad77 Mon Sep 17 00:00:00 2001 From: Neil Flynn Date: Wed, 4 Oct 2023 13:51:53 +0100 Subject: [PATCH 07/10] KRKPD-619 Adding null check for Site object. --- modules/kargoBidAdapter.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/modules/kargoBidAdapter.js b/modules/kargoBidAdapter.js index feb4aac6896..f533fdc5b1d 100644 --- a/modules/kargoBidAdapter.js +++ b/modules/kargoBidAdapter.js @@ -95,9 +95,12 @@ function buildRequests(validBidRequests, bidderRequest) { }, imp: impressions, user: getUserIds(tdidAdapter, bidderRequest.uspConsent, bidderRequest.gdprConsent, firstBidRequest.userIdAsEids, bidderRequest.gppConsent), - site: firstBidRequest.ortb2.site }); + if (firstBidRequest.ortb2.site != null) { + krakenParams.site = firstBidRequest.ortb2.site + } + if (firstBidRequest.schain && firstBidRequest.schain.nodes) { krakenParams.schain = firstBidRequest.schain } From 2d99f1900ff8ff03a6cfa805b292cbdf4d27e86f Mon Sep 17 00:00:00 2001 From: Neil Flynn Date: Wed, 4 Oct 2023 14:19:24 +0100 Subject: [PATCH 08/10] Update modules/kargoBidAdapter.js Co-authored-by: Julian Gan --- modules/kargoBidAdapter.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/kargoBidAdapter.js b/modules/kargoBidAdapter.js index f533fdc5b1d..0ee830a611b 100644 --- a/modules/kargoBidAdapter.js +++ b/modules/kargoBidAdapter.js @@ -97,7 +97,7 @@ function buildRequests(validBidRequests, bidderRequest) { user: getUserIds(tdidAdapter, bidderRequest.uspConsent, bidderRequest.gdprConsent, firstBidRequest.userIdAsEids, bidderRequest.gppConsent), }); - if (firstBidRequest.ortb2.site != null) { + if (firstBidRequest.ortb2 != null) { krakenParams.site = firstBidRequest.ortb2.site } From 26d0c84b356ffb372e696ad9bb81237be6d16021 Mon Sep 17 00:00:00 2001 From: Neil Flynn Date: Wed, 4 Oct 2023 16:08:48 +0100 Subject: [PATCH 09/10] Reducing the size of Site object. --- modules/kargoBidAdapter.js | 6 ++++-- test/spec/modules/kargoBidAdapter_spec.js | 6 +++--- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/modules/kargoBidAdapter.js b/modules/kargoBidAdapter.js index f533fdc5b1d..01470354755 100644 --- a/modules/kargoBidAdapter.js +++ b/modules/kargoBidAdapter.js @@ -97,8 +97,10 @@ function buildRequests(validBidRequests, bidderRequest) { user: getUserIds(tdidAdapter, bidderRequest.uspConsent, bidderRequest.gdprConsent, firstBidRequest.userIdAsEids, bidderRequest.gppConsent), }); - if (firstBidRequest.ortb2.site != null) { - krakenParams.site = firstBidRequest.ortb2.site + if (firstBidRequest.ortb2 != null) { + krakenParams.site = { + cat: firstBidRequest.ortb2.site.cat + } } if (firstBidRequest.schain && firstBidRequest.schain.nodes) { diff --git a/test/spec/modules/kargoBidAdapter_spec.js b/test/spec/modules/kargoBidAdapter_spec.js index 4d1b7da2ad5..f7010c1886f 100644 --- a/test/spec/modules/kargoBidAdapter_spec.js +++ b/test/spec/modules/kargoBidAdapter_spec.js @@ -145,7 +145,8 @@ describe('kargo adapter tests', function () { }, site: { id: '1234', - name: 'SiteName' + name: 'SiteName', + cat: ['IAB1', 'IAB2', 'IAB3'] } }, ortb2Imp: { @@ -444,8 +445,7 @@ describe('kargo adapter tests', function () { }, }, site: { - id: '1234', - name: 'SiteName' + cat: ['IAB1', 'IAB2', 'IAB3'] }, imp: [ { From e2325439c116802b98996c9dd5f417e6b6849f11 Mon Sep 17 00:00:00 2001 From: Julian Gan Date: Tue, 10 Oct 2023 11:19:54 +0100 Subject: [PATCH 10/10] remove white space that is causing linting error --- modules/kargoBidAdapter.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/kargoBidAdapter.js b/modules/kargoBidAdapter.js index 04ebf8b0747..01470354755 100644 --- a/modules/kargoBidAdapter.js +++ b/modules/kargoBidAdapter.js @@ -102,7 +102,7 @@ function buildRequests(validBidRequests, bidderRequest) { cat: firstBidRequest.ortb2.site.cat } } - + if (firstBidRequest.schain && firstBidRequest.schain.nodes) { krakenParams.schain = firstBidRequest.schain }