Skip to content

Commit 0bc4a7f

Browse files
Merge remote-tracking branch 'upstream/master'
2 parents c23140e + 5426945 commit 0bc4a7f

422 files changed

Lines changed: 19574 additions & 5607 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@ For any user facing change, submit a link to a PR on the docs repo at https://gi
1616
<!-- Remove items that don't apply and/or select an item by changing [ ] to [x] -->
1717
- [ ] Bugfix
1818
- [ ] Feature
19-
- [ ] New bidder adapter <!-- IMPORTANT: if checking here, also submit your bidder params documentation here https://github.com/prebid/prebid.github.io/tree/master/dev-docs/bidders -->
19+
- [ ] New bidder adapter <!-- IMPORTANT: also submit your bidder parameter documentation as noted in https://docs.prebid.org/dev-docs/bidder-adaptor.html#submitting-your-adapter -->
20+
- [ ] Updated bidder adapter <!-- IMPORTANT: (1) consider whether you need to upgrade your bidder parameter documentation in https://github.com/prebid/prebid.github.io/tree/master/dev-docs/bidders and (2) if you have a Prebid Server adapter, please consider whether that should be updated as well. -->
2021
- [ ] Code style update (formatting, local variables)
2122
- [ ] Refactoring (no functional changes, no api changes)
2223
- [ ] Build related changes

README.md

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,16 @@ Or, if you are consuming Prebid through npm, with the `disableFeatures` option i
229229

230230
**Note**: this is still a work in progress - at the moment, `NATIVE` is the only feature that can be disabled this way, resulting in a minimal decrease in size (but you can expect that to improve over time).
231231

232+
## Unminified code
233+
234+
You can get a version of the code that's unminified for debugging with `build-bundle-dev`:
235+
236+
```bash
237+
gulp build-bundle-dev --modules=bidderA,module1,...
238+
```
239+
240+
The results will be in build/dev/prebid.js.
241+
232242
## Test locally
233243

234244
To lint the code:
@@ -237,6 +247,12 @@ To lint the code:
237247
gulp lint
238248
```
239249

250+
To lint and only show errors
251+
252+
```bash
253+
gulp lint --no-lint-warnings
254+
```
255+
240256
To run the unit tests:
241257

242258
```bash
@@ -245,7 +261,7 @@ gulp test
245261

246262
To run the unit tests for a particular file (example for pubmaticBidAdapter_spec.js):
247263
```bash
248-
gulp test --file "test/spec/modules/pubmaticBidAdapter_spec.js"
264+
gulp test --file "test/spec/modules/pubmaticBidAdapter_spec.js" --nolint
249265
```
250266

251267
To generate and view the code coverage reports:

allowedModules.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ module.exports = {
77
],
88
'src': [
99
'fun-hooks/no-eval',
10-
'just-clone',
10+
'klona',
1111
'dlv',
1212
'dset'
1313
],

creative/constants.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
// eslint-disable-next-line prebid/validate-imports
2-
import CONSTANTS from '../src/constants.json';
2+
import { AD_RENDER_FAILED_REASON, EVENTS, MESSAGES } from '../src/constants.js';
33

4-
export const MESSAGE_REQUEST = CONSTANTS.MESSAGES.REQUEST;
5-
export const MESSAGE_RESPONSE = CONSTANTS.MESSAGES.RESPONSE;
6-
export const MESSAGE_EVENT = CONSTANTS.MESSAGES.EVENT;
7-
export const EVENT_AD_RENDER_FAILED = CONSTANTS.EVENTS.AD_RENDER_FAILED;
8-
export const EVENT_AD_RENDER_SUCCEEDED = CONSTANTS.EVENTS.AD_RENDER_SUCCEEDED;
9-
export const ERROR_EXCEPTION = CONSTANTS.AD_RENDER_FAILED_REASON.EXCEPTION;
4+
export const MESSAGE_REQUEST = MESSAGES.REQUEST;
5+
export const MESSAGE_RESPONSE = MESSAGES.RESPONSE;
6+
export const MESSAGE_EVENT = MESSAGES.EVENT;
7+
export const EVENT_AD_RENDER_FAILED = EVENTS.AD_RENDER_FAILED;
8+
export const EVENT_AD_RENDER_SUCCEEDED = EVENTS.AD_RENDER_SUCCEEDED;
9+
export const ERROR_EXCEPTION = AD_RENDER_FAILED_REASON.EXCEPTION;
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
// eslint-disable-next-line prebid/validate-imports
2-
import CONSTANTS from '../../../src/constants.json';
2+
import { AD_RENDER_FAILED_REASON } from '../../../src/constants.js';
33

