Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

recent upstream changes #1

Merged
merged 4 commits into from
Sep 11, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions integrationExamples/gpt/userId_example.html
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,9 @@
name: "_li_pbid",
expires: 28
}
},
{
name: "zeotapIdPlus"
}],
syncDelay: 5000,
auctionDelay: 1000
Expand Down
3 changes: 2 additions & 1 deletion modules/.submodules.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
"netIdSystem",
"identityLinkIdSystem",
"sharedIdSystem",
"intentIqIdSystem"
"intentIqIdSystem",
"zeotapIdPlusIdSystem"
],
"adpod": [
"freeWheelAdserverVideo",
Expand Down
27 changes: 18 additions & 9 deletions modules/aolBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { BANNER } from '../src/mediaTypes.js';

const AOL_BIDDERS_CODES = {
AOL: 'aol',
VERIZON: 'verizon',
ONEMOBILE: 'onemobile',
ONEDISPLAY: 'onedisplay'
};
Expand Down Expand Up @@ -48,23 +49,27 @@ const NUMERIC_VALUES = {
};

function template(strings, ...keys) {
return function(...values) {
return function (...values) {
let dict = values[values.length - 1] || {};
let result = [strings[0]];
keys.forEach(function(key, i) {
keys.forEach(function (key, i) {
let value = utils.isInteger(key) ? values[key] : dict[key];
result.push(value, strings[i + 1]);
});
return result.join('');
};
}

function _isMarketplaceBidder(bidder) {
return bidder === AOL_BIDDERS_CODES.AOL || bidder === AOL_BIDDERS_CODES.ONEDISPLAY;
function _isMarketplaceBidder(bidderCode) {
return bidderCode === AOL_BIDDERS_CODES.AOL ||
bidderCode === AOL_BIDDERS_CODES.VERIZON ||
bidderCode === AOL_BIDDERS_CODES.ONEDISPLAY;
}

function _isOneMobileBidder(bidderCode) {
return bidderCode === AOL_BIDDERS_CODES.AOL || bidderCode === AOL_BIDDERS_CODES.ONEMOBILE;
return bidderCode === AOL_BIDDERS_CODES.AOL ||
bidderCode === AOL_BIDDERS_CODES.VERIZON ||
bidderCode === AOL_BIDDERS_CODES.ONEMOBILE;
}

function _isNexageRequestPost(bid) {
Expand Down Expand Up @@ -101,7 +106,11 @@ function resolveEndpointCode(bid) {
export const spec = {
code: AOL_BIDDERS_CODES.AOL,
gvlid: 25,
aliases: [AOL_BIDDERS_CODES.ONEMOBILE, AOL_BIDDERS_CODES.ONEDISPLAY],
aliases: [
AOL_BIDDERS_CODES.ONEMOBILE,
AOL_BIDDERS_CODES.ONEDISPLAY,
AOL_BIDDERS_CODES.VERIZON
],
supportedMediaTypes: [BANNER],
isBidRequestValid(bid) {
return isMarketplaceBid(bid) || isMobileBid(bid);
Expand All @@ -121,7 +130,7 @@ export const spec = {
}
});
},
interpretResponse({body}, bidRequest) {
interpretResponse({ body }, bidRequest) {
if (!body) {
utils.logError('Empty bid response', bidRequest.bidderCode, body);
} else {
Expand Down Expand Up @@ -216,11 +225,11 @@ export const spec = {
}));
},
buildOneMobileGetUrl(bid, consentData) {
let {dcn, pos, ext} = bid.params;
let { dcn, pos, ext } = bid.params;
let nexageApi = this.buildOneMobileBaseUrl(bid);
if (dcn && pos) {
let dynamicParams = this.formatOneMobileDynamicParams(ext, consentData);
nexageApi += nexageGetApiTemplate({dcn, pos, dynamicParams});
nexageApi += nexageGetApiTemplate({ dcn, pos, dynamicParams });
}
return nexageApi;
},
Expand Down
12 changes: 6 additions & 6 deletions modules/seedtagBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ function mapMediaType(seedtagMediaType) {
else return seedtagMediaType;
}

function getMediaTypeFromBid(bid) {
return bid.mediaTypes && Object.keys(bid.mediaTypes)[0]
function hasVideoMediaType(bid) {
return !!bid.mediaTypes && !!bid.mediaTypes.video
}

function hasMandatoryParams(params) {
Expand All @@ -34,7 +34,7 @@ function hasMandatoryParams(params) {
);
}

function hasVideoMandatoryParams(mediaTypes) {
function hasMandatoryVideoParams(mediaTypes) {
const isVideoInStream =
!!mediaTypes.video && mediaTypes.video.context === 'instream';
const isPlayerSize =
Expand Down Expand Up @@ -65,7 +65,7 @@ function buildBidRequests(validBidRequests) {
bidRequest.adPosition = params.adPosition;
}

if (params.video) {
if (hasVideoMediaType(validBidRequest)) {
bidRequest.videoParams = params.video || {};
bidRequest.videoParams.w =
validBidRequest.mediaTypes.video.playerSize[0][0];
Expand Down Expand Up @@ -124,8 +124,8 @@ export const spec = {
* @return boolean True if this is a valid bid, and false otherwise.
*/
isBidRequestValid(bid) {
return getMediaTypeFromBid(bid) === VIDEO
? hasMandatoryParams(bid.params) && hasVideoMandatoryParams(bid.mediaTypes)
return hasVideoMediaType(bid)
? hasMandatoryParams(bid.params) && hasMandatoryVideoParams(bid.mediaTypes)
: hasMandatoryParams(bid.params);
},

Expand Down
5 changes: 5 additions & 0 deletions modules/userId/eids.js
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,11 @@ const USER_IDS_CONFIG = {
third: data.third
} : undefined;
}
},
// zeotapIdPlus
'IDP': {
source: 'zeotap.com',
atype: 1
}
};

Expand Down
9 changes: 8 additions & 1 deletion modules/userId/eids.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,13 @@ userIdAsEids = [
third: 'some-random-id-value'
}
}]
}
},
{
source: 'zeotap.com',
uids: [{
id: 'some-random-id-value',
atype: 1
}]
},
]
```
1 change: 1 addition & 0 deletions modules/yieldmoBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ export const spec = {
*/
buildRequests: function (bidRequests, bidderRequest) {
let serverRequest = {
pbav: '$prebid.version$',
p: [],
page_url: bidderRequest.refererInfo.referer,
bust: new Date().getTime().toString(),
Expand Down
52 changes: 52 additions & 0 deletions modules/zeotapIdPlusIdSystem.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
/**
* This module adds Zeotap to the User ID module
* The {@link module:modules/userId} module is required
* @module modules/zeotapIdPlusIdSystem
* @requires module:modules/userId
*/
import * as utils from '../src/utils.js'
import {submodule} from '../src/hook.js';
import { getStorageManager } from '../src/storageManager.js';

const ZEOTAP_COOKIE_NAME = 'IDP';
const storage = getStorageManager();

function readCookie() {
return storage.cookiesAreEnabled ? storage.getCookie(ZEOTAP_COOKIE_NAME) : null;
}

function readFromLocalStorage() {
return storage.localStorageIsEnabled ? storage.getDataFromLocalStorage(ZEOTAP_COOKIE_NAME) : null;
}

/** @type {Submodule} */
export const zeotapIdPlusSubmodule = {
/**
* used to link submodule with config
* @type {string}
*/
name: 'zeotapIdPlus',
/**
* decode the stored id value for passing to bid requests
* @function
* @param { Object | string | undefined } value
* @return { Object | string | undefined }
*/
decode(value) {
const id = value ? utils.isStr(value) ? value : utils.isPlainObject(value) ? value.id : undefined : undefined;
return id ? {
'IDP': JSON.parse(atob(id))
} : undefined;
},
/**
* performs action to obtain id and return a value in the callback's response argument
* @function
* @param {SubmoduleParams} configParams
* @return {{id: string | undefined} | undefined}
*/
getId() {
const id = readCookie() || readFromLocalStorage();
return id ? { id } : undefined;
}
};
submodule('userId', zeotapIdPlusSubmodule);
14 changes: 14 additions & 0 deletions test/spec/modules/eids_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,20 @@ describe('eids array generation for known sub-modules', function() {
}]
});
});
it('zeotapIdPlus', function() {
const userId = {
IDP: 'some-random-id-value'
};
const newEids = createEidsArray(userId);
expect(newEids.length).to.equal(1);
expect(newEids[0]).to.deep.equal({
source: 'zeotap.com',
uids: [{
id: 'some-random-id-value',
atype: 1
}]
});
});
});

describe('Negative case', function() {
Expand Down
59 changes: 41 additions & 18 deletions test/spec/modules/seedtagBidAdapter_spec.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
import { expect } from 'chai'
import { spec, getTimeoutUrl } from 'modules/seedtagBidAdapter.js'

const PUBLISHER_ID = '0000-0000-01'
const ADUNIT_ID = '000000'

function getSlotConfigs(mediaTypes, params) {
return {
params: params,
Expand All @@ -16,10 +19,16 @@ function getSlotConfigs(mediaTypes, params) {
}
}

function createVideoSlotConfig(mediaType) {
return getSlotConfigs(mediaType, {
publisherId: PUBLISHER_ID,
adUnitId: ADUNIT_ID,
placement: 'video'
})
}

describe('Seedtag Adapter', function() {
describe('isBidRequestValid method', function() {
const PUBLISHER_ID = '0000-0000-01'
const ADUNIT_ID = '000000'
describe('returns true', function() {
describe('when banner slot config has all mandatory params', () => {
describe('and placement has the correct value', function() {
Expand Down Expand Up @@ -66,41 +75,41 @@ describe('Seedtag Adapter', function() {
})
describe('returns false', function() {
describe('when params are not correct', function() {
function createSlotconfig(params) {
function createSlotConfig(params) {
return getSlotConfigs({ banner: {} }, params)
}
it('does not have the PublisherToken.', function() {
const isBidRequestValid = spec.isBidRequestValid(
createSlotconfig({
adUnitId: '000000',
createSlotConfig({
adUnitId: ADUNIT_ID,
placement: 'banner'
})
)
expect(isBidRequestValid).to.equal(false)
})
it('does not have the AdUnitId.', function() {
const isBidRequestValid = spec.isBidRequestValid(
createSlotconfig({
publisherId: '0000-0000-01',
createSlotConfig({
publisherId: PUBLISHER_ID,
placement: 'banner'
})
)
expect(isBidRequestValid).to.equal(false)
})
it('does not have the placement.', function() {
const isBidRequestValid = spec.isBidRequestValid(
createSlotconfig({
publisherId: '0000-0000-01',
adUnitId: '000000'
createSlotConfig({
publisherId: PUBLISHER_ID,
adUnitId: ADUNIT_ID
})
)
expect(isBidRequestValid).to.equal(false)
})
it('does not have a the correct placement.', function() {
const isBidRequestValid = spec.isBidRequestValid(
createSlotconfig({
publisherId: '0000-0000-01',
adUnitId: '000000',
createSlotConfig({
publisherId: PUBLISHER_ID,
adUnitId: ADUNIT_ID,
placement: 'another_thing'
})
)
Expand All @@ -117,19 +126,19 @@ describe('Seedtag Adapter', function() {
}
it('is a void object', function() {
const isBidRequestValid = spec.isBidRequestValid(
createVideoSlotconfig({ video: {} })
createVideoSlotConfig({ video: {} })
)
expect(isBidRequestValid).to.equal(false)
})
it('does not have playerSize.', function() {
const isBidRequestValid = spec.isBidRequestValid(
createVideoSlotconfig({ video: { context: 'instream' } })
createVideoSlotConfig({ video: { context: 'instream' } })
)
expect(isBidRequestValid).to.equal(false)
})
it('is not instream ', function() {
const isBidRequestValid = spec.isBidRequestValid(
createVideoSlotconfig({
createVideoSlotConfig({
video: {
context: 'outstream',
playerSize: [[600, 200]]
Expand All @@ -138,6 +147,20 @@ describe('Seedtag Adapter', function() {
)
expect(isBidRequestValid).to.equal(false)
})
describe('order does not matter', function() {
it('when video is not the first slot', function() {
const isBidRequestValid = spec.isBidRequestValid(
createVideoSlotConfig({ banner: {}, video: {} })
)
expect(isBidRequestValid).to.equal(false)
})
it('when video is the first slot', function() {
const isBidRequestValid = spec.isBidRequestValid(
createVideoSlotConfig({ video: {}, banner: {} })
)
expect(isBidRequestValid).to.equal(false)
})
})
})
})
})
Expand All @@ -148,8 +171,8 @@ describe('Seedtag Adapter', function() {
timeout: 1000
}
const mandatoryParams = {
publisherId: '0000-0000-01',
adUnitId: '000000',
publisherId: PUBLISHER_ID,
adUnitId: ADUNIT_ID,
placement: 'banner'
}
const inStreamParams = Object.assign({}, mandatoryParams, {
Expand Down
Loading