Skip to content

Commit

Permalink
Merge branch 'prebid:master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
nalexand authored Apr 16, 2024
2 parents cecb514 + 269437b commit 072edef
Show file tree
Hide file tree
Showing 271 changed files with 6,792 additions and 3,414 deletions.
8 changes: 7 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,12 @@ To lint the code:
gulp lint
```

To lint and only show errors

```bash
gulp lint --no-lint-warnings
```

To run the unit tests:

```bash
Expand All @@ -245,7 +251,7 @@ gulp test

To run the unit tests for a particular file (example for pubmaticBidAdapter_spec.js):
```bash
gulp test --file "test/spec/modules/pubmaticBidAdapter_spec.js"
gulp test --file "test/spec/modules/pubmaticBidAdapter_spec.js" --nolint
```

To generate and view the code coverage reports:
Expand Down
2 changes: 1 addition & 1 deletion RELEASE_SCHEDULE.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

## Release Schedule

We aim to push a new release of Prebid.js every week on Tuesday.
We aim to push a new release of Prebid.js each week barring any unforseen circumstances or in observance of holidays.

While the releases will be available immediately for those using direct Git access,
it will be about a week before the Prebid Org [Download Page](https://docs.prebid.org/download.html) will be updated.
Expand Down
14 changes: 7 additions & 7 deletions creative/constants.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
// eslint-disable-next-line prebid/validate-imports
import CONSTANTS from '../src/constants.json';
import { AD_RENDER_FAILED_REASON, EVENTS, MESSAGES } from '../src/constants.js';

export const MESSAGE_REQUEST = CONSTANTS.MESSAGES.REQUEST;
export const MESSAGE_RESPONSE = CONSTANTS.MESSAGES.RESPONSE;
export const MESSAGE_EVENT = CONSTANTS.MESSAGES.EVENT;
export const EVENT_AD_RENDER_FAILED = CONSTANTS.EVENTS.AD_RENDER_FAILED;
export const EVENT_AD_RENDER_SUCCEEDED = CONSTANTS.EVENTS.AD_RENDER_SUCCEEDED;
export const ERROR_EXCEPTION = CONSTANTS.AD_RENDER_FAILED_REASON.EXCEPTION;
export const MESSAGE_REQUEST = MESSAGES.REQUEST;
export const MESSAGE_RESPONSE = MESSAGES.RESPONSE;
export const MESSAGE_EVENT = MESSAGES.EVENT;
export const EVENT_AD_RENDER_FAILED = EVENTS.AD_RENDER_FAILED;
export const EVENT_AD_RENDER_SUCCEEDED = EVENTS.AD_RENDER_SUCCEEDED;
export const ERROR_EXCEPTION = AD_RENDER_FAILED_REASON.EXCEPTION;
4 changes: 2 additions & 2 deletions creative/renderers/display/constants.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// eslint-disable-next-line prebid/validate-imports
import CONSTANTS from '../../../src/constants.json';
import { AD_RENDER_FAILED_REASON } from '../../../src/constants.js';

export const ERROR_NO_AD = CONSTANTS.AD_RENDER_FAILED_REASON.NO_AD;
export const ERROR_NO_AD = AD_RENDER_FAILED_REASON.NO_AD;
4 changes: 2 additions & 2 deletions creative/renderers/native/constants.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// eslint-disable-next-line prebid/validate-imports
import CONSTANTS from '../../../src/constants.json';
import { MESSAGES } from '../../../src/constants.js';

export const MESSAGE_NATIVE = CONSTANTS.MESSAGES.NATIVE;
export const MESSAGE_NATIVE = MESSAGES.NATIVE;
export const ACTION_RESIZE = 'resizeNativeHeight';
export const ACTION_CLICK = 'click';
export const ACTION_IMP = 'fireNativeImpressionTrackers';
Expand Down
3 changes: 1 addition & 2 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -295,8 +295,7 @@ function bundle(dev, moduleArr) {
[coreFile].concat(moduleFiles).map(name => path.basename(name)).forEach((file) => {
(depGraph[file] || []).forEach((dep) => dependencies.add(helpers.getBuiltPath(dev, dep)));
});

const entries = [coreFile].concat(Array.from(dependencies), moduleFiles);
const entries = _.uniq([coreFile].concat(Array.from(dependencies), moduleFiles));

var outputFileName = argv.bundleName ? argv.bundleName : 'prebid.js';

Expand Down
8 changes: 7 additions & 1 deletion integrationExamples/gpt/adnuntius_example.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
bidder: 'adnuntius',
params: {
auId: "201208",
network: "adnuntius",
network: "1287",
bidType: 'netBid'
}
}]
Expand Down Expand Up @@ -50,6 +50,12 @@
}
});