4-
export const ERROR_NO_AD = CONSTANTS.AD_RENDER_FAILED_REASON.NO_AD;
4+
export const ERROR_NO_AD = AD_RENDER_FAILED_REASON.NO_AD;

creative/renderers/native/constants.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// eslint-disable-next-line prebid/validate-imports
2-
import CONSTANTS from '../../../src/constants.json';
2+
import { MESSAGES } from '../../../src/constants.js';
33

4-
export const MESSAGE_NATIVE = CONSTANTS.MESSAGES.NATIVE;
4+
export const MESSAGE_NATIVE = MESSAGES.NATIVE;
55
export const ACTION_RESIZE = 'resizeNativeHeight';
66
export const ACTION_CLICK = 'click';
77
export const ACTION_IMP = 'fireNativeImpressionTrackers';

gulpfile.js

Lines changed: 57 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ var webpackStream = require('webpack-stream');
1111
var gulpClean = require('gulp-clean');
1212
var opens = require('opn');
1313
var webpackConfig = require('./webpack.conf.js');
14+
const standaloneDebuggingConfig = require('./webpack.debugging.js');
1415
var helpers = require('./gulpHelpers.js');
1516
var concat = require('gulp-concat');
1617
var replace = require('gulp-replace');
@@ -127,35 +128,56 @@ function viewReview(done) {
127128

128129
viewReview.displayName = 'view-review';
129130

130-
function makeDevpackPkg() {
131-
var cloned = _.cloneDeep(webpackConfig);
132-
Object.assign(cloned, {
133-
devtool: 'source-map',
134-
mode: 'development'
135-
})
131+
function makeVerbose(config = webpackConfig) {
132+
return _.merge({}, config, {
133+
optimization: {
134+
minimizer: [
135+
new TerserPlugin({
136+
parallel: true,
137+
terserOptions: {
138+
mangle: false,
139+
format: {
140+
comments: 'all'
141+
}
142+
},
143+
extractComments: false,
144+
}),
145+
],
146+
}
147+
});
148+
}
136149

137-
const babelConfig = require('./babelConfig.js')({disableFeatures: helpers.getDisabledFeatures(), prebidDistUrlBase: argv.distUrlBase || '/build/dev/'});
150+
function makeDevpackPkg(config = webpackConfig) {
151+
return function() {
152+
var cloned = _.cloneDeep(config);
153+
Object.assign(cloned, {
154+
devtool: 'source-map',
155+
mode: 'development'
156+
})
138157

139-
// update babel config to set local dist url
140-
cloned.module.rules
141-
.flatMap((rule) => rule.use)
142-
.filter((use) => use.loader === 'babel-loader')
143-
.forEach((use) => use.options = Object.assign({}, use.options, babelConfig));
158+
const babelConfig = require('./babelConfig.js')({disableFeatures: helpers.getDisabledFeatures(), prebidDistUrlBase: argv.distUrlBase || '/build/dev/'});
144159

145-
var externalModules = helpers.getArgModules();
160+
// update babel config to set local dist url
161+
cloned.module.rules
162+
.flatMap((rule) => rule.use)
163+
.filter((use) => use.loader === 'babel-loader')
164+
.forEach((use) => use.options = Object.assign({}, use.options, babelConfig));
146165

147-
const analyticsSources = helpers.getAnalyticsSources();
148-
const moduleSources = helpers.getModulePaths(externalModules);
166+
var externalModules = helpers.getArgModules();
167+
168+
const analyticsSources = helpers.getAnalyticsSources();
169+
const moduleSources = helpers.getModulePaths(externalModules);
149170

150-
return gulp.src([].concat(moduleSources, analyticsSources, 'src/prebid.js'))
151-
.pipe(helpers.nameModules(externalModules))
152-
.pipe(webpackStream(cloned, webpack))
153-
.pipe(gulp.dest('build/dev'))
154-
.pipe(connect.reload());
171+
return gulp.src([].concat(moduleSources, analyticsSources, 'src/prebid.js'))
172+
.pipe(helpers.nameModules(externalModules))
173+
.pipe(webpackStream(cloned, webpack))
174+
.pipe(gulp.dest('build/dev'))
175+
.pipe(connect.reload());
176+
}
155177
}
156178

157-
function makeWebpackPkg(extraConfig = {}) {
158-
var cloned = _.merge(_.cloneDeep(webpackConfig), extraConfig);
179+
function makeWebpackPkg(config = webpackConfig) {
180+
var cloned = _.cloneDeep(config)
159181
if (!argv.sourceMaps) {
160182
delete cloned.devtool;
161183
}
@@ -295,8 +317,7 @@ function bundle(dev, moduleArr) {
295317
[coreFile].concat(moduleFiles).map(name => path.basename(name)).forEach((file) => {
296318
(depGraph[file] || []).forEach((dep) => dependencies.add(helpers.getBuiltPath(dev, dep)));
297319
});
298-
299-
const entries = [coreFile].concat(Array.from(dependencies), moduleFiles);
320+
const entries = _.uniq([coreFile].concat(Array.from(dependencies), moduleFiles));
300321

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

@@ -447,7 +468,15 @@ function startLocalServer(options = {}) {
447468
port: port,
448469
host: INTEG_SERVER_HOST,
449470
root: './',
450-
livereload: options.livereload
471+
livereload: options.livereload,
472+
middleware: function () {
473+
return [
474+
function (req, res, next) {
475+
res.setHeader('Ad-Auction-Allowed', 'True');
476+
next();
477+
}
478+
];
479+
}
451480
});
452481
}
453482

@@ -488,26 +517,11 @@ gulp.task(escapePostbidConfig);
488517
gulp.task('build-creative-dev', gulp.series(buildCreative(argv.creativeDev ? 'development' : 'production'), updateCreativeRenderers));
489518
gulp.task('build-creative-prod', gulp.series(buildCreative(), updateCreativeRenderers));
490519

491-
gulp.task('build-bundle-dev', gulp.series('build-creative-dev', makeDevpackPkg, gulpBundle.bind(null, true)));
492-
gulp.task('build-bundle-prod', gulp.series('build-creative-prod', makeWebpackPkg(), gulpBundle.bind(null, false)));
520+
gulp.task('build-bundle-dev', gulp.series('build-creative-dev', makeDevpackPkg(standaloneDebuggingConfig), makeDevpackPkg(), gulpBundle.bind(null, true)));
521+
gulp.task('build-bundle-prod', gulp.series('build-creative-prod', makeWebpackPkg(standaloneDebuggingConfig), makeWebpackPkg(), gulpBundle.bind(null, false)));
493522
// build-bundle-verbose - prod bundle except names and comments are preserved. Use this to see the effects
494523
// of dead code elimination.
495-
gulp.task('build-bundle-verbose', gulp.series(makeWebpackPkg({
496-
optimization: {
497-
minimizer: [
498-
new TerserPlugin({
499-
parallel: true,
500-
terserOptions: {
501-
mangle: false,
502-
format: {
503-
comments: 'all'
504-
}
505-
},
506-
extractComments: false,
507-
}),
508-
],
509-
}
510-
}), gulpBundle.bind(null, false)));
524+
gulp.task('build-bundle-verbose', gulp.series('build-creative-dev', makeWebpackPkg(makeVerbose(standaloneDebuggingConfig)), makeWebpackPkg(makeVerbose()), gulpBundle.bind(null, true)));
511525

512526
// public tasks (dependencies are needed for each task since they can be ran on their own)
513527
gulp.task('test-only', test);

integrationExamples/gpt/adnuntius_example.html

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
bidder: 'adnuntius',
1818
params: {
1919
auId: "201208",
20-
network: "adnuntius",
20+
network: "1287",
2121
bidType: 'netBid'
2222
}
2323
}]
@@ -50,6 +50,12 @@
5050
}
5151
});
5252

