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

Update master with latest #17

Merged
merged 37 commits into from
Jul 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
f6e1008
Update pairIdSystem.js: add defensive code before json parse (#11870)
patmmccann Jun 27, 2024
c1c1a76
s2s config formatted correctly (#11878)
edmonl Jun 27, 2024
1771824
Smartadserver Bid Adapter: disable Sec-Browsing-Topics for calls to S…
janzych-smart Jun 27, 2024
8ef5719
Prebid 9.3.0 release
prebidjs-release Jun 27, 2024
2f72b57
Increment version to 9.4.0-pre
prebidjs-release Jun 27, 2024
75e3375
viantOrtbBidAdapter': deals support (#11864)
skapoor-viant Jun 28, 2024
c1fbae1
ZetaGlobalSsp adapter: merge ortb2.site and params.site (#11773)
asurovenko-zeta Jun 28, 2024
6660561
cpmstarBidAdapter: added gvlid, additional request data (#11881)
JoshuaMGoldstein Jun 28, 2024
ca24c39
Visx bid adapter: import utilities and retrieve data from user on ort…
Goncakkd Jun 28, 2024
795e92b
Update ozoneBidAdapter.js (#11885)
AskRupert-DM Jun 28, 2024
67774de
AdagioRtdProvider: ensure fallback when adUnit.ortb2Imp is missing (#…
osazos Jun 28, 2024
0c560a3
Dailymotion bid adapter: Fix user sync parsing (#11887)
sebmil-daily Jun 28, 2024
d236eb1
Various Adapters: Use Vidazoo utils lib to remove code duplications (…
uditalias Jun 30, 2024
4f2ae43
Core: add location method for cross-frame creatives and update creati…
dgirardi Jul 1, 2024
3192ed1
Outbrain adapter: send placement and plcmt fields separately (#11799)
markkuhar Jul 1, 2024
41df410
Outbrain bid adapter add ortb2 device (#11748)
jwrosewell Jul 1, 2024
8c447c3
Prebid 9.4.0 release
prebidjs-release Jul 1, 2024
344e187
Increment version to 9.5.0-pre
prebidjs-release Jul 1, 2024
4e470c5
AdagioBidAdapter: fix typo (#11895)
osazos Jul 1, 2024
5caa7fc
create site.ext.data when it doesn't exist (#11902)
ehb-mtk Jul 2, 2024
ac95edb
Fix typo for GDPR/GPDR (#11908)
JulieLorin Jul 2, 2024
2ef1861
Adkernel Bid Adapter: add globalsun alias (#11907)
ckbo3hrk Jul 2, 2024
ecd9a7b
Report resize warning as error (#11896)
Sir-Will Jul 2, 2024
56b798a
update eslint jsdoc plugin (#11909)
chernodub Jul 2, 2024
96cfb46
Admixer Bid Adapter: change admixerwl to rtbstack alias (#11905)
dariaboyko Jul 2, 2024
33373f0
[JW Player Video Provider][Video JS Video Provider]: Add missing type…
karimMourra Jul 2, 2024
082ee5f
GumGum Bid Adapter: Send ae parameter in the request (#11913)
MartinGumGum Jul 2, 2024
85d38aa
symitriDapRtdProvider : initial release and update akamaiDapRTD to im…
jpalladino84 Jul 2, 2024
97687dd
fix: use error-prone reference to crypto module (#11882)
chernodub Jul 2, 2024
74330a8
Merge pull request #15 from prebid/master
pm-nitin-shirsat Jul 3, 2024
8984260
add gpid to imp ext (#11916)
Gaudeamus Jul 3, 2024
7458aeb
JW Player RTD Module : fallback to lone player on page (#11186)
karimMourra Jul 3, 2024
9529ae3
Anonymised RTD: Added Global Vendor List ID (#11919)
kyrylenko Jul 3, 2024
e0a8c58
permutiveRtd : transform integers to strings (#11910)
AntonioGargaro Jul 3, 2024
26a9bde
Merge pull request #16 from prebid/master
pm-nitin-shirsat Jul 4, 2024
cb85e20
reading battr from ortb2Imp.banner
pm-nitin-shirsat Jul 4, 2024
11e3c90
Merge branch 'UOE-10758' of https://github.com/pm-nitin-shirsat/Prebi…
pm-nitin-shirsat Jul 4, 2024
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: 2 additions & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ module.exports = {
'no-useless-escape': 'off',
'no-console': 'error',
'jsdoc/check-types': 'off',
'jsdoc/no-defaults': 'off',
'jsdoc/newline-after-description': 'off',
'jsdoc/require-jsdoc': 'off',
'jsdoc/require-param': 'off',
Expand Down Expand Up @@ -96,7 +97,7 @@ module.exports = {
// code in other packages (such as plugins/eslint) is not "seen" by babel and its parser will complain.
files: 'plugins/*/**/*.js',
parser: 'esprima'
},
},
{
files: '**BidAdapter.js',
rules: {
Expand Down
3 changes: 2 additions & 1 deletion creative/constants.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// eslint-disable-next-line prebid/validate-imports
import { AD_RENDER_FAILED_REASON, EVENTS, MESSAGES } from '../src/constants.js';
import {AD_RENDER_FAILED_REASON, EVENTS, MESSAGES} from '../src/constants.js';

export {PB_LOCATOR} from '../src/constants.js';
export const MESSAGE_REQUEST = MESSAGES.REQUEST;
export const MESSAGE_RESPONSE = MESSAGES.RESPONSE;
export const MESSAGE_EVENT = MESSAGES.EVENT;
Expand Down
20 changes: 16 additions & 4 deletions creative/crossDomain.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import {
ERROR_EXCEPTION,
EVENT_AD_RENDER_FAILED, EVENT_AD_RENDER_SUCCEEDED,
EVENT_AD_RENDER_FAILED,
EVENT_AD_RENDER_SUCCEEDED,
MESSAGE_EVENT,
MESSAGE_REQUEST,
MESSAGE_RESPONSE
MESSAGE_RESPONSE,
PB_LOCATOR
} from './constants.js';

const mkFrame = (() => {
Expand All @@ -24,14 +26,24 @@ const mkFrame = (() => {
};
})();

function isPrebidWindow(win) {
return !!win.frames[PB_LOCATOR];
}

export function renderer(win) {
let target = win.parent;
while (target !== win.top && !isPrebidWindow(target)) {
target = target.parent;
}
if (!isPrebidWindow(target)) target = win.parent;

return function ({adId, pubUrl, clickUrl}) {
const pubDomain = new URL(pubUrl, window.location).origin;

function sendMessage(type, payload, responseListener) {
const channel = new MessageChannel();
channel.port1.onmessage = guard(responseListener);
win.parent.postMessage(JSON.stringify(Object.assign({message: type, adId}, payload)), pubDomain, [channel.port2]);
target.postMessage(JSON.stringify(Object.assign({message: type, adId}, payload)), pubDomain, [channel.port2]);
}

function onError(e) {
Expand Down Expand Up @@ -77,7 +89,7 @@ export function renderer(win) {
W.Promise.resolve(W.render(data, {sendMessage, mkFrame}, win)).then(
() => sendMessage(MESSAGE_EVENT, {event: EVENT_AD_RENDER_SUCCEEDED}),
onError
)
);
});
win.document.body.appendChild(renderer);
}
Expand Down
2 changes: 1 addition & 1 deletion integrationExamples/gpt/x-domain/creative.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// creative will be rendered, e.g. GAM delivering a SafeFrame

// this code is autogenerated, also available in 'build/creative/creative.js'
<script>!function(){"use strict";const e="Prebid Event",n=(()=>{const e={frameBorder:0,scrolling:"no",marginHeight:0,marginWidth:0,topMargin:0,leftMargin:0,allowTransparency:"true"};return(n,t)=>{const r=n.createElement("iframe");return Object.entries(Object.assign({},t,e)).forEach((([e,n])=>r.setAttribute(e,n))),r}})();var t;window.pbRender=(t=window,function({adId:r,pubUrl:s,clickUrl:o}){const i=new URL(s,window.location).origin;function a(e,n,s){const o=new MessageChannel;o.port1.onmessage=d(s),t.parent.postMessage(JSON.stringify(Object.assign({message:e,adId:r},n)),i,[o.port2])}function c(n){a(e,{event:"adRenderFailed",info:{reason:n?.reason||"exception",message:n?.message}}),n?.stack&&console.error(n)}function d(e){return function(){try{return e.apply(this,arguments)}catch(e){c(e)}}}a("Prebid Request",{options:{clickUrl:o}},(function(s){let o;try{o=JSON.parse(s.data)}catch(e){return}if("Prebid Response"===o.message&&o.adId===r){const r=n(t.document,{width:0,height:0,style:"display: none",srcdoc:`<script>${o.renderer}<\/script>`});r.onload=d((function(){const s=r.contentWindow;s.Promise.resolve(s.render(o,{sendMessage:a,mkFrame:n},t)).then((()=>a(e,{event:"adRenderSucceeded"})),c)})),t.document.body.appendChild(r)}}))})}();</script>
<script>(()=>{"use strict";const e="Prebid Event",n=(()=>{const e={frameBorder:0,scrolling:"no",marginHeight:0,marginWidth:0,topMargin:0,leftMargin:0,allowTransparency:"true"};return(n,t)=>{const r=n.createElement("iframe");return Object.entries(Object.assign({},t,e)).forEach((([e,n])=>r.setAttribute(e,n))),r}})();function t(e){return!!e.frames.__pb_locator__}window.pbRender=function(r){let o=r.parent;for(;o!==r.top&&!t(o);)o=o.parent;return t(o)||(o=r.parent),function({adId:t,pubUrl:s,clickUrl:i}){const a=new URL(s,window.location).origin;function c(e,n,r){const s=new MessageChannel;s.port1.onmessage=l(r),o.postMessage(JSON.stringify(Object.assign({message:e,adId:t},n)),a,[s.port2])}function d(n){c(e,{event:"adRenderFailed",info:{reason:n?.reason||"exception",message:n?.message}}),n?.stack&&console.error(n)}function l(e){return function(){try{return e.apply(this,arguments)}catch(e){d(e)}}}c("Prebid Request",{options:{clickUrl:i}},(function(o){let s;try{s=JSON.parse(o.data)}catch(e){return}if("Prebid Response"===s.message&&s.adId===t){const t=n(r.document,{width:0,height:0,style:"display: none",srcdoc:`<script>${s.renderer}<\/script>`});t.onload=l((function(){const o=t.contentWindow;o.Promise.resolve(o.render(s,{sendMessage:c,mkFrame:n},r)).then((()=>c(e,{event:"adRenderSucceeded"})),d)})),r.document.body.appendChild(t)}}))}}(window)})();</script>

<script>
pbRender({
Expand Down
2 changes: 1 addition & 1 deletion libraries/creative-renderer-display/renderer.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion libraries/creative-renderer-native/renderer.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions libraries/processResponse/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { logError } from '../../src/utils.js';

export function getBidFromResponse(respItem, LOG_ERROR_MESS) {
if (!respItem) {
logError(LOG_ERROR_MESS.emptySeatbid);
} else if (!respItem.bid) {
logError(LOG_ERROR_MESS.hasNoArrayOfBids + JSON.stringify(respItem));
} else if (!respItem.bid[0]) {
logError(LOG_ERROR_MESS.noBid);
}
return respItem && respItem.bid && respItem.bid[0];
}
19 changes: 9 additions & 10 deletions libraries/vidazooUtils/bidderUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,7 @@ export function appendUserIdsToRequestPayload(payloadRef, userIds) {
let key;
_each(userIds, (userId, idSystemProviderName) => {
key = `uid.${idSystemProviderName}`;

switch (idSystemProviderName) {
case 'lipb':
payloadRef[key] = userId.lipbid;
Expand All @@ -217,7 +218,7 @@ export function getVidazooSessionId(storage) {
return getStorageItem(storage, SESSION_ID_KEY) || '';
}

export function buildRequestData(bid, topWindowUrl, sizes, bidderRequest, bidderTimeout, webSessionId, storage, bidderVersion, bidderCode, getUniqueRequestData) {
export function buildRequestData(bid, topWindowUrl, sizes, bidderRequest, bidderTimeout, storage, bidderVersion, bidderCode, getUniqueRequestData) {
const {
params,
bidId,
Expand All @@ -234,7 +235,7 @@ export function buildRequestData(bid, topWindowUrl, sizes, bidderRequest, bidder
const {ext} = params;
let {bidFloor} = params;
const hashUrl = hashCode(topWindowUrl);
const uniqueRequestData = isFn(getUniqueRequestData) ? getUniqueRequestData(hashUrl) : {};
const uniqueRequestData = isFn(getUniqueRequestData) ? getUniqueRequestData(hashUrl, bid) : {};
const uniqueDealId = getUniqueDealId(storage, hashUrl);
const pId = extractPID(params);
const isStorageAllowed = bidderSettings.get(bidderCode, 'storageAllowed');
Expand Down Expand Up @@ -285,7 +286,6 @@ export function buildRequestData(bid, topWindowUrl, sizes, bidderRequest, bidder
bidderRequestsCount: bidderRequestsCount,
bidderWinsCount: bidderWinsCount,
bidderTimeout: bidderTimeout,
webSessionId: webSessionId,
...uniqueRequestData
};

Expand Down Expand Up @@ -331,13 +331,13 @@ export function buildRequestData(bid, topWindowUrl, sizes, bidderRequest, bidder
return data;
}

export function createInterpretResponseFn(bidderCode) {
export function createInterpretResponseFn(bidderCode, allowSingleRequest) {
return function interpretResponse(serverResponse, request) {
if (!serverResponse || !serverResponse.body) {
return [];
}

const singleRequestMode = config.getConfig(`${bidderCode}.singleRequest`);
const singleRequestMode = allowSingleRequest && config.getConfig(`${bidderCode}.singleRequest`);
const reqBidId = deepAccess(request, 'data.bidId');
const {results} = serverResponse.body;

Expand Down Expand Up @@ -410,12 +410,12 @@ export function createInterpretResponseFn(bidderCode) {
}
}

export function createBuildRequestsFn(createRequestDomain, createUniqueRequestData, webSessionId, storage, bidderCode, bidderVersion) {
export function createBuildRequestsFn(createRequestDomain, createUniqueRequestData, storage, bidderCode, bidderVersion, allowSingleRequest) {
function buildRequest(bid, topWindowUrl, sizes, bidderRequest, bidderTimeout) {
const {params} = bid;
const cId = extractCID(params);
const subDomain = extractSubDomain(params);
const data = buildRequestData(bid, topWindowUrl, sizes, bidderRequest, bidderTimeout, webSessionId, storage, bidderVersion, bidderCode, createUniqueRequestData);
const data = buildRequestData(bid, topWindowUrl, sizes, bidderRequest, bidderTimeout, storage, bidderVersion, bidderCode, createUniqueRequestData);
const dto = {
method: 'POST', url: `${createRequestDomain(subDomain)}/prebid/multi/${cId}`, data: data
};
Expand All @@ -428,7 +428,7 @@ export function createBuildRequestsFn(createRequestDomain, createUniqueRequestDa
const subDomain = extractSubDomain(params);
const data = bidRequests.map(bid => {
const sizes = parseSizesInput(bid.sizes);
return buildRequestData(bid, topWindowUrl, sizes, bidderRequest, bidderTimeout, webSessionId, storage, bidderVersion, bidderCode, createUniqueRequestData)
return buildRequestData(bid, topWindowUrl, sizes, bidderRequest, bidderTimeout, storage, bidderVersion, bidderCode, createUniqueRequestData)
});
const chunkSize = Math.min(20, config.getConfig(`${bidderCode}.chunkSize`) || 10);

Expand All @@ -445,11 +445,10 @@ export function createBuildRequestsFn(createRequestDomain, createUniqueRequestDa
}

return function buildRequests(validBidRequests, bidderRequest) {
// TODO: does the fallback make sense here?
const topWindowUrl = bidderRequest.refererInfo.page || bidderRequest.refererInfo.topmostLocation;
const bidderTimeout = config.getConfig('bidderTimeout');

const singleRequestMode = config.getConfig('vidazoo.singleRequest');
const singleRequestMode = allowSingleRequest && config.getConfig(`${bidderCode}.singleRequest`);

const requests = [];

Expand Down
1 change: 1 addition & 0 deletions modules/.submodules.json
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@
"reconciliationRtdProvider",
"relevadRtdProvider",
"sirdataRtdProvider",
"symitriDapRtdProvider",
"timeoutRtdProvider",
"weboramaRtdProvider"
],
Expand Down
2 changes: 1 addition & 1 deletion modules/adagioBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -576,7 +576,7 @@ export const spec = {
sessionData.rnd = Math.random()
}

const aucId = deepAccess('bidderRequest', 'ortb2.site.ext.data.adg_rtd.uid') || generateUUID()
const aucId = deepAccess(bidderRequest, 'ortb2.site.ext.data.adg_rtd.uid') || generateUUID()

const adUnits = validBidRequests.map(rawBidRequest => {
const bidRequest = deepClone(rawBidRequest);
Expand Down
16 changes: 9 additions & 7 deletions modules/adagioRtdProvider.js
Original file line number Diff line number Diff line change
Expand Up @@ -278,15 +278,18 @@ function onGetBidRequestData(bidReqConfig, callback, config) {

const adUnits = bidReqConfig.adUnits || getGlobal().adUnits || [];
adUnits.forEach(adUnit => {
adUnit.ortb2Imp = adUnit.ortb2Imp || {};
const ortb2Imp = deepAccess(adUnit, 'ortb2Imp');

// A divId is required to compute the slot position and later to track viewability.
// If nothing has been explicitly set, we try to get the divId from the GPT slot and fallback to the adUnit code in last resort.
if (!deepAccess(ortb2Imp, 'ext.data.divId')) {
const divId = getGptSlotInfoForAdUnitCode(adUnit.code).divId;
let divId = deepAccess(ortb2Imp, 'ext.data.divId')
if (!divId) {
divId = getGptSlotInfoForAdUnitCode(adUnit.code).divId;
deepSetValue(ortb2Imp, `ext.data.divId`, divId || adUnit.code);
}

const slotPosition = getSlotPosition(adUnit);
const slotPosition = getSlotPosition(divId);
deepSetValue(ortb2Imp, `ext.data.adg_rtd.adunit_position`, slotPosition);

// It is expected that the publisher set a `adUnits[].ortb2Imp.ext.data.placement` value.
Expand Down Expand Up @@ -430,7 +433,7 @@ function getElementFromTopWindow(element, currentWindow) {
}
};

function getSlotPosition(adUnit) {
function getSlotPosition(divId) {
if (!isSafeFrameWindow() && !canAccessWindowTop()) {
return '';
}
Expand All @@ -451,16 +454,15 @@ function getSlotPosition(adUnit) {
// window.top based computing
const wt = getWindowTop();
const d = wt.document;
const adUnitElementId = deepAccess(adUnit, 'ortb2Imp.ext.data.divId');

let domElement;

if (inIframe() === true) {
const ws = getWindowSelf();
const currentElement = ws.document.getElementById(adUnitElementId);
const currentElement = ws.document.getElementById(divId);
domElement = getElementFromTopWindow(currentElement, ws);
} else {
domElement = wt.document.getElementById(adUnitElementId);
domElement = wt.document.getElementById(divId);
}

if (!domElement) {
Expand Down
11 changes: 1 addition & 10 deletions modules/adfBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

import {registerBidder} from '../src/adapters/bidderFactory.js';
import {BANNER, NATIVE, VIDEO} from '../src/mediaTypes.js';
import {deepAccess, deepClone, deepSetValue, mergeDeep, parseSizesInput} from '../src/utils.js';
import {deepAccess, deepClone, deepSetValue, mergeDeep, parseSizesInput, setOnAny} from '../src/utils.js';
import {config} from '../src/config.js';
import {Renderer} from '../src/Renderer.js';

Expand Down Expand Up @@ -255,15 +255,6 @@ export const spec = {

registerBidder(spec);

function setOnAny(collection, key) {
for (let i = 0, result; i < collection.length; i++) {
result = deepAccess(collection[i], key);
if (result) {
return result;
}
}
}

function flatten(arr) {
return [].concat(...arr);
}
Expand Down
3 changes: 2 additions & 1 deletion modules/adkernelBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,8 @@ export const spec = {
{code: 'headbidder'},
{code: 'digiad'},
{code: 'monetix'},
{code: 'hyperbrainz'}
{code: 'hyperbrainz'},
{code: 'globalsun'}
],
supportedMediaTypes: [BANNER, VIDEO, NATIVE],

Expand Down
Loading
Loading