pbjs.bidderSettings = {
standard: {
storageAllowed: true
}
};

pbjs.addAdUnits(adUnits);
pbjs.requestBids({bidsBackHandler: initAdserver});
});
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
<!DOCTYPE html>
<html lang="en">
<head>

/* Paste JW Player script tag here */

<script async src="../../build/dev/prebid.js"></script>
<script async src="https://www.googletagservices.com/tag/js/gpt.js"></script>
<meta charset="UTF-8">
<title>JW Player RTD Provider Example</title>
<script>
var FAILSAFE_TIMEOUT = 3300;
var PREBID_TIMEOUT = 1000;

var adUnits = [{
code: 'div-gpt-ad-1460505748561-0',
code: 'video-ad-unit',
ortb2Imp: {
ext: {
data: {
Expand All @@ -23,16 +25,21 @@
}
},
mediaTypes: {
banner: {
sizes: [[300, 250], [300,600]],
video: {
sizes: [[320, 460]],
mimes : ["video/mp4"],
minduration : 3,
maxduration: 30,
protocols : [1,2]
}
},
// Replace this object to test a new Adapter!
bids: [{
bidder: 'appnexus',
params: {
placementId: 13144370
}
bidder: 'ix',
params: {
siteId: '300',
video: {}
}
}]
}];

Expand All @@ -41,11 +48,6 @@
</script>

<script>
var googletag = googletag || {};
googletag.cmd = googletag.cmd || [];
googletag.cmd.push(function() {
googletag.pubads().disableInitialLoad();
});

pbjs.que.push(function() {
pbjs.setConfig({
Expand All @@ -63,44 +65,28 @@
});
pbjs.addAdUnits(adUnits);
pbjs.requestBids({
bidsBackHandler: sendAdserverRequest,
bidsBackHandler: renderHighestBid,
timeout: PREBID_TIMEOUT
});
});

function sendAdserverRequest() {
if (pbjs.adserverRequestSent) return;
pbjs.adserverRequestSent = true;
googletag.cmd.push(function() {
pbjs.que.push(function() {
pbjs.setTargetingForGPTAsync();
googletag.pubads().refresh();
});
});
}

setTimeout(function() {
sendAdserverRequest();
}, FAILSAFE_TIMEOUT);

</script>
function renderHighestBid() {
const highestBids = pbjs.getHighestCpmBids('video-ad-unit');
const highestBid = highestBids && highestBids.length && highestBids[0];
if (!highestBid) {
return;
}

<script>
googletag.cmd.push(function () {
googletag.defineSlot('/19968336/header-bid-tag-0', [[300, 250], [300, 600]], 'div-gpt-ad-1460505748561-0').addService(googletag.pubads());
if (highestBid.vastXml) {
jwplayer().loadAdXml(highestBid.vastXml);
} else if (highestBid.vastUrl) {
jwplayer().loadAdTag(highestBid.vastUrl);
}
}

googletag.pubads().enableSingleRequest();
googletag.enableServices();
});
</script>
</head>

<body>
<h5>Div-1</h5>
<div id='div-gpt-ad-1460505748561-0'>
<script type='text/javascript'>
googletag.cmd.push(function() { googletag.display('div-gpt-ad-1460505748561-0'); });
</script>
</div>
</body>
</html>
3 changes: 1 addition & 2 deletions karma.conf.maker.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@ function newWebpackConfig(codeCoverage, disableFeatures) {
mode: 'development',
devtool: 'inline-source-map',
});

delete webpackConfig.entry;
['entry', 'optimization'].forEach(prop => delete webpackConfig[prop]);

webpackConfig.module.rules
.flatMap((r) => r.use)
Expand Down
8 changes: 4 additions & 4 deletions libraries/analyticsAdapter/AnalyticsAdapter.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import CONSTANTS from '../../src/constants.json';
import { EVENTS } from '../../src/constants.js';
import {ajax} from '../../src/ajax.js';
import {logError, logMessage} from '../../src/utils.js';
import * as events from '../../src/events.js';
Expand All @@ -9,8 +9,8 @@ export const _internal = {
const ENDPOINT = 'endpoint';
const BUNDLE = 'bundle';

export const DEFAULT_INCLUDE_EVENTS = Object.values(CONSTANTS.EVENTS)
.filter(ev => ev !== CONSTANTS.EVENTS.AUCTION_DEBUG);
export const DEFAULT_INCLUDE_EVENTS = Object.values(EVENTS)
.filter(ev => ev !== EVENTS.AUCTION_DEBUG);

let debounceDelay = 100;

Expand Down Expand Up @@ -114,7 +114,7 @@ export default function AnalyticsAdapter({ url, analyticsType, global, handler }
const trackedEvents = (() => {
const {includeEvents = DEFAULT_INCLUDE_EVENTS, excludeEvents = []} = (config || {});
return new Set(
Object.values(CONSTANTS.EVENTS)
Object.values(EVENTS)
.filter(ev => includeEvents.includes(ev))
.filter(ev => !excludeEvents.includes(ev))
);
Expand Down
6 changes: 2 additions & 4 deletions modules/33acrossAnalyticsAdapter.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
import { deepAccess, logInfo, logWarn, logError, deepClone } from '../src/utils.js';
import buildAdapter from '../libraries/analyticsAdapter/AnalyticsAdapter.js';
import adapterManager, { coppaDataHandler, gdprDataHandler, gppDataHandler, uspDataHandler } from '../src/adapterManager.js';
import CONSTANTS from '../src/constants.json';

/**
* @typedef {typeof import('../src/constants.json').EVENTS} EVENTS
* @typedef {typeof import('../src/constants.js').EVENTS} EVENTS
*/
const { EVENTS } = CONSTANTS;
import { EVENTS } from '../src/constants.js';

/** @typedef {'pending'|'available'|'targetingSet'|'rendered'|'timeout'|'rejected'|'noBid'|'error'} BidStatus */
/**
Expand Down
20 changes: 9 additions & 11 deletions modules/adWMGAnalyticsAdapter.js
Original file line number Diff line number Diff line change
@@ -1,20 +1,18 @@
import adapter from '../libraries/analyticsAdapter/AnalyticsAdapter.js';
import adapterManager from '../src/adapterManager.js';
import CONSTANTS from '../src/constants.json';
import { EVENTS } from '../src/constants.js';
import { ajax } from '../src/ajax.js';
const analyticsType = 'endpoint';
const url = 'https://analytics.wmgroup.us/analytic/collection';
const {
EVENTS: {
AUCTION_INIT,
AUCTION_END,
BID_REQUESTED,
BID_WON,
BID_TIMEOUT,
NO_BID,
BID_RESPONSE
}
} = CONSTANTS;
AUCTION_INIT,
AUCTION_END,
BID_REQUESTED,
BID_WON,
BID_TIMEOUT,
NO_BID,
BID_RESPONSE
} = EVENTS;

let timestampInit = null;

Expand Down
Loading

0 comments on commit 072edef

Please sign in to comment.