53+
pbjs.bidderSettings = {
54+
standard: {
55+
storageAllowed: true
56+
}
57+
};
58+
5359
pbjs.addAdUnits(adUnits);
5460
pbjs.requestBids({bidsBackHandler: initAdserver});
5561
});
Lines changed: 112 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
1+
<html>
2+
<head>
3+
<script async src="../../build/dev/prebid.js"></script>
4+
<script async src="https://securepubads.g.doubleclick.net/tag/js/gpt.js"></script>
5+
<script>
6+
var FAILSAFE_TIMEOUT = 3300;
7+
var PREBID_TIMEOUT = 2000;
8+
9+
var adUnits = [{
10+
code: 'div-gpt-ad-1460505748561-0',
11+
mediaTypes: {
12+
banner: {
13+
sizes: [[300, 250], [300,600]],
14+
}
15+
},
16+
// Replace this object to test a new Adapter!
17+
bids: [
18+
{
19+
bidder: 'pubmatic',
20+
params: {
21+
publisherId: '156276', // required
22+
adSlot: 'pubmatic_test', // required
23+
}
24+
}
25+
]
26+
}];
27+
28+
var pbjs = pbjs || {};
29+
pbjs.que = pbjs.que || [];
30+
31+
</script>
32+
33+
<script>
34+
var googletag = googletag || {};
35+
googletag.cmd = googletag.cmd || [];
36+
googletag.cmd.push(function() {
37+
googletag.pubads().disableInitialLoad();
38+
});
39+
40+
pbjs.que.push(function() {
41+
pbjs.setConfig({
42+
debugging: {
43+
enabled: true
44+
},
45+
ortb2: {
46+
user: {
47+
data: [
48+
// Anonymised segment taxonomy inserted here
49+
]
50+
},
51+
},
52+
realTimeData: {
53+
dataProviders: [
54+
{
55+
name: "anonymised",
56+
params: {
57+
cohortStorageKey: "cohort_ids",
58+
bidders: ['smartadserver', 'appnexus'],
59+
segtax: 1000
60+
}
61+
}
62+
]
63+
}
64+
});
65+
pbjs.addAdUnits(adUnits);
66+
pbjs.requestBids({
67+
bidsBackHandler: sendAdserverRequest,
68+
timeout: PREBID_TIMEOUT
69+
});
70+
71+
document.getElementById( "user-segments" ).innerHTML = JSON.stringify( pbjs.getConfig('ortb2') );
72+
});
73+
74+
function sendAdserverRequest() {
75+
if (pbjs.adserverRequestSent) return;
76+
pbjs.adserverRequestSent = true;
77+
googletag.cmd.push(function() {
78+
pbjs.que.push(function() {
79+
pbjs.setTargetingForGPTAsync();
80+
googletag.pubads().refresh();
81+
});
82+
});
83+
}
84+
85+
setTimeout(function() {
86+
sendAdserverRequest();
87+
}, FAILSAFE_TIMEOUT);
88+
89+
</script>
90+
91+
<script>
92+
googletag.cmd.push(function () {
93+
googletag.defineSlot('/19968336/header-bid-tag-0', [[300, 250], [300, 600]], 'div-gpt-ad-1460505748561-0').addService(googletag.pubads());
94+
googletag.pubads().enableSingleRequest();
95+
googletag.enableServices();
96+
});
97+
</script>
98+
99+
<script>!function(a){var e="https://s.go-mpulse.net/boomerang/",t="addEventListener";if("False"=="True")a.BOOMR_config=a.BOOMR_config||{},a.BOOMR_config.PageParams=a.BOOMR_config.PageParams||{},a.BOOMR_config.PageParams.pci=!0,e="https://s2.go-mpulse.net/boomerang/";if(window.BOOMR_API_key="5G3ZS-8L7PG-U23WM-5CA4K-LQ3YP",function(){function n(e){a.BOOMR_onload=e&&e.timeStamp||(new Date).getTime()}if(!a.BOOMR||!a.BOOMR.version&&!a.BOOMR.snippetExecuted){a.BOOMR=a.BOOMR||{},a.BOOMR.snippetExecuted=!0;var i,_,o,r=document.createElement("iframe");if(a[t])a[t]("load",n,!1);else if(a.attachEvent)a.attachEvent("onload",n);r.src="javascript:void(0)",r.title="",r.role="presentation",(r.frameElement||r).style.cssText="width:0;height:0;border:0;display:none;",o=document.getElementsByTagName("script")[0],o.parentNode.insertBefore(r,o);try{_=r.contentWindow.document}catch(O){i=document.domain,r.src="javascript:var d=document.open();d.domain='"+i+"';void(0);",_=r.contentWindow.document}_.open()._l=function(){var a=this.createElement("script");if(i)this.domain=i;a.id="boomr-if-as",a.src=e+"5G3ZS-8L7PG-U23WM-5CA4K-LQ3YP",BOOMR_lstart=(new Date).getTime(),this.body.appendChild(a)},_.write("<bo"+'dy onload="document._l();">'),_.close()}}(),"".length>0)if(a&&"performance"in a&&a.performance&&"function"==typeof a.performance.setResourceTimingBufferSize)a.performance.setResourceTimingBufferSize();!function(){if(BOOMR=a.BOOMR||{},BOOMR.plugins=BOOMR.plugins||{},!BOOMR.plugins.AK){var e=""=="true"?1:0,t="",n="ghh4w4yxem66iyi6ijxa-f-a8f1ed317-clientnsv4-s.akamaihd.net",i="false"=="true"?2:1,_={"ak.v":"32","ak.cp":"540505","ak.ai":parseInt("351538",10),"ak.ol":"0","ak.cr":17,"ak.ipv":4,"ak.proto":"http/1.1","ak.rid":"322de403","ak.r":36326,"ak.a2":e,"ak.m":"dscx","ak.n":"essl","ak.bpcip":"49.207.203.0","ak.cport":5172,"ak.gh":"23.47.149.85","ak.quicv":"","ak.tlsv":"tls1.2","ak.0rtt":"","ak.csrc":"-","ak.acc":"bbr","ak.t":"1629373038","ak.ak":"hOBiQwZUYzCg5VSAfCLimQ==admFPBlxVf0VKeanKFKUThzq+or23aIaVFP5DBXpeOGEuvD5mQz0UZbvK242Y8cupS91bsNaM7uJT3/O00EszGTxlFhkv439YkTWfyegvqVlJhcrZ7jcRkIoyrmjoBqDZoF0WaG4rhwmNzkKEv6T1noRYwEWwRHOG8p7osPXWy5as6KkmhOYUiYk8S5hQj+HFzhYI5YUTx+8urmHdpVIDBkramcrT2V89mb0cH5L2bSGS2hahAA3Kkf+0Dul7r5hDFQaVTf17e4oKdM1G8cKVF5LGRxRl3v4Rn6tBJ+fjrJ7XYQWV30w1LPwcAmSfRX8iTCK4xzHwG1fwDFHb5tWVsxHeEkRgNN3/KhnrCjxKtaROjJeWypJf/rjn1HWHwy7uVVsP9f/HRN3drCCkEvJBmu6yi0jzFFCoeEkbUEoq+8=","ak.pv":"396","ak.dpoabenc":"","ak.tf":i};if(""!==t)_["ak.ruds"]=t;var o={i:!1,av:function(e){var t="http.initiator";if(e&&(!e[t]||"spa_hard"===e[t]))_["ak.feo"]=void 0!==a.aFeoApplied?1:0,BOOMR.addVar(_)},rv:function(){var a=["ak.bpcip","ak.cport","ak.cr","ak.csrc","ak.gh","ak.ipv","ak.m","ak.n","ak.ol","ak.proto","ak.quicv","ak.tlsv","ak.0rtt","ak.r","ak.acc","ak.t","ak.tf"];BOOMR.removeVar(a)}};BOOMR.plugins.AK={akVars:_,akDNSPreFetchDomain:n,init:function(){if(!o.i){var a=BOOMR.subscribe;a("before_beacon",o.av,null,null),a("onbeacon",o.rv,null,null),o.i=!0}return this},is_complete:function(){return!0}}}}()}(window);</script></head>
100+
101+
<body>
102+
<h2>Prebid.js Test</h2>
103+
<h5>Div-1</h5>
104+
<div id='div-gpt-ad-1460505748561-0'>
105+
<script type='text/javascript'>
106+
googletag.cmd.push(function() { googletag.display('div-gpt-ad-1460505748561-0'); });
107+
</script>
108+
</div>
109+
<h5>First Party Data (ortb2) Sent to Bidding Adapter</h5>
110+
<div id="user-segments"></div>
111+
</body>
112+
</html>

integrationExamples/gpt/azerionedgeRtdProvider_example.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,17 +40,17 @@
4040
{
4141
name: "azerionedge",
4242
waitForIt: true,
43-
params: { bidders: ["appnexus"] },
43+
params: { bidders: ["improvedigital"] },
4444
},
4545
],
4646
},
4747
});
48-
pbjs.setBidderConfig({ bidders: ["appnexus"], config: {} });
48+
pbjs.setBidderConfig({ bidders: ["improvedigital"], config: {} });
4949
pbjs.addAdUnits([
5050
{
5151
code: TEST_DIV,
5252
mediaTypes: { banner: { sizes: TEST_SIZES } },
53-
bids: [{ bidder: "appnexus", params: { placementId: 13144370 } }],
53+
bids: [{ bidder: "improvedigital", params: { placementId: 13144370 } }],
5454
},
5555
]);
5656
pbjs.requestBids({

0 commit comments

Comments
 (0)