Skip to content
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
30 changes: 15 additions & 15 deletions modules/cadent_aperture_mxBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@
let sizes;
bid.mediaTypes && bid.mediaTypes.banner && bid.mediaTypes.banner.sizes ? sizes = bid.mediaTypes.banner.sizes : sizes = bid.sizes;
if (!cadentAdapter.validateSizes(sizes)) {
logWarn(BIDDER_CODE + ': could not detect mediaType banner sizes. Assigning to bid sizes instead');
sizes = bid.sizes;

Check warning on line 51 in modules/cadent_aperture_mxBidAdapter.js

View workflow job for this annotation

GitHub Actions / Coverage

50-51 lines are not covered with tests
}
return {
format: sizes.map((size) => {
Expand Down Expand Up @@ -94,22 +94,22 @@
cleanProtocols: (video) => {
if (video.protocols && video.protocols.includes(7)) {
// not supporting VAST protocol 7 (VAST 4.0);
logWarn(BIDDER_CODE + ': VAST 4.0 is currently not supported. This protocol has been filtered out of the request.');
video.protocols = video.protocols.filter(protocol => protocol !== 7);

Check warning on line 98 in modules/cadent_aperture_mxBidAdapter.js

View workflow job for this annotation

GitHub Actions / Coverage

97-98 lines are not covered with tests
}
return video;
},
outstreamRender: (bid) => {
bid.renderer.push(function () {
const params = (bid && bid.params && bid.params[0] && bid.params[0].video) ? bid.params[0].video : {};
window.emxVideoQueue = window.emxVideoQueue || [];
window.queueEmxVideo({

Check warning on line 106 in modules/cadent_aperture_mxBidAdapter.js

View workflow job for this annotation

GitHub Actions / Coverage

103-106 lines are not covered with tests
id: bid.adUnitCode,
adsResponses: bid.vastXml,
options: params
});
if (window.emxVideoReady && window.videojs) {
window.emxVideoReady();

Check warning on line 112 in modules/cadent_aperture_mxBidAdapter.js

View workflow job for this annotation

GitHub Actions / Coverage

111-112 lines are not covered with tests
}
});
},
Expand All @@ -122,7 +122,7 @@
try {
renderer.setRender(cadentAdapter.outstreamRender);
} catch (err) {
logWarn('Prebid Error calling setRender on renderer', err);

Check warning on line 125 in modules/cadent_aperture_mxBidAdapter.js

View workflow job for this annotation

GitHub Actions / Coverage

125 line is not covered with tests
}

return renderer;
Expand All @@ -134,8 +134,8 @@
videoObj['w'] = bid.mediaTypes.video.playerSize[0][0];
videoObj['h'] = bid.mediaTypes.video.playerSize[0][1];
} else {
videoObj['w'] = bid.mediaTypes.video.playerSize[0];
videoObj['h'] = bid.mediaTypes.video.playerSize[1];

Check warning on line 138 in modules/cadent_aperture_mxBidAdapter.js

View workflow job for this annotation

GitHub Actions / Coverage

137-138 lines are not covered with tests
}
return cadentAdapter.cleanProtocols(videoObj);
},
Expand All @@ -143,7 +143,7 @@
try {
return decodeURIComponent(bidResponseAdm.replace(/%(?![0-9][0-9a-fA-F]+)/g, '%25'));
} catch (err) {
logError('cadent_aperture_mxBidAdapter', 'error', err);

Check warning on line 146 in modules/cadent_aperture_mxBidAdapter.js

View workflow job for this annotation

GitHub Actions / Coverage

146 line is not covered with tests
}
},
getSite: (refInfo) => {
Expand Down Expand Up @@ -177,8 +177,8 @@
if (bidRequest.gppConsent) {
const { gppString: gpp, applicableSections: gppSid } = bidRequest.gppConsent;
if (cadentData.regs) {
cadentData.regs.gpp = gpp;
cadentData.regs.gpp_sid = gppSid;

Check warning on line 181 in modules/cadent_aperture_mxBidAdapter.js

View workflow job for this annotation

GitHub Actions / Coverage

180-181 lines are not covered with tests
} else {
cadentData.regs = {
gpp: gpp,
Expand All @@ -201,14 +201,16 @@
return cadentData;
},
// supporting eids
getEids(bidRequests) {
// Prebid 10+ provides user IDs only as EIDs (ortb2.user.ext.eids / bid.userIdAsEids)
getEids(bidderRequest) {
const eids = bidderRequest?.ortb2?.user?.ext?.eids || bidderRequest?.bids?.[0]?.userIdAsEids || [];
return EIDS_SUPPORTED
.map(cadentAdapter.getUserId(bidRequests))
.map(cadentAdapter.getUserId(eids))
.filter(x => x);
},
getUserId(bidRequests) {
return ({ key, source, rtiPartner }) => {
const id = deepAccess(bidRequests, `userId.${key}`);
getUserId(eids) {
return ({ source, rtiPartner }) => {
const id = eids.find(eid => eid?.source === source)?.uids?.[0]?.id;
return id ? cadentAdapter.formatEid(id, source, rtiPartner) : null;
};
},
Expand Down Expand Up @@ -253,8 +255,8 @@
}

if (!bid.mediaTypes.video.playerSize) {
logWarn(BIDDER_CODE + ': Missing video playerSize');
return false;

Check warning on line 259 in modules/cadent_aperture_mxBidAdapter.js

View workflow job for this annotation

GitHub Actions / Coverage

258-259 lines are not covered with tests
}
}

Expand Down Expand Up @@ -311,16 +313,14 @@
}

// adding eid support
if (bidderRequest.userId) {
const eids = cadentAdapter.getEids(bidderRequest);
if (eids.length > 0) {
if (cadentData.user && cadentData.user.ext) {
cadentData.user.ext.eids = eids;
} else {
cadentData.user = {
ext: { eids }
};
}
const eids = cadentAdapter.getEids(bidderRequest);
if (eids.length > 0) {
if (cadentData.user && cadentData.user.ext) {
cadentData.user.ext.eids = eids;

Check warning on line 319 in modules/cadent_aperture_mxBidAdapter.js

View workflow job for this annotation

GitHub Actions / Coverage

319 line is not covered with tests
} else {
cadentData.user = {
ext: { eids }
};
}
}

Expand Down
2 changes: 1 addition & 1 deletion modules/nexverseBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@ function buildOpenRtbRequest(bid, bidderRequest) {
},
user: {
id: getUid(storage),
buyeruid: bidderRequest.userId || '', // User ID or Buyer ID
buyeruid: bidderRequest.ortb2?.user?.buyeruid || '', // Buyer ID from first party data
yob,
gender,
keywords,
Expand Down
40 changes: 1 addition & 39 deletions modules/pangleBidAdapter.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { BANNER, VIDEO } from '../src/mediaTypes.js';
import { ortbConverter } from '../libraries/ortbConverter/converter.js';
import { registerBidder } from '../src/adapters/bidderFactory.js';
import { deepSetValue, generateUUID, timestamp, deepAccess } from '../src/utils.js';
import { deepSetValue, deepAccess } from '../src/utils.js';
import { getStorageManager } from '../src/storageManager.js';
import { MODULE_TYPE_RTD } from '../src/activities/modules.js';

Expand All @@ -16,8 +16,6 @@ const OUTSTREAM_RENDERER_URL = 'https://sf16-static.i18n-pglstatp.com/obj/ad-pat
const DEFAULT_BID_TTL = 30;
const DEFAULT_CURRENCY = 'USD';
const DEFAULT_NET_REVENUE = true;
const PANGLE_COOKIE = '_pangle_id';
const COOKIE_EXP = 86400 * 1000 * 365 * 1; // 1 year
const MEDIA_TYPES = {
Banner: 1,
Video: 2
Expand All @@ -31,25 +29,6 @@ export function isValidUuid(uuid) {
);
}

function getPangleCookieId() {
let sid = storage.cookiesAreEnabled() && storage.getCookie(PANGLE_COOKIE);

if (!sid || !isValidUuid(sid)) {
sid = generateUUID();
setPangleCookieId(sid);
}

return sid;
}

function setPangleCookieId(sid) {
if (storage.cookiesAreEnabled()) {
const expires = new Date(timestamp() + COOKIE_EXP).toGMTString();

storage.setCookie(PANGLE_COOKIE, sid, expires);
}
}

function createRequest(bidRequests, bidderRequest, mediaType) {
const data = converter.toORTB({
bidRequests,
Expand All @@ -58,23 +37,6 @@ function createRequest(bidRequests, bidderRequest, mediaType) {
});
const devicetype = spec.getDeviceType(navigator.userAgent);
deepSetValue(data, 'device.devicetype', devicetype);
if (bidderRequest.userId && typeof bidderRequest.userId === 'object') {
const pangleId = getPangleCookieId();
// add pangle cookie
const _eids = data.user?.ext?.eids ?? [];
deepSetValue(data, 'user.ext.eids', [
..._eids,
{
source: document.location.host,
uids: [
{
id: pangleId,
atype: 1,
},
],
},
]);
}
bidRequests.forEach((item, idx) => {
deepSetValue(data.imp[idx], 'ext.networkids', item.params);
deepSetValue(data.imp[idx], 'banner.api', [5]);
Expand Down
12 changes: 10 additions & 2 deletions test/spec/modules/cadent_aperture_mxBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -405,7 +405,7 @@ describe('cadent_aperture_mx Adapter', function () {
it('should add liveramp identitylink id to request', () => {
const idl_env = '123';
const bidRequestWithID = utils.deepClone(bidderRequest);
bidRequestWithID.userId = { idl_env };
bidRequestWithID.ortb2 = { user: { ext: { eids: [{ source: 'liveramp.com', uids: [{ id: idl_env, atype: 3 }] }] } } };
let requestWithID = spec.buildRequests(bidRequestWithID.bids, bidRequestWithID);
requestWithID = JSON.parse(requestWithID.data);
expect(requestWithID.user.ext.eids[0]).to.deep.equal({
Expand Down Expand Up @@ -449,7 +449,7 @@ describe('cadent_aperture_mx Adapter', function () {
it('should add UID 2.0 to request', () => {
const uid2 = { id: '456' };
const bidRequestWithUID = utils.deepClone(bidderRequest);
bidRequestWithUID.userId = { uid2 };
bidRequestWithUID.bids = bidRequestWithUID.bids.map(bid => ({ ...bid, userIdAsEids: [{ source: 'uidapi.com', uids: [{ id: uid2.id, atype: 3 }] }] }));
let requestWithUID = spec.buildRequests(bidRequestWithUID.bids, bidRequestWithUID);
requestWithUID = JSON.parse(requestWithUID.data);
expect(requestWithUID.user.ext.eids[0]).to.deep.equal({
Expand All @@ -462,6 +462,14 @@ describe('cadent_aperture_mx Adapter', function () {
}]
});
});

it('should only send supported EID sources', () => {
const bidRequestWithEids = utils.deepClone(bidderRequest);
bidRequestWithEids.ortb2 = { user: { ext: { eids: [{ source: 'example.com', uids: [{ id: 'other', atype: 1 }] }] } } };
let request = spec.buildRequests(bidRequestWithEids.bids, bidRequestWithEids);
request = JSON.parse(request.data);
expect(request.user?.ext?.eids).to.equal(undefined);
});
});

describe('gpp tests', function() {
Expand Down
30 changes: 29 additions & 1 deletion test/spec/modules/nexverseBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,34 @@ import { getOsVersion } from '../../../libraries/advangUtils/index.js';
const BIDDER_ENDPOINT = 'https://rtb.nexverse.ai';

describe('nexverseBidAdapterTests', () => {
describe('buildRequests: user.buyeruid', function () {
const bid = {
bidId: 'bid-1',
adUnitCode: 'div-nexverse-test',
bidder: 'nexverse',
params: { uid: '77d4a2eb3d209ce6c7691dc79fcab358', pubId: '24051', pubEpid: '34561' },
mediaTypes: { banner: { sizes: [[300, 250]] } },
sizes: [[300, 250]],
};
const baseBidderRequest = {
auctionId: 'auction-1',
refererInfo: { page: 'https://example.com/page', domain: 'example.com', ref: '' },
};

function buyeruidFor(bidderRequest) {
const [request] = spec.buildRequests([bid], bidderRequest);
return JSON.parse(request.data).user.buyeruid;
}

it('should send ortb2.user.buyeruid as user.buyeruid', function () {
expect(buyeruidFor({ ...baseBidderRequest, ortb2: { user: { buyeruid: 'buyer-123' } } })).to.equal('buyer-123');
});

it('should send an empty user.buyeruid when no buyeruid is provided', function () {
expect(buyeruidFor(baseBidderRequest)).to.equal('');
});
});

let userAgentDescriptor;

beforeEach(() => {
Expand Down Expand Up @@ -111,7 +139,7 @@ describe('nexverseBidAdapterTests', () => {
it('includes user demographics, consent, referrer, and app details', () => {
Object.assign(bid.params, { yob: '1980', gender: 'F', keywords: 'news', geoLat: 10, geoLon: 20 });
Object.assign(bidderRequest, {
userId: 'buyer-user',
ortb2: { user: { buyeruid: 'buyer-user' } },
gdprConsent: { gdprApplies: true, consentString: 'gdpr-consent' },
uspConsent: '1YNN',
app: { id: 'app-1', name: 'Example', bundle: 'example.app', domain: 'app.example', storeUrl: 'https://store.example/app', cat: ['IAB1'] }
Expand Down
30 changes: 19 additions & 11 deletions test/spec/modules/pangleBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,17 +47,15 @@ const REQUEST = [{
}];

const DEFAULT_OPTIONS = {
userId: {
britepoolid: 'pangle-britepool',
criteoId: 'pangle-criteo',
digitrustid: { data: { id: 'pangle-digitrust' } },
id5id: { uid: 'pangle-id5' },
idl_env: 'pangle-idl-env',
lipb: { lipbid: 'pangle-liveintent' },
netId: 'pangle-netid',
parrableId: { eid: 'pangle-parrable' },
pubcid: 'pangle-pubcid',
tdid: 'pangle-ttd',
ortb2: {
user: {
ext: {
eids: [
{ source: 'criteo.com', uids: [{ id: 'pangle-criteo', atype: 1 }] },
{ source: 'pubcid.org', uids: [{ id: 'pangle-pubcid', atype: 1 }] },
]
}
}
}
};

Expand Down Expand Up @@ -137,6 +135,16 @@ describe('pangle bid adapter', function () {
const payload2 = request2.data;
expect(payload2.imp[0]).to.have.property('id', REQUEST[1].bidId);
});

it('passes user ID EIDs through without adding a pangle id EID', function () {
const payload = spec.buildRequests(REQUEST, DEFAULT_OPTIONS)[0].data;
expect(payload.user.ext.eids).to.deep.equal(DEFAULT_OPTIONS.ortb2.user.ext.eids);
});

it('does not add a pangle id EID for a raw bidderRequest.userId', function () {
const payload = spec.buildRequests(REQUEST, { userId: { pubcid: 'raw' } })[0].data;
expect(payload.user?.ext?.eids).to.equal(undefined);
});
});

describe('interpretResponse', function () {
Expand Down
Loading