Skip to content

Commit 4a01718

Browse files
Merge branch 'prebid:master' into master
2 parents 124a905 + dd6d27b commit 4a01718

25 files changed

+1674
-7284
lines changed

babelConfig.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ module.exports = function (options = {}) {
1616
useLocal('@babel/preset-env'),
1717
{
1818
'useBuiltIns': 'entry',
19-
'corejs': '3.13.0',
19+
'corejs': '3.42.0',
2020
// a lot of tests use sinon.stub & others that stopped working on ES6 modules with webpack 5
2121
'modules': options.test ? 'commonjs' : 'auto',
2222
}

gulpHelpers.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ const argv = require('yargs').argv;
55
const MANIFEST = 'package.json';
66
const through = require('through2');
77
const _ = require('lodash');
8-
const gutil = require('gulp-util');
8+
const gutil = require('plugin-error');
99
const submodules = require('./modules/.submodules.json').parentModules;
1010

1111
const MODULE_PATH = './modules';

gulpfile.js

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
var _ = require('lodash');
55
var argv = require('yargs').argv;
66
var gulp = require('gulp');
7-
var gutil = require('gulp-util');
7+
var gutil = require('plugin-error');
8+
var fancyLog = require('fancy-log');
89
var connect = require('gulp-connect');
910
var webpack = require('webpack');
1011
var webpackStream = require('webpack-stream');
@@ -17,7 +18,6 @@ var concat = require('gulp-concat');
1718
var replace = require('gulp-replace');
1819
var shell = require('gulp-shell');
1920
var gulpif = require('gulp-if');
20-
var sourcemaps = require('gulp-sourcemaps');
2121
var through = require('through2');
2222
var fs = require('fs');
2323
var jsEscape = require('gulp-js-escape');
@@ -193,7 +193,7 @@ function buildCreative(mode = 'production') {
193193
opts.devtool = 'inline-source-map'
194194
}
195195
return function() {
196-
return gulp.src(['**/*'])
196+
return gulp.src(['creative/**/*'])
197197
.pipe(webpackStream(Object.assign(require('./webpack.creative.js'), opts)))
198198
.pipe(gulp.dest('build/creative'))
199199
}
@@ -229,7 +229,8 @@ function getModulesListToAddInBanner(modules) {
229229
}
230230

231231
function gulpBundle(dev) {
232-
return bundle(dev).pipe(gulp.dest('build/' + (dev ? 'dev' : 'dist')));
232+
const sm = dev || argv.sourceMaps;
233+
return bundle(dev).pipe(gulp.dest('build/' + (dev ? 'dev' : 'dist'), {sourcemaps: sm ? '.' : false}));
233234
}
234235

235236
function nodeBundle(modules, dev = false) {
@@ -318,15 +319,13 @@ function bundle(dev, moduleArr) {
318319
outputFileName = outputFileName.replace(/\.js$/, `.${argv.tag}.js`);
319320
}
320321

321-
gutil.log('Concatenating files:\n', entries);
322-
gutil.log('Appending ' + prebid.globalVarName + '.processQueue();');
323-
gutil.log('Generating bundle:', outputFileName);
322+
fancyLog('Concatenating files:\n', entries);
323+
fancyLog('Appending ' + prebid.globalVarName + '.processQueue();');
324+
fancyLog('Generating bundle:', outputFileName);
324325

325326
const wrap = wrapWithHeaderAndFooter(dev, modules);
326-
return wrap(gulp.src(entries))
327-
.pipe(gulpif(sm, sourcemaps.init({ loadMaps: true })))
328-
.pipe(concat(outputFileName))
329-
.pipe(gulpif(sm, sourcemaps.write('.')));
327+
return wrap(gulp.src(entries, {sourcemaps: sm}))
328+
.pipe(concat(outputFileName));
330329
}
331330

332331
function setupDist() {
@@ -408,7 +407,10 @@ function runWebdriver({file}) {
408407
wdioConf
409408
];
410409
}
411-
return execa(wdioCmd, wdioOpts, { stdio: 'inherit' });
410+
return execa(wdioCmd, wdioOpts, {
411+
stdio: 'inherit',
412+
env: Object.assign({}, process.env, {FORCE_COLOR: '1'})
413+
});
412414
}
413415

414416
function runKarma(options, done) {
@@ -440,7 +442,8 @@ function testCoverage(done) {
440442
watch: false,
441443
file: argv.file,
442444
env: {
443-
NODE_OPTIONS: '--max-old-space-size=8096'
445+
NODE_OPTIONS: '--max-old-space-size=8096',
446+
TEST_CHUNKS: '1'
444447
}
445448
}, done);
446449
}

