Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
Rachel Joyce committed Aug 28, 2018
2 parents 781b6f6 + fa78634 commit 67b5fa1
Show file tree
Hide file tree
Showing 13 changed files with 135 additions and 42 deletions.
24 changes: 21 additions & 3 deletions RELEASE_SCHEDULE.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,17 @@ Announcements regarding releases will be made to the #headerbidding-dev channel

## Release Process

_Note: If `github.com/prebid/Prebid.js` is not configured as the git origin for your repo, all of the following git commands will have to be modified to reference the proper remote (e.g. `upstream`)_

1. Make Sure all browserstack tests are passing. On PR merge to master CircleCI will run unit tests on browserstack. Checking the last CircleCI build [here](https://circleci.com/gh/prebid) for master branch will show you detailed results.

In case of failure do following,
- Try to fix the failing tests.
- If you are not able to fix tests in time. Skip the test, create issue and tag contributor.

#### How to run tests in browserstack

_Note: the following browserstack information is only relevant for debugging purposes, if you will not be debugging then it can be skipped._

Set the environment variables. You may want to add these to your `~/.bashrc` for convenience.

Expand Down Expand Up @@ -59,11 +63,12 @@ Announcements regarding releases will be made to the #headerbidding-dev channel
Pull these changes locally by running command
```
git pull
git fetch --tags
```

and verify the tag.

5. Update coveralls
5. Update coveralls _(skip for legacy)_

We use https://coveralls.io/ to show parts of code covered by unit tests.

Expand All @@ -75,22 +80,35 @@ Announcements regarding releases will be made to the #headerbidding-dev channel

Run `gulp coveralls` to update code coverage history.

6. Distribute the code
6. Distribute the code

_Note: do not go to step 7 until step 6 has been verified completed._

Reach out to any of the Appnexus folks to trigger the jenkins job.

// TODO
Jenkins job is moving files to appnexus cdn, pushing prebid.js to npm, purging cache and sending notification to slack.
Move all the files from Appnexus CDN to jsDelivr and create bash script to do above tasks.

7. Post Release Steps
7. Post Release Version

Update the version
Manually edit Prebid's package.json to become "1.x.x-pre" (using the values for the next release). Then commit your changes.
```
git commit -m "Increment pre version"
git push
```

8. Create new release draft

Go to [github releases](https://github.com/prebid/Prebid.js/releases) and add a new draft for the next version of Prebid.js with the following template:
```
## 🚀New Features
## 🛠Maintenance
## 🐛Bug Fixes
```

## Beta Releases

Expand Down
16 changes: 10 additions & 6 deletions modules/adoceanBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,15 @@ function buildEndpointUrl(emiter, payload) {
return 'https://' + emiter + '/ad.json?' + payloadString;
}

function buildRequest(masterBidRequests, masterId) {
function buildRequest(masterBidRequests, masterId, gdprConsent) {
const firstBid = masterBidRequests[0];
const payload = {
id: masterId,
};
if (gdprConsent) {
payload.gdpr_consent = gdprConsent.consentString || undefined;
payload.gdpr = gdprConsent.gdprApplies ? 1 : 0;
}

const bidIdMap = {};

Expand Down Expand Up @@ -72,15 +76,15 @@ export const spec = {
return !!(bid.params.slaveId && bid.params.masterId && bid.params.emiter);
},

buildRequests: function(validBidRequests) {
buildRequests: function(validBidRequests, bidderRequest) {
const bidRequestsByMaster = {};
let requests = [];

utils._each(validBidRequests, function(v) {
assignToMaster(v, bidRequestsByMaster);
utils._each(validBidRequests, function(bidRequest) {
assignToMaster(bidRequest, bidRequestsByMaster);
});
requests = utils._map(bidRequestsByMaster, function(v, k) {
return buildRequest(v, k);
requests = utils._map(bidRequestsByMaster, function(requests, masterId) {
return buildRequest(requests, masterId, bidderRequest.gdprConsent);
});

return requests;
Expand Down
32 changes: 17 additions & 15 deletions modules/appnexusBidAdapter.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,58 +22,59 @@ var adUnits = [
banner: {
sizes: [[300, 250], [300,600]]
}
}
},
bids: [{
bidder: 'appnexus',
params: {
placementId: '10433394'
placementId: 13144370
}
}]
},
// Native adUnit
{
code: 'native-div',
sizes: [[300, 250], [300,600]],
sizes: [[1, 1]],
mediaTypes: {
native: {
title: {
required: true,
len: 80
},
body: {
required: true
},
brand: {
body: {
required: true
},
image: {
required: true
},
clickUrl: {
sponsoredBy: {
required: true
},
icon: {
required: false
}
}
},
bids: [{
bidder: 'appnexus',
params: {
placementId: '9880618'
placementId: 13232354,
allowSmallerSizes: true
}
}]
},
// Video instream adUnit
{
code: 'video-instream',
sizes: [640, 480],
sizes: [[640, 480]],
mediaTypes: {
video: {
playerSize: [[640, 480]],
context: 'instream'
},
},
bids: [{
bidder: 'appnexus',
params: {
placementId: '9333431',
placementId: 13232361,
video: {
skippable: true,
playback_methods: ['auto_play_sound_off']
Expand All @@ -84,17 +85,18 @@ var adUnits = [
// Video outstream adUnit
{
code: 'video-outstream',
sizes: [[640, 480]],
sizes: [[300, 250]],
mediaTypes: {
video: {
playerSize: [[300, 250]],
context: 'outstream'
}
},
bids: [
{
bidder: 'appnexus',
params: {
placementId: '5768085',
placementId: 13232385,
video: {
skippable: true,
playback_method: ['auto_play_sound_off']
Expand All @@ -116,7 +118,7 @@ var adUnits = [
bids: [{
bidder: 'appnexus',
params: {
placementId: '10433394',
placementId: 13144370,
app: {
id: "B1O2W3M4AN.com.prebid.webview",
geo: {
Expand Down
30 changes: 27 additions & 3 deletions modules/oneVideoBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,17 @@ export const spec = {
* Make a server request from the list of BidRequests.
*
* @param {validBidRequests[]} - an array of bids
* @param bidderRequest
* @return ServerRequest Info describing the request to the server.
*/
buildRequests: function(bids) {
buildRequests: function(bids, bidRequest) {
let consentData = bidRequest ? bidRequest.gdprConsent : null;

return bids.map(bid => {
return {
method: 'POST',
url: location.protocol + spec.ENDPOINT + bid.params.pubId,
data: getRequestData(bid),
data: getRequestData(bid, consentData),
options: {contentType: 'application/json'},
bidRequest: bid
}
Expand Down Expand Up @@ -127,7 +130,11 @@ function getSize(sizes) {
};
}

function getRequestData(bid) {
function isConsentRequired(consentData) {
return !!(consentData && consentData.gdprApplies);
}

function getRequestData(bid, consentData) {
let loc = utils.getTopWindowLocation();
let global = (window.top) ? window.top : window;
let page = (bid.params.site && bid.params.site.page) ? (bid.params.site.page) : (loc.href);
Expand Down Expand Up @@ -179,6 +186,23 @@ function getRequestData(bid) {
if (bid.params.site && bid.params.site.id) {
bidData.site.id = bid.params.site.id
}

if (isConsentRequired(consentData)) {
bidData.regs = {
ext: {
gdpr: 1
}
};

if (consentData.consentString) {
bidData.user = {
ext: {
consent: consentData.consentString
}
};
}
}

return bidData;
}

Expand Down
4 changes: 2 additions & 2 deletions modules/openxBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {parse} from 'src/url';
const SUPPORTED_AD_TYPES = [BANNER, VIDEO];
const BIDDER_CODE = 'openx';
const BIDDER_CONFIG = 'hb_pb';
const BIDDER_VERSION = '2.1.3';
const BIDDER_VERSION = '2.1.4';

let shouldSendBoPixel = true;

Expand Down Expand Up @@ -201,6 +201,7 @@ function buildCommonQueryParamsFromBids(bids, bidderRequest) {
tz: new Date().getTimezoneOffset(),
tws: getViewportDimensions(isInIframe),
be: 1,
bc: bids[0].params.bc || `${BIDDER_CONFIG}_${BIDDER_VERSION}`,
dddid: utils._map(bids, bid => bid.transactionId).join(','),
nocache: new Date().getTime()
};
Expand Down Expand Up @@ -230,7 +231,6 @@ function buildOXBannerRequest(bids, bidderRequest) {
let queryParams = buildCommonQueryParamsFromBids(bids, bidderRequest);
let auids = utils._map(bids, bid => bid.params.unit);
queryParams.aus = utils._map(bids, bid => utils.parseSizesInput(bid.sizes).join(',')).join('|');
queryParams.bc = bids[0].params.bc || `${BIDDER_CONFIG}_${BIDDER_VERSION}`;
queryParams.divIds = utils._map(bids, bid => encodeURIComponent(bid.adUnitCode)).join(',');

if (auids.some(auid => auid)) {
Expand Down
1 change: 1 addition & 0 deletions modules/rubiconBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ var sizeMap = {
199: '640x200',
213: '1030x590',
214: '980x360',
229: '320x180',
232: '580x400',
257: '400x600'
};
Expand Down
3 changes: 0 additions & 3 deletions modules/sonobiBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,6 @@ export const spec = {
if (validBidRequests[0].params.referrer) {
payload.ref = validBidRequests[0].params.referrer;
}
if (validBidRequests[0].params.render) {
payload.render = validBidRequests[0].params.render;
}

// Apply GDPR parameters to request.
if (bidderRequest && bidderRequest.gdprConsent) {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "prebid.js",
"version": "1.22.0-pre",
"version": "1.23.0-pre",
"description": "Header Bidding Management Library",
"main": "src/prebid.js",
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion src/secureCreatives.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ function receiveMessage(ev) {
return;
}

if (data.adId) {
if (data && data.adId) {
const adObject = find(auctionManager.getBidsReceived(), function (bid) {
return bid.adId === data.adId;
});
Expand Down
19 changes: 16 additions & 3 deletions test/spec/modules/adoceanBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,23 +57,36 @@ describe('AdoceanAdapter', () => {
}
];

const bidderRequest = {
gdprConsent: {
consentString: 'BOQHk-4OSlWKFBoABBPLBd-AAAAgWAHAACAAsAPQBSACmgFTAOkA',
gdprApplies: true
}
};

it('should add bidIdMap with slaveId => bidId mapping', () => {
const request = spec.buildRequests(bidRequests)[0];
const request = spec.buildRequests(bidRequests, bidderRequest)[0];
expect(request.bidIdMap).to.exists;
const bidIdMap = request.bidIdMap;
expect(bidIdMap[bidRequests[0].params.slaveId]).to.equal(bidRequests[0].bidId);
});

it('sends bid request to url via GET', () => {
const request = spec.buildRequests(bidRequests)[0];
const request = spec.buildRequests(bidRequests, bidderRequest)[0];
expect(request.method).to.equal('GET');
expect(request.url).to.match(new RegExp(`^https://${bidRequests[0].params.emiter}/ad.json`));
});

it('should attach id to url', () => {
const request = spec.buildRequests(bidRequests)[0];
const request = spec.buildRequests(bidRequests, bidderRequest)[0];
expect(request.url).to.include('id=' + bidRequests[0].params.masterId);
});

it('should attach consent information to url', () => {
const request = spec.buildRequests(bidRequests, bidderRequest)[0];
expect(request.url).to.include('gdpr=1');
expect(request.url).to.include('gdpr_consent=' + bidderRequest.gdprConsent.consentString);
});
})

describe('interpretResponse', () => {
Expand Down
Loading

0 comments on commit 67b5fa1

Please sign in to comment.