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
DeepthiNeeladri authored Jan 17, 2024
2 parents 3a6084d + d6c39f5 commit 5bc22a1
Show file tree
Hide file tree
Showing 316 changed files with 21,675 additions and 5,892 deletions.
35 changes: 33 additions & 2 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,25 @@ module.exports = {
node: {
moduleDirectory: ['node_modules', './']
}
},
'jsdoc': {
mode: 'typescript',
tagNamePreference: {
'tag constructor': 'constructor',
extends: 'extends',
method: 'method',
return: 'return',
}
}
},
extends: 'standard',
extends: [
'standard',
'plugin:jsdoc/recommended'
],
plugins: [
'prebid',
'import'
'import',
'jsdoc'
],
globals: {
'BROWSERSTACK_USERNAME': false,
Expand Down Expand Up @@ -46,6 +59,24 @@ module.exports = {
'no-undef': 2,
'no-useless-escape': 'off',
'no-console': 'error',
'jsdoc/check-types': 'off',
'jsdoc/newline-after-description': 'off',
'jsdoc/require-jsdoc': 'off',
'jsdoc/require-param': 'off',
'jsdoc/require-param-description': 'off',
'jsdoc/require-param-name': 'off',
'jsdoc/require-param-type': 'off',
'jsdoc/require-property': 'off',
'jsdoc/require-property-description': 'off',
'jsdoc/require-property-name': 'off',
'jsdoc/require-property-type': 'off',
'jsdoc/require-returns': 'off',
'jsdoc/require-returns-check': 'off',
'jsdoc/require-returns-description': 'off',
'jsdoc/require-returns-type': 'off',
'jsdoc/require-yields': 'off',
'jsdoc/require-yields-check': 'off',
'jsdoc/tag-lines': 'off'
},
overrides: Object.keys(allowedModules).map((key) => ({
files: key + '/**/*.js',
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ jobs:

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
uses: github/codeql-action/init@v3
with:
languages: ${{ matrix.language }}
config-file: ./.github/codeql/codeql-config.yml
Expand All @@ -57,7 +57,7 @@ jobs:
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v2
uses: github/codeql-action/autobuild@v3

# ℹ️ Command-line programs to run using the OS shell.
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
Expand All @@ -70,4 +70,4 @@ jobs:
# ./location_of_script_within_repo/buildscript.sh

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
uses: github/codeql-action/analyze@v3
27 changes: 22 additions & 5 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,20 @@ function makeWebpackPkg(extraConfig = {}) {
}
}

function buildCreative() {
return gulp.src(['**/*'])
.pipe(webpackStream(require('./webpack.creative.js')))
.pipe(gulp.dest('build/creative'))
}

function updateCreativeExample(cb) {
const CREATIVE_EXAMPLE = 'integrationExamples/gpt/x-domain/creative.html';
const root = require('node-html-parser').parse(fs.readFileSync(CREATIVE_EXAMPLE));
root.querySelectorAll('script')[0].textContent = fs.readFileSync('build/creative/creative.js')
fs.writeFileSync(CREATIVE_EXAMPLE, root.toString())
cb();
}

function getModulesListToAddInBanner(modules) {
if (!modules || modules.length === helpers.getModuleNames().length) {
return 'All available modules for this version.'
Expand Down Expand Up @@ -405,6 +419,7 @@ function watchTaskMaker(options = {}) {
return function watch(done) {
var mainWatcher = gulp.watch([
'src/**/*.js',
'libraries/**/*.js',
'modules/**/*.js',
].concat(options.alsoWatch));

Expand All @@ -415,8 +430,8 @@ function watchTaskMaker(options = {}) {
}
}

const watch = watchTaskMaker({alsoWatch: ['test/**/*.js'], task: () => gulp.series(clean, gulp.parallel(lint, 'build-bundle-dev', test))});
const watchFast = watchTaskMaker({livereload: false, task: () => gulp.series('build-bundle-dev')});
const watch = watchTaskMaker({alsoWatch: ['test/**/*.js'], task: () => gulp.series(clean, gulp.parallel(lint, 'build-bundle-dev', test, buildCreative))});
const watchFast = watchTaskMaker({livereload: false, task: () => gulp.parallel('build-bundle-dev', buildCreative)});

// support tasks
gulp.task(lint);
Expand Down Expand Up @@ -447,21 +462,23 @@ gulp.task('build-bundle-verbose', gulp.series(makeWebpackPkg({
}
}), gulpBundle.bind(null, false)));

gulp.task('build-creative', gulp.series(buildCreative, updateCreativeExample));

// public tasks (dependencies are needed for each task since they can be ran on their own)
gulp.task('test-only', test);
gulp.task('test-all-features-disabled', testTaskMaker({disableFeatures: require('./features.json'), oneBrowser: 'chrome', watch: false}));
gulp.task('test', gulp.series(clean, lint, gulp.series('test-all-features-disabled', 'test-only')));
gulp.task('test', gulp.series(clean, lint, gulp.parallel('build-creative', gulp.series('test-all-features-disabled', 'test-only'))));

gulp.task('test-coverage', gulp.series(clean, testCoverage));
gulp.task(viewCoverage);

gulp.task('coveralls', gulp.series('test-coverage', coveralls));

gulp.task('build', gulp.series(clean, 'build-bundle-prod'));
gulp.task('build', gulp.series(clean, 'build-bundle-prod', 'build-creative'));
gulp.task('build-postbid', gulp.series(escapePostbidConfig, buildPostbid));

gulp.task('serve', gulp.series(clean, lint, gulp.parallel('build-bundle-dev', watch, test)));
gulp.task('serve-fast', gulp.series(clean, gulp.parallel('build-bundle-dev', watchFast)));
gulp.task('serve-fast', gulp.series(clean, gulp.parallel('build-bundle-dev', buildCreative, watchFast)));
gulp.task('serve-prod', gulp.series(clean, gulp.parallel('build-bundle-prod', startLocalServer)));
gulp.task('serve-and-test', gulp.series(clean, gulp.parallel('build-bundle-dev', watchFast, testTaskMaker({watch: true}))));
gulp.task('serve-e2e', gulp.series(clean, 'build-bundle-prod', gulp.parallel(() => startIntegServer(), startLocalServer)));
Expand Down
91 changes: 91 additions & 0 deletions integrationExamples/gpt/contxtfulRtdProvider_example.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
<html>

<head>
<script src="http://localhost:9999/build/dev/prebid.js" async></script>
<script async src="https://www.googletagservices.com/tag/js/gpt.js"></script>
<script async>
const FAILSAFE_TIMEOUT = 8000;
const PREBID_TIMEOUT = 5000;

const bidders = [
{
bidder: 'appnexus',
params: {
placementId: 13144370
}
}
];

var adUnits = [
{
code: 'div-gpt-ad-1460505748561-0',
mediaTypes: {
banner: {
sizes: [[300, 250], [300, 600]],
}
},
bids: bidders,
}
];


var pbjs = pbjs || {};
pbjs.que = pbjs.que || [];
var googletag = googletag || {};
googletag.cmd = googletag.cmd || [];
googletag.cmd.push(function () {
googletag.pubads().disableInitialLoad();
googletag.defineSlot('/19968336/header-bid-tag-0', [[300, 250], [300, 600]], 'div-gpt-ad-1460505748561-0').addService(googletag.pubads());
googletag.pubads().enableSingleRequest();
googletag.enableServices();
});

pbjs.que.push(function () {
pbjs.setConfig({
debug: true,
realTimeData: {
auctionDelay: 100,
dataProviders: [
{
name: "contxtful",
waitForIt: true,
params: {
version: "Contact contact@contxtful.com for the API version",
customer: "Contact contact@contxtful.com for the customer ID"
}
}
]
}
});
pbjs.addAdUnits(adUnits);
pbjs.requestBids({
bidsBackHandler: sendAdserverRequest,
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>
</head>

<body>
<h2>Contxtful RTD Provider</h2>
<div id='div-gpt-ad-1460505748561-0'></div>
</div>
</body>

</html>
Loading

0 comments on commit 5bc22a1

Please sign in to comment.