Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
ad: 'adContent',
auctionId: pauctionId,
width: 300,
height: 250
});
// Step 6: Send auction end event
events.emit(constants.EVENTS.AUCTION_END, {auctionId: pauctionId});
// Step 7: Find the request data sent (filtering other hosts)
requests = requests.filter(req => {
return req.url.indexOf(initOptions.host) > -1;
});
expect(requests.length).to.equal(1);
expect(includes([initOptions.host + initOptions.ci], requests[0].url));
expect(includes(['https://ads.ar.e-planning.net/hba/1/12345?d='], requests[0].url));
let info = requests[0].url;
let purl = parseURL(info);
let eplData = JSON.parse(decodeURIComponent(purl.search.d));
// Step 8 check that 6 events were sent
expect(eplData.length).to.equal(6);
// Step 9 verify that we only receive the parameters we need
let expectedEventValues = [
// AUCTION INIT
{ec: constants.EVENTS.AUCTION_INIT,
p: {auctionId: pauctionId, time: auctionTimestamp}},
// BID REQ
{ec: constants.EVENTS.BID_REQUESTED,
const hookConfig = {
context: this,
args: [reqBidsConfigObj],
nextFn: fn,
adUnits: reqBidsConfigObj.adUnits || $$PREBID_GLOBAL$$.adUnits,
bidsBackHandler: reqBidsConfigObj.bidsBackHandler,
haveExited: false,
timer: null
};
// in case we already have consent (eg during bid refresh)
if (consentData) {
return exitModule(null, hookConfig);
}
if (!includes(Object.keys(cmpCallMap), userCMP)) {
utils.logWarn(`CMP framework (${userCMP}) is not a supported framework. Aborting consentManagement module and resuming auction.`);
return hookConfig.nextFn.apply(hookConfig.context, hookConfig.args);
}
cmpCallMap[userCMP].call(this, processCmpData, cmpFailed, hookConfig);
// only let this code run if module is still active (ie if the callbacks used by CMPs haven't already finished)
if (!hookConfig.haveExited) {
if (consentTimeout === 0) {
processCmpData(undefined, hookConfig);
} else {
hookConfig.timer = setTimeout(cmpTimedOut.bind(null, hookConfig), consentTimeout);
}
}
}
isItemRequired(itemSchema) {
if (Array.isArray(itemSchema.type)) {
// While we don't yet support composite/nullable jsonschema types, it's
// future-proof to check for requirement against these.
return !includes(itemSchema.type, 'null')
}
// All non-null array item types are inherently required by design
return itemSchema.type !== 'null'
}
let values = decl.value.trim().split(' ').map(m => {
if(!includes(n.slice(1), m)) return m
return n[0]
}).join(' ')
bidderRequests,
requestedBidders
);
bids.forEach(({adUnit, bid}) => {
if (isValid(adUnit, bid, bidderRequests)) {
addBidResponse(adUnit, bid);
}
});
bidderRequests.forEach(bidderRequest => events.emit(EVENTS.BIDDER_DONE, bidderRequest));
} catch (error) {
utils.logError(error);
}
if (!result || (result.status && includes(result.status, 'Error'))) {
utils.logError('error parsing response: ', result.status);
}
done();
doClientSideSyncs(requestedBidders);
}
.filter(param => includes(VIDEO_TARGETING, param))
.forEach(param => tag.video[param] = bid.params.video[param]);
sizeConfig.forEach(config => {
const keys = Object.keys(config);
if ((includes(keys, 'minViewPort') &&
includes(keys, 'relevantMediaTypes')) &&
isArrayOfNums(config.minViewPort, 2) &&
Array.isArray(config.relevantMediaTypes) &&
config.relevantMediaTypes.every(mt => (includes(['banner', 'video', 'native'], mt)) || (mt === 'none'))) {
didCheckPass = didCheckPass && true;
} else {
didCheckPass = false;
}
});
}
function isValidEvent(eventType, adUnitCode) {
if (checkAdUnitConfig()) {
let validationEvents = [bidAdjustmentConst, bidResponseConst, bidWonConst];
if (!includes(initOptions.adUnits, adUnitCode) && includes(validationEvents, eventType)) {
return false;
}
}
return true;
}
clientBidderCodes = bidderCodes.filter(elm =>
!includes(adaptersServerSide, elm) || includes(clientTestAdapters, elm)
);
export const nativeBidder = bid => includes(nativeAdapters, bid.bidder);
export const hasNonNativeBidder = adUnit =>