karma.conf.maker.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ function newPluginsArray(browserstack) {
4040
var plugins = [
4141
'karma-chrome-launcher',
4242
'karma-coverage',
43-
'karma-es5-shim',
4443
'karma-mocha',
4544
'karma-chai',
4645
'karma-sinon',
@@ -56,7 +55,6 @@ function newPluginsArray(browserstack) {
5655
plugins.push('karma-opera-launcher');
5756
plugins.push('karma-safari-launcher');
5857
plugins.push('karma-script-launcher');
59-
plugins.push('karma-ie-launcher');
6058
return plugins;
6159
}
6260

@@ -134,7 +132,7 @@ module.exports = function(codeCoverage, browserstack, watchMode, file, disableFe
134132
},
135133
// frameworks to use
136134
// available frameworks: https://npmjs.org/browse/keyword/karma-adapter
137-
frameworks: ['es5-shim', 'mocha', 'chai', 'sinon', 'webpack'],
135+
frameworks: ['mocha', 'chai', 'sinon', 'webpack'],
138136

139137
// test files should not be watched or they'll run twice after an update
140138
// (they are still, in fact, watched through autoWatch: true)

libraries/advangUtils/index.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import { deepAccess, generateUUID, isFn, parseSizesInput, parseUrl } from '../../src/utils.js';
22
import { config } from '../../src/config.js';
3-
import { find } from '../../src/polyfill.js';
43

54
export const DEFAULT_MIMES = ['video/mp4', 'application/javascript'];
65

@@ -77,7 +76,7 @@ export function getOsVersion() {
7776
{ s: 'UNIX', r: /UNIX/ },
7877
{ s: 'Search Bot', r: /(nuhk|Googlebot|Yammybot|Openbot|Slurp|MSNBot|Ask Jeeves\/Teoma|ia_archiver)/ }
7978
];
80-
let cs = find(clientStrings, cs => cs.r.test(navigator.userAgent));
79+
let cs = clientStrings.find(cs => cs.r.test(navigator.userAgent));
8180
return cs ? cs.s : 'unknown';
8281
}
8382

libraries/browsiUtils/browsiUtils.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import { isGptPubadsDefined, logError } from '../../src/utils.js';
22
import { setKeyValue as setGptKeyValue } from '../../libraries/gptUtils/gptUtils.js';
3-
import { find } from '../../src/polyfill.js';
43

54
/** @type {string} */
65
const VIEWABILITY_KEYNAME = 'browsiViewability';
@@ -89,7 +88,7 @@ export function getSlotByCode(code) {
8988
if (!slots || !slots.length) {
9089
return null;
9190
}
92-
return find(slots, s => s.getSlotElementId() === code || s.getAdUnitPath() === code) || null;
91+
return slots.find(s => s.getSlotElementId() === code || s.getAdUnitPath() === code) || null;
9392
}
9493

9594
function getLocalStorageData(storage) {

libraries/gptUtils/gptUtils.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import { CLIENT_SECTIONS } from '../../src/fpd/oneClient.js';
2-
import {find} from '../../src/polyfill.js';
32
import {compareCodeAndSlot, deepAccess, isGptPubadsDefined, uniques} from '../../src/utils.js';
43

54
/**
@@ -30,7 +29,7 @@ export function getGptSlotForAdUnitCode(adUnitCode) {
3029
let matchingSlot;
3130
if (isGptPubadsDefined()) {
3231
// find the first matching gpt slot on the page
33-
matchingSlot = find(window.googletag.pubads().getSlots(), isSlotMatchingAdUnitCode(adUnitCode));
32+
matchingSlot = window.googletag.pubads().getSlots().find(isSlotMatchingAdUnitCode(adUnitCode));
3433
}
3534
return matchingSlot;
3635
}

modules/conversantBidAdapter.js

Lines changed: 0 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,17 @@
11
import {
22
buildUrl,
33
deepAccess,
4-
deepSetValue,
54
getBidIdParameter,
65
isArray,
76
isFn,
87
isPlainObject,
98
isStr,
10-
logError,
119
logWarn,
1210
mergeDeep,
1311
parseUrl,
1412
} from '../src/utils.js';
1513
import {registerBidder} from '../src/adapters/bidderFactory.js';
1614
import {BANNER, NATIVE, VIDEO} from '../src/mediaTypes.js';
17-
import {getStorageManager} from '../src/storageManager.js';
1815
import {ortbConverter} from '../libraries/ortbConverter/converter.js';
1916
import {ORTB_MTYPES} from '../libraries/ortbConverter/processors/mediaType.js';
2017

@@ -30,7 +27,6 @@ import {ORTB_MTYPES} from '../libraries/ortbConverter/processors/mediaType.js';
3027
const GVLID = 24;
3128

3229
const BIDDER_CODE = 'conversant';
33-
export const storage = getStorageManager({gvlid: GVLID, bidderCode: BIDDER_CODE});
3430
const URL = 'https://web.hb.ad.cpe.dotomi.com/cvx/client/hb/ortb/25';
3531

3632
function setSiteId(bidRequest, request) {
@@ -44,14 +40,6 @@ function setSiteId(bidRequest, request) {
4440
}
4541
}
4642

47-
function setPubcid(bidRequest, request) {
48-
// Add common id if available
49-
const pubcid = getPubcid(bidRequest);
50-
if (pubcid) {
51-
deepSetValue(request, 'user.ext.fpc', pubcid);
52-
}
53-
}
54-
5543
const converter = ortbConverter({
5644
context: {
5745
netRevenue: true,
@@ -64,7 +52,6 @@ const converter = ortbConverter({
6452
if (context.bidRequests) {
6553
const bidRequest = context.bidRequests[0];
6654
setSiteId(bidRequest, request);
67-
setPubcid(bidRequest, request);
6855
}
6956

7057
return request;
@@ -224,20 +211,6 @@ export const spec = {
224211
}
225212
};
226213

227-
function getPubcid(bidRequest) {
228-
let pubcid = null;
229-
if (bidRequest.userId && bidRequest.userId.pubcid) {
230-
pubcid = bidRequest.userId.pubcid;
231-
} else if (bidRequest.crumbs && bidRequest.crumbs.pubcid) {
232-
pubcid = bidRequest.crumbs.pubcid;
233-
}
234-
if (!pubcid) {
235-
const pubcidName = getBidIdParameter('pubcid_name', bidRequest.params) || '_pubcid';
236-
pubcid = readStoredValue(pubcidName);
237-
}
238-
return pubcid;
239-
}
240-
241214
/**
242215
* Check if it's a video bid request
243216
*
@@ -261,37 +234,6 @@ function copyOptProperty(src, dst, dstName) {
261234
}
262235
}
263236

264-
/**
265-
* Look for a stored value from both cookie and local storage and return the first value found.
266-
* @param key Key for the search
267-
* @return {string} Stored value
268-
*/
269-
function readStoredValue(key) {
270-
let storedValue;
271-
try {
272-
// check cookies first
273-
storedValue = storage.getCookie(key);
274-
275-
if (!storedValue) {
276-
// check expiration time before reading local storage
277-
const storedValueExp = storage.getDataFromLocalStorage(`${key}_exp`);
278-
if (storedValueExp === '' || (storedValueExp && (new Date(storedValueExp)).getTime() - Date.now() > 0)) {
279-
storedValue = storage.getDataFromLocalStorage(key);
280-
storedValue = storedValue ? decodeURIComponent(storedValue) : storedValue;
281-
}
282-
}
283-
284-
// deserialize JSON if needed
285-
if (isStr(storedValue) && storedValue.charAt(0) === '{') {
286-
storedValue = JSON.parse(storedValue);
287-
}
288-
} catch (e) {
289-
logError(e);
290-
}
291-
292-
return storedValue;
293-
}
294-
295237
/**
296238
* Get the floor price from bid.params for backward compatibility.
297239
* If not found, then check floor module.

modules/czechAdIdSystem.js

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,18 @@ import {MODULE_TYPE_UID} from '../src/activities/modules.js';
1818
export const storage = getStorageManager({ moduleType: MODULE_TYPE_UID, moduleName: 'czechAdId' })
1919

2020
// Returns the id string from either cookie or localstorage
21-
const readId = () => { return storage.getCookie('czaid') || storage.getDataFromLocalStorage('czaid') }
21+
const readId = () => {
22+
const id = storage.getCookie('czaid') || storage.getDataFromLocalStorage('czaid')
23+
return id && isValidUUID(id) ? id : null
24+
}
25+
const isValidUUID = (str) => {
26+
const uuidRegex = /^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-5][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}$/
27+
return uuidRegex.test(str)
28+
}
2229

2330
/** @type {Submodule} */
2431
export const czechAdIdSubmodule = {
25-
version: '0.1.0',
32+
version: '0.1.1',
2633
/**
2734
* used to link submodule with config
2835
* @type {string}
@@ -38,7 +45,10 @@ export const czechAdIdSubmodule = {
3845
* @function decode
3946
* @returns {(Object|undefined)}
4047
*/
41-
decode () { return { czechAdId: readId() } },
48+
decode () {
49+
const id = readId()
50+
return id ? { czechAdId: readId() } : undefined
51+
},
4252
/**
4353
* performs action to obtain id and return a value in the callback's response argument
4454
* @function

modules/microadBidAdapter.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import { deepAccess, isArray, isEmpty, isStr } from '../src/utils.js';
2-
import { } from '../src/polyfill.js';
32
import { registerBidder } from '../src/adapters/bidderFactory.js';
43
import { BANNER } from '../src/mediaTypes.js';
54
import { convertOrtbRequestToProprietaryNative } from '../src/native.js';

0 commit comments

Comments
 (0)