Skip to content
Open
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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
4 changes: 2 additions & 2 deletions creative/constants.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// 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';

// eslint-disable-next-line prebid/validate-imports
export {PB_LOCATOR} 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
10 changes: 5 additions & 5 deletions creative/crossDomain.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,13 @@ export function renderer(win) {
} catch (e) {
}

return function ({adId, pubUrl, clickUrl}) {
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);
target.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 @@ -88,8 +88,8 @@ export function renderer(win) {
const W = renderer.contentWindow;
// NOTE: on Firefox, `Promise.resolve(P)` or `new Promise((resolve) => resolve(P))`
// does not appear to work if P comes from another frame
W.Promise.resolve(W.render(data, {sendMessage, mkFrame}, win)).then(
() => sendMessage(MESSAGE_EVENT, {event: EVENT_AD_RENDER_SUCCEEDED}),
W.Promise.resolve(W.render(data, { sendMessage, mkFrame }, win)).then(
() => sendMessage(MESSAGE_EVENT, { event: EVENT_AD_RENDER_SUCCEEDED }),
onError
);
});
Expand All @@ -101,7 +101,7 @@ export function renderer(win) {
}

sendMessage(MESSAGE_REQUEST, {
options: {clickUrl}
options: { clickUrl }
}, onMessage);
};
}
Expand Down
6 changes: 3 additions & 3 deletions creative/renderers/display/renderer.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { registerReportingObserver } from '../../reporting.js';
import { BROWSER_INTERVENTION, MESSAGE_EVENT } from '../../constants.js';
import {ERROR_NO_AD} from './constants.js';
import { ERROR_NO_AD } from './constants.js';

