Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Marketplaces & inventory packaging changes. #417

Open
wants to merge 2 commits into
base: nightly
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions src_new/adapters/prebid.js
Original file line number Diff line number Diff line change
Expand Up @@ -996,6 +996,7 @@ function setPrebidConfig(){
refThis.assignCurrencyConfigIfRequired(prebidConfig);
refThis.assignSchainConfigIfRequired(prebidConfig);
refThis.assignSingleRequestConfigForBidders(prebidConfig);
refThis.assignPackagingInventoryConfig(prebidConfig);
// if usePBSAdapter is 1 then add s2sConfig
if(CONFIG.usePBSAdapter()) {
refThis.gets2sConfig(prebidConfig);
Expand Down Expand Up @@ -1114,6 +1115,15 @@ function checkForYahooSSPBidder(prebidConfig){

exports.checkForYahooSSPBidder = checkForYahooSSPBidder;


function assignPackagingInventoryConfig(prebidConfig) {
prebidConfig["viewabilityScoreGeneration"] = {
enabled: true
}
}

exports.assignPackagingInventoryConfig = assignPackagingInventoryConfig;

function getPbjsAdServerTargetingConfig(){
// Todo: Handle send-all bids feature enabled case
// we will need to add bidder specific keys?? do we?
Expand Down
7 changes: 3 additions & 4 deletions src_new/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,9 @@ exports.SPECIAL_CASE_ID_PARTNERS = {
},
"merkleId": {
"params.ssp_ids": "array"
},
"liveIntentId": {
"params.requestedAttributesOverrides": "customObject"
}
}; //list of ID partners for whom special handling of datatype is required

Expand All @@ -285,10 +288,6 @@ exports.ID_PARTNERS_CUSTOM_VALUES = {
"identityLink": [{
"key": "storage.refreshInSeconds",
"value": "1800"
}],
"liveIntentId": [{
"key": "params.requestedAttributesOverrides",
"value": {'uid2': true}
}]
};

Expand Down
8 changes: 8 additions & 0 deletions src_new/util.idhub.js
Original file line number Diff line number Diff line change
Expand Up @@ -629,6 +629,14 @@ exports.applyDataTypeChangesIfApplicable = function(params) {
params[key] = [paramValue];
}
}
break;
case "customObject":
if (paramValue) {
if (key === "params.requestedAttributesOverrides") {
params[key] = {'uid2': (paramValue === "true" || paramValue === "1")}
}
}
break;
default:
return;
}
Expand Down
7 changes: 7 additions & 0 deletions src_new/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -1956,6 +1956,13 @@ exports.applyDataTypeChangesIfApplicable = function(params) {
}
}
break;
case "customObject":
if (paramValue) {
if (key === "params.requestedAttributesOverrides") {
params[key] = {'uid2': (paramValue === "true" || paramValue === "1")}
}
}
break;
default:
return;
}
Expand Down
18 changes: 18 additions & 0 deletions test/adapters/prebid.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -1660,6 +1660,24 @@ describe('ADAPTER: Prebid', function() {
});
})

// Test cases for inventory packaging
describe("assignPackagingInventoryConfig",function(){
var prebidConfig = {};
var expectedResult = {
enabled: true
};
it("should be a functiion",function(done){
PREBID.assignPackagingInventoryConfig.should.be.a("function");
done();
});

it("should set s2sConfig properties",function(done){
PREBID.assignPackagingInventoryConfig(prebidConfig);
expect(prebidConfig.viewabilityScoreGeneration).to.be.deep.equal(expectedResult);
done();
});
});

describe('#addOnBidRequestHandler',function(){
beforeEach(function(done) {
sinon.stub(UTIL, 'isFunction');
Expand Down
36 changes: 36 additions & 0 deletions test/util.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -4013,6 +4013,42 @@ describe('UTIL', function() {
expect(paramsForParrable["params.timezoneFilter.allowedZones"]).to.be.undefined
done();
});
it('should keep the param value unchanged and print a log message if datatype conversion is not possible',function(done){
params = {"name": "intentIqId","params.partner":"abc","storage.type":"cookie","storage.name":"intentIqId","storage.expires": "60"};
var expectedResult = {"name": "intentIqId","params.partner":"abc","storage.type":"cookie","storage.name":"intentIqId","storage.expires": "60"};

UTIL.applyDataTypeChangesIfApplicable(params);
params.should.deep.equal(expectedResult);
UTIL.logError.should.be.calledOnce;

done();
});

it('should set requestedAttributesOverrides value as true if value set in config is true', function(done) {
params = {"name": "liveIntentId","params.publisherId": "12432415","params.requestedAttributesOverrides": "true"};
var expectedResult = {
name: "liveIntentId",
"params.publisherId": "12432415",
"params.requestedAttributesOverrides": {"uid2": true}
};
UTIL.applyDataTypeChangesIfApplicable(params);
params.should.deep.equal(expectedResult);
done();
});

it('should set requestedAttributesOverrides value as false if value set in config is false', function(done) {
params = {"name": "liveIntentId","params.publisherId": "12432415","params.requestedAttributesOverrides": "false"};
var expectedResult = {
name: "liveIntentId",
"params.publisherId": "12432415",
"params.requestedAttributesOverrides": {"uid2": false}
};

UTIL.applyDataTypeChangesIfApplicable(params);
console.log("################ --> ", params);
params.should.deep.equal(expectedResult);
done();
});
});

describe('#applyCustomParamValuesfApplicable', function() {
Expand Down