export function render({ad, adUrl, width, height, instl}, {mkFrame, sendMessage}, win) {
export function render({ ad, adUrl, width, height, instl }, { mkFrame, sendMessage }, win) {
registerReportingObserver((report) => {
sendMessage(MESSAGE_EVENT, {
event: BROWSER_INTERVENTION,
Expand All @@ -24,7 +24,7 @@ export function render({ad, adUrl, width, height, instl}, {mkFrame, sendMessage}
});
}
const doc = win.document;
const attrs = {width: width ?? '100%', height: height ?? '100%'};
const attrs = { width: width ?? '100%', height: height ?? '100%' };
if (adUrl && !ad) {
attrs.src = adUrl;
} else {
Expand Down
18 changes: 9 additions & 9 deletions creative/renderers/native/renderer.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { registerReportingObserver } from '../../reporting.js';
import { BROWSER_INTERVENTION, MESSAGE_EVENT } from '../../constants.js';
import {ACTION_CLICK, ACTION_IMP, ACTION_RESIZE, MESSAGE_NATIVE, ORTB_ASSETS} from './constants.js';
import { ACTION_CLICK, ACTION_IMP, ACTION_RESIZE, MESSAGE_NATIVE, ORTB_ASSETS } from './constants.js';

export function getReplacer(adId, {assets = [], ortb, nativeKeys = {}}) {
const assetValues = Object.fromEntries((assets).map(({key, value}) => [key, value]));
export function getReplacer(adId, { assets = [], ortb, nativeKeys = {} }) {
const assetValues = Object.fromEntries((assets).map(({ key, value }) => [key, value]));
let repl = Object.fromEntries(
Object.entries(nativeKeys).flatMap(([name, key]) => {
const value = assetValues.hasOwnProperty(name) ? assetValues[name] : undefined;
Expand Down Expand Up @@ -58,7 +58,7 @@ function getInnerHTML(node) {
}

export function getAdMarkup(adId, nativeData, replacer, win, load = loadScript) {
const {rendererUrl, assets, ortb, adTemplate} = nativeData;
const { rendererUrl, assets, ortb, adTemplate } = nativeData;
const doc = win.document;
if (rendererUrl) {
return load(rendererUrl, doc).then(() => {
Expand All @@ -74,14 +74,14 @@ export function getAdMarkup(adId, nativeData, replacer, win, load = loadScript)
}
}

export function render({adId, native}, {sendMessage}, win, getMarkup = getAdMarkup) {
export function render({ adId, native }, { sendMessage }, win, getMarkup = getAdMarkup) {
registerReportingObserver((report) => {
sendMessage(MESSAGE_EVENT, {
event: BROWSER_INTERVENTION,
intervention: report
});
}, ['intervention']);
const {head, body} = win.document;
const { head, body } = win.document;
const resize = () => {
// force redraw - for some reason this is needed to get the right dimensions
body.style.display = 'none';
Expand All @@ -103,13 +103,13 @@ export function render({adId, native}, {sendMessage}, win, getMarkup = getAdMark
return getMarkup(adId, native, replacer, win).then(markup => {
replaceMarkup(body, markup);
if (typeof win.postRenderAd === 'function') {
win.postRenderAd({adId, ...native});
win.postRenderAd({ adId, ...native });
}
win.document.querySelectorAll('.pb-click').forEach(el => {
const assetId = el.getAttribute('hb_native_asset_id');
el.addEventListener('click', () => sendMessage(MESSAGE_NATIVE, {action: ACTION_CLICK, assetId}));
el.addEventListener('click', () => sendMessage(MESSAGE_NATIVE, { action: ACTION_CLICK, assetId }));
});
sendMessage(MESSAGE_NATIVE, {action: ACTION_IMP});
sendMessage(MESSAGE_NATIVE, { action: ACTION_IMP });
win.document.readyState === 'complete' ? resize() : win.onload = resize;
});
}
Expand Down
13 changes: 3 additions & 10 deletions eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,10 +107,13 @@ module.exports = [
},
rules: {
'comma-dangle': 'off',
'@stylistic/comma-dangle': 'off',
semi: 'off',
'@stylistic/semi': 'off',
'no-undef': 2,
'no-console': 'error',
'space-before-function-paren': 'off',
'@stylistic/space-before-function-paren': 'off',
'import/extensions': ['error', 'ignorePackages'],
'no-restricted-syntax': [
'error',
Expand Down Expand Up @@ -164,19 +167,9 @@ module.exports = [
'object-shorthand': 'off',
'prefer-regex-literals': 'off',
'no-case-declarations': 'off',
'no-useless-catch': 'off',
'@stylistic/quotes': 'off',
'@stylistic/quote-props': 'off',
'@stylistic/array-bracket-spacing': 'off',
'@stylistic/object-curly-spacing': 'off',
'@stylistic/semi': 'off',
'@stylistic/space-before-function-paren': 'off',
'@stylistic/multiline-ternary': 'off',
'@stylistic/computed-property-spacing': 'off',
'@stylistic/lines-between-class-members': 'off',
'@stylistic/comma-dangle': 'off',
'@stylistic/object-curly-newline': 'off',
'@stylistic/object-property-newline': 'off',
}
},
...Object.entries(allowedImports).map(([path, allowed]) => {
Expand Down
2 changes: 1 addition & 1 deletion libraries/adkernelUtils/adkernelUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ export function getBidFloor(bid, mediaType, sizes) {
var floor;
var size = sizes.length === 1 ? sizes[0] : '*';
if (typeof bid.getFloor === 'function') {
const floorInfo = bid.getFloor({currency: 'USD', mediaType, size});
const floorInfo = bid.getFloor({ currency: 'USD', mediaType, size });
if (typeof floorInfo === 'object' && floorInfo.currency === 'USD' && !isNaN(parseFloat(floorInfo.floor))) {
floor = parseFloat(floorInfo.floor);
}
Expand Down
6 changes: 3 additions & 3 deletions libraries/adrelevantisUtils/bidderUtils.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {isFn, isPlainObject} from '../../src/utils.js';
import { isFn, isPlainObject } from '../../src/utils.js';

export function hasUserInfo(bid) {
return !!(bid.params && bid.params.user);
Expand All @@ -15,9 +15,9 @@ export function hasAppId(bid) {
export function addUserId(eids, id, source, rti) {
if (id) {
if (rti) {
eids.push({source, id, rti_partner: rti});
eids.push({ source, id, rti_partner: rti });
} else {
eids.push({source, id});
eids.push({ source, id });
}
}
return eids;
Expand Down
4 changes: 2 additions & 2 deletions libraries/adtelligentUtils/adtelligentUtils.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {deepAccess, isArray} from '../../src/utils.js';
import { deepAccess, isArray } from '../../src/utils.js';
import { config } from '../../src/config.js';
import {BANNER, VIDEO} from '../../src/mediaTypes.js';
import { BANNER, VIDEO } from '../../src/mediaTypes.js';

export const supportedMediaTypes = [VIDEO, BANNER]

Expand Down
14 changes: 7 additions & 7 deletions libraries/advangUtils/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ export function getFirstSize(sizes) {

export function parseSizes(sizes) {
return parseSizesInput(sizes).map(size => {
const [ width, height ] = size.split('x');
const [width, height] = size.split('x');
return {
w: parseInt(width, 10) || undefined,
h: parseInt(height, 10) || undefined
Expand All @@ -108,7 +108,7 @@ export function getTopWindowReferrer(bidderRequest) {
}

export function getTopWindowLocation(bidderRequest) {
return parseUrl(bidderRequest?.refererInfo?.page, {decodeSearchAsString: true});
return parseUrl(bidderRequest?.refererInfo?.page, { decodeSearchAsString: true });
}

export function getVideoTargetingParams(bid, VIDEO_TARGETING) {
Expand All @@ -117,12 +117,12 @@ export function getVideoTargetingParams(bid, VIDEO_TARGETING) {
Object.keys(Object(bid.mediaTypes.video))
.filter(key => !excludeProps.includes(key))
.forEach(key => {
result[ key ] = bid.mediaTypes.video[ key ];
result[key] = bid.mediaTypes.video[key];
});
Object.keys(Object(bid.params.video))
.filter(key => VIDEO_TARGETING.includes(key))
.forEach(key => {
result[ key ] = bid.params.video[ key ];
result[key] = bid.params.video[key];
});
return result;
}
Expand Down Expand Up @@ -215,13 +215,13 @@ export function createRequestData(bid, bidderRequest, isVideo, getBidParam, getS
}

if (coppa) {
o.regs.ext = {'coppa': 1};
o.regs.ext = { 'coppa': 1 };
}

if (bidderRequest && bidderRequest.gdprConsent) {
const { gdprApplies, consentString } = bidderRequest.gdprConsent;
o.regs.ext = {'gdpr': gdprApplies ? 1 : 0};
o.user.ext = {'consent': consentString};
o.regs.ext = { 'gdpr': gdprApplies ? 1 : 0 };
o.user.ext = { 'consent': consentString };
}

return o;
Expand Down
18 changes: 9 additions & 9 deletions libraries/analyticsAdapter/AnalyticsAdapter.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { EVENTS } from '../../src/constants.js';
import {ajax} from '../../src/ajax.js';
import {logError, logMessage} from '../../src/utils.js';
import { ajax } from '../../src/ajax.js';
import { logError, logMessage } from '../../src/utils.js';
import * as events from '../../src/events.js';
import {config} from '../../src/config.js';
import { config } from '../../src/config.js';

export const _internal = {
ajax
Expand Down Expand Up @@ -30,7 +30,7 @@ export function setLabels(internalLabels) {
allLabels = combineLabels();
};

const combineLabels = () => Object.values(labels).reduce((acc, curr) => ({...acc, ...curr}), {});
const combineLabels = () => Object.values(labels).reduce((acc, curr) => ({ ...acc, ...curr }), {});

export const DEFAULT_INCLUDE_EVENTS = Object.values(EVENTS)
.filter(ev => ev !== EVENTS.AUCTION_DEBUG);
Expand Down Expand Up @@ -146,7 +146,7 @@ export default function AnalyticsAdapter<PROVIDER extends AnalyticsProvider>({ u
});

function _track(arg) {
const {eventType, args} = arg;
const { eventType, args } = arg;
if (this.getAdapterType() === BUNDLE) {
(window[global] as any)(handler, eventType, args);
}
Expand All @@ -160,15 +160,15 @@ export default function AnalyticsAdapter<PROVIDER extends AnalyticsProvider>({ u
_internal.ajax(url, callback, JSON.stringify({ eventType, args, labels: allLabels }));
}

function _enqueue({eventType, args}) {
function _enqueue({ eventType, args }) {
queue.push(() => {
if (Object.keys(allLabels || []).length > 0) {
args = {
[LABELS_KEY]: allLabels,
...args,
}
}
this.track({eventType, labels: allLabels, args});
this.track({ eventType, labels: allLabels, args });
});
emptyQueue();
}
Expand All @@ -184,7 +184,7 @@ export default function AnalyticsAdapter<PROVIDER extends AnalyticsProvider>({ u

if (sampled) {
const trackedEvents: Set<keyof events.Events> = (() => {
const {includeEvents = DEFAULT_INCLUDE_EVENTS, excludeEvents = []} = (config || {});
const { includeEvents = DEFAULT_INCLUDE_EVENTS, excludeEvents = [] } = (config || {});
return new Set(
Object.values(EVENTS)
.filter(ev => includeEvents.includes(ev))
Expand All @@ -206,7 +206,7 @@ export default function AnalyticsAdapter<PROVIDER extends AnalyticsProvider>({ u
handlers = Object.fromEntries(
Array.from(trackedEvents)
.map((ev) => {
const handler = (args) => this.enqueue({eventType: ev, args});
const handler = (args) => this.enqueue({ eventType: ev, args });
events.on(ev, handler);
return [ev, handler];
})
Expand Down
8 changes: 4 additions & 4 deletions libraries/appnexusUtils/anKeywords.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {_each, deepAccess, isArray, isNumber, isStr, mergeDeep, logWarn} from '../../src/utils.js';
import {getAllOrtbKeywords} from '../keywords/keywords.js';
import {CLIENT_SECTIONS} from '../../src/fpd/oneClient.js';
import { _each, deepAccess, isArray, isNumber, isStr, mergeDeep, logWarn } from '../../src/utils.js';
import { getAllOrtbKeywords } from '../keywords/keywords.js';
import { CLIENT_SECTIONS } from '../../src/fpd/oneClient.js';

const ORTB_SEGTAX_KEY_MAP = {
526: '1plusX',
Expand Down Expand Up @@ -56,7 +56,7 @@ export function transformBidderParamKeywords(keywords, paramName = 'keywords') {
} // unsuported types - don't send a key
}
v = v.filter(kw => kw !== '')
const entry = {key: k}
const entry = { key: k }
if (v.length > 0) {
entry.value = v;
}
Expand Down
2 changes: 1 addition & 1 deletion libraries/appnexusUtils/anUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* Converts a string value in camel-case to underscore eg 'placementId' becomes 'placement_id'
* @param {string} value string value to convert
*/
import {deepClone, isPlainObject} from '../../src/utils.js';
import { deepClone, isPlainObject } from '../../src/utils.js';

export function convertCamelToUnderscore(value) {
return value.replace(/(?:^|\.?)([A-Z])/g, function (x, y) {
Expand Down
2 changes: 1 addition & 1 deletion libraries/audUtils/bidderUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ const getSiteDetails = (bidderRequest) => {
page = bidderRequest.refererInfo.page;
name = bidderRequest.refererInfo.domain;
}
return {page: page, name: name};
return { page: page, name: name };
}
// Function to build the user object
const getUserDetails = (bidReq) => {
Expand Down
2 changes: 1 addition & 1 deletion libraries/braveUtils/buildAndInterpret.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { isEmpty } from '../../src/utils.js';
import {config} from '../../src/config.js';
import { config } from '../../src/config.js';
import { createNativeRequest, createBannerRequest, createVideoRequest, getFloor, prepareSite, prepareConsents, prepareEids } from './index.js';
import { convertOrtbRequestToProprietaryNative } from '../../src/native.js';

Expand Down
2 changes: 1 addition & 1 deletion libraries/braveUtils/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ export function createBannerRequest(br) {
* @returns {object} The video request object
*/
export function createVideoRequest(br) {
const videoObj = {...br.mediaTypes.video, id: br.transactionId};
const videoObj = { ...br.mediaTypes.video, id: br.transactionId };

if (videoObj.playerSize) {
const size = Array.isArray(videoObj.playerSize[0]) ? videoObj.playerSize[0] : videoObj.playerSize;
Expand Down
4 changes: 2 additions & 2 deletions libraries/cmp/cmpClient.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {PbPromise} from '../../src/utils/promise.js';
import { PbPromise } from '../../src/utils/promise.js';

/**
* @typedef {function} CMPClient
Expand Down Expand Up @@ -109,7 +109,7 @@ export function cmpClient(
}

function resolveParams(params) {
params = Object.assign({version: apiVersion}, params);
params = Object.assign({ version: apiVersion }, params);
return apiArgs.map(arg => [arg, params[arg]])
}

Expand Down
Loading
Loading