From 5a2f0eca68057561f5c78621b98133dc45849043 Mon Sep 17 00:00:00 2001 From: Nitin Shirsat Date: Tue, 4 Apr 2023 11:37:26 +0530 Subject: [PATCH 01/17] GPP config set to prebid --- src_new/adapters/prebid.js | 15 +++++++++++++++ src_new/config.js | 16 +++++++++++++++- src_new/constants.js | 8 +++++++- 3 files changed, 37 insertions(+), 2 deletions(-) diff --git a/src_new/adapters/prebid.js b/src_new/adapters/prebid.js index 9e6e2ff3..1bd2d395 100644 --- a/src_new/adapters/prebid.js +++ b/src_new/adapters/prebid.js @@ -840,6 +840,20 @@ function assignCcpaConfigIfRequired(prebidConfig){ exports.assignCcpaConfigIfRequired = assignCcpaConfigIfRequired; +function assignGppConfigIfRequired(prebidConfig) { + if (CONFIG.getGppConsent()) { + if (!prebidConfig["consentManagement"]) { + prebidConfig["consentManagement"] = {}; + } + prebidConfig["consentManagement"]['gpp'] = { + cmpApi: CONFIG.getGppCmpApi(), + timeout: CONFIG.getGppTimeout() + }; + } +} + +exports.assignGppConfigIfRequired = assignGppConfigIfRequired; + function assignCurrencyConfigIfRequired(prebidConfig){ if(CONFIG.getAdServerCurrency()){ // get AdServer currency from Config @@ -1022,6 +1036,7 @@ function setPrebidConfig(){ refThis.assignUserSyncConfig(prebidConfig); refThis.assignGdprConfigIfRequired(prebidConfig); refThis.assignCcpaConfigIfRequired(prebidConfig); + refThis.assignGppConfigIfRequired(prebidConfig); refThis.assignCurrencyConfigIfRequired(prebidConfig); refThis.assignSchainConfigIfRequired(prebidConfig); refThis.assignSingleRequestConfigForBidders(prebidConfig); diff --git a/src_new/config.js b/src_new/config.js index 8127a616..ff5967a4 100644 --- a/src_new/config.js +++ b/src_new/config.js @@ -447,4 +447,18 @@ exports.createMacros = function() { exports.getMarketplaceBidders = function(){ return config.pwt.marketplaceBidders ? config.pwt.marketplaceBidders.split(',') : false; -} \ No newline at end of file +} + +exports.getGppConsent = function () { + var gpp = config[CONSTANTS.CONFIG.COMMON][CONSTANTS.CONFIG.GPP_CONSENT] || CONSTANTS.CONFIG.DEFAULT_GPP_CONSENT; + return gpp === "1"; +}; + +exports.getGppCmpApi = function () { + return config[CONSTANTS.CONFIG.COMMON][CONSTANTS.CONFIG.GPP_CMPAPI] || CONSTANTS.CONFIG.DEFAULT_GPP_CMPAPI; +}; + +exports.getGppTimeout = function () { + var gppTimeout = config[CONSTANTS.CONFIG.COMMON][CONSTANTS.CONFIG.GPP_TIMEOUT]; + return gppTimeout ? window.parseInt(gppTimeout) : CONSTANTS.CONFIG.DEFAULT_GPP_TIMEOUT; +}; \ No newline at end of file diff --git a/src_new/constants.js b/src_new/constants.js index 0f5e0e78..b5fb34bd 100644 --- a/src_new/constants.js +++ b/src_new/constants.js @@ -109,7 +109,13 @@ exports.CONFIG = { "AB_TEST_ENABLED": "abTestEnabled", "TIMEOUT_ADJUSTMENT": 50, "SSO_ENABLED": "ssoEnabled", - "FLOOR_SOURCE": "floorSource" + "FLOOR_SOURCE": "floorSource", + "GPP_CONSENT": "gpp", + "GPP_CMPAPI": "gppCmpApi", + "GPP_TIMEOUT": "gppTimeout", + "DEFAULT_GPP_CONSENT": "0", + "DEFAULT_GPP_CMPAPI": "iab", + "DEFAULT_GPP_TIMEOUT": 10000, }; exports.METADATA_MACROS = { From af4a99b89cc0640902ac58fb9742301407c78e77 Mon Sep 17 00:00:00 2001 From: Nitin Shirsat Date: Wed, 5 Apr 2023 16:47:44 +0530 Subject: [PATCH 02/17] Set GPP related config to prebid via OW --- src_new/conf.js | 5 ++- test/adapters/prebid.spec.js | 11 ++++++ test/config.spec.js | 66 ++++++++++++++++++++++++++++++++++++ 3 files changed, 81 insertions(+), 1 deletion(-) diff --git a/src_new/conf.js b/src_new/conf.js index a00391f9..8813c337 100644 --- a/src_new/conf.js +++ b/src_new/conf.js @@ -24,7 +24,10 @@ exports.pwt = { owv:"v21.4.0", abTestEnabled:"0", pubAnalyticsAdapter: "0", - reduceCodeSize:1 + reduceCodeSize:1, + gpp: "0", + gppCmpApi: "iab", + gppTimeout: "10000" }; // singleImpression is used to enable feature of sending single impression for multiple size ad slot earlier there were multiple impression for multiple sizes diff --git a/test/adapters/prebid.spec.js b/test/adapters/prebid.spec.js index 2b6a1d6a..ca313845 100644 --- a/test/adapters/prebid.spec.js +++ b/test/adapters/prebid.spec.js @@ -1108,6 +1108,10 @@ describe('ADAPTER: Prebid', function() { sinon.spy(CONFIG, 'getCCPATimeout'); sinon.stub(CONFIG, 'getCCPA').returns(true); + sinon.spy(CONFIG, 'getGppTimeout'); + sinon.spy(CONFIG, 'getGppCmpApi'); + sinon.stub(CONFIG, 'getGppConsent').returns(true); + sinon.stub(BM, 'resetBid', function(){}); sinon.stub(BM, 'setSizes', function(){}); @@ -1178,6 +1182,10 @@ describe('ADAPTER: Prebid', function() { CONFIG.getCCPA.restore(); CONFIG.getCCPATimeout.restore(); + CONFIG.getGppConsent.restore(); + CONFIG.getGppCmpApi.restore(); + CONFIG.getGppTimeout.restore(); + BM.resetBid.restore(); BM.setSizes.restore(); @@ -1249,6 +1257,9 @@ describe('ADAPTER: Prebid', function() { CONFIG.getCCPA().should.be.true; CONFIG.getCCPACmpApi().should.be.called; CONFIG.getCCPATimeout().should.be.called; + CONFIG.getGppConsent().should.be.true; + CONFIG.getGppCmpApi().should.be.called; + CONFIG.getGppTimeout().should.be.called; done(); }); diff --git a/test/config.spec.js b/test/config.spec.js index 753027ba..6dca7650 100644 --- a/test/config.spec.js +++ b/test/config.spec.js @@ -2411,4 +2411,70 @@ describe('Config', function() { done(); }); }); + + describe('#Gpp', function() { + beforeEach(function(done){ + if(!CONF[CONSTANTS.CONFIG.COMMON]) { + CONF[CONSTANTS.CONFIG.COMMON] = {}; + } + done(); + }); + + describe('#getGpp', function() { + it('is a function', function(done) { + CONFIG.getGppConsent.should.be.a('function'); + done(); + }); + + it('should return true, as it is set to "1"', function(done) { + CONF[CONSTANTS.CONFIG.COMMON][CONSTANTS.CONFIG.GPP_CONSENT] = "1"; + CONFIG.getGppConsent().should.be.true; + done(); + }); + + it('should return default value for gpp which is '+(CONSTANTS.CONFIG.DEFAULT_GPP_CONSENT === "1")+', as it is NOT set', function(done) { + delete CONF[CONSTANTS.CONFIG.COMMON][CONSTANTS.CONFIG.GPP_CONSENT]; + CONFIG.getGppConsent().should.be.equal((CONSTANTS.CONFIG.DEFAULT_GPP_CONSENT === "1")); + done(); + }); + }); + + describe('#getGppCmpApi', function() { + it('is a function', function(done) { + CONFIG.getGppCmpApi.should.be.a('function'); + done(); + }); + + it('should return iab, as it is set to iab', function(done) { + CONF[CONSTANTS.CONFIG.COMMON][CONSTANTS.CONFIG.GPP_CMPAPI] = 'iab'; + CONFIG.getGppCmpApi().should.be.equal('iab'); + done(); + }); + + it('should return default cmp which is '+CONSTANTS.CONFIG.DEFAULT_GPP_CMPAPI+', as it is NOT set', function(done) { + delete CONF[CONSTANTS.CONFIG.COMMON][CONSTANTS.CONFIG.GPP_CMPAPI]; + CONFIG.getGppCmpApi().should.be.equal(CONSTANTS.CONFIG.DEFAULT_GPP_CMPAPI); + done(); + }); + }); + + describe('#getGppTimeout', function() { + it('is a function', function(done) { + CONFIG.getGppTimeout.should.be.a('function'); + done(); + }); + + it('should return 5000, as it is set to 5000', function(done) { + CONF[CONSTANTS.CONFIG.COMMON][CONSTANTS.CONFIG.GPP_TIMEOUT] = 5000; + CONFIG.getGppTimeout().should.be.equal(5000); + done(); + }); + + it('should return default value for gpp timeout which is '+CONSTANTS.CONFIG.DEFAULT_GPP_TIMEOUT+', as it is NOT set', function(done) { + delete CONF[CONSTANTS.CONFIG.COMMON][CONSTANTS.CONFIG.GPP_TIMEOUT]; + CONFIG.getGppTimeout().should.be.equal(CONSTANTS.CONFIG.DEFAULT_GPP_TIMEOUT); + done(); + }); + }); + }); }); From 97438ea436b47276233d2a7a542078ab88842f7f Mon Sep 17 00:00:00 2001 From: Nitin Shirsat Date: Fri, 7 Apr 2023 16:46:27 +0530 Subject: [PATCH 03/17] Add code to set gpp config to IDHUB --- src_new/adapters/prebid.js | 9 ++---- src_new/config.idhub.js | 17 +++++++++++ src_new/controllers/idhub.js | 7 +++++ src_new/owIdhubCommon.js | 15 ++++++++++ test/owIdhubCommon.spec.js | 58 ++++++++++++++++++++++++++++++++++++ 5 files changed, 99 insertions(+), 7 deletions(-) create mode 100644 src_new/owIdhubCommon.js create mode 100644 test/owIdhubCommon.spec.js diff --git a/src_new/adapters/prebid.js b/src_new/adapters/prebid.js index 1bd2d395..85790d7f 100644 --- a/src_new/adapters/prebid.js +++ b/src_new/adapters/prebid.js @@ -10,6 +10,7 @@ var BID = require("../bid.js"); var util = require("../util.js"); var bidManager = require("../bidManager.js"); var CONF = require("../conf.js"); +var owIdhubCommon = require("../owIdhubCommon.js"); var parentAdapterID = CONSTANTS.COMMON.PARENT_ADAPTER_PREBID; @@ -842,13 +843,7 @@ exports.assignCcpaConfigIfRequired = assignCcpaConfigIfRequired; function assignGppConfigIfRequired(prebidConfig) { if (CONFIG.getGppConsent()) { - if (!prebidConfig["consentManagement"]) { - prebidConfig["consentManagement"] = {}; - } - prebidConfig["consentManagement"]['gpp'] = { - cmpApi: CONFIG.getGppCmpApi(), - timeout: CONFIG.getGppTimeout() - }; + prebidConfig = owIdhubCommon.setConsentConfig(prebidConfig, "gpp", CONFIG.getGppCmpApi(), CONFIG.getGppTimeout()); } } diff --git a/src_new/config.idhub.js b/src_new/config.idhub.js index c0bfab5a..e2b65753 100644 --- a/src_new/config.idhub.js +++ b/src_new/config.idhub.js @@ -64,6 +64,23 @@ exports.getCCPATimeout = function() { return ccpaTimeout ? window.parseInt(ccpaTimeout) : CONSTANTS.CONFIG.DEFAULT_CCPA_TIMEOUT; }; +// needed +exports.getGppConsent = function () { + var gpp = config[CONSTANTS.CONFIG.COMMON][CONSTANTS.CONFIG.GPP_CONSENT] || CONSTANTS.CONFIG.DEFAULT_GPP_CONSENT; + return gpp === "1"; +}; + +// needed +exports.getGppCmpApi = function () { + return config[CONSTANTS.CONFIG.COMMON][CONSTANTS.CONFIG.GPP_CMPAPI] || CONSTANTS.CONFIG.DEFAULT_GPP_CMPAPI; +}; + +// needed +exports.getGppTimeout = function() { + var gppTimeout = config[CONSTANTS.CONFIG.COMMON][CONSTANTS.CONFIG.GPP_TIMEOUT]; + return gppTimeout ? window.parseInt(gppTimeout) : CONSTANTS.CONFIG.DEFAULT_GPP_TIMEOUT; +}; + exports.getProfileID = function () { return config.pwt[CONSTANTS.CONFIG.PROFILE_ID] || "0"; }; diff --git a/src_new/controllers/idhub.js b/src_new/controllers/idhub.js index e7fa9c98..ab8a43dd 100644 --- a/src_new/controllers/idhub.js +++ b/src_new/controllers/idhub.js @@ -5,6 +5,7 @@ var CONFIG = require("../config.idhub.js"); var CONSTANTS = require("../constants.js"); var util = require("../util.idhub.js"); +var owIdhubCommon = require("../owIdhubCommon.js"); var refThis = this; var pbNameSpace = CONFIG.isIdentityOnly() ? CONSTANTS.COMMON.IH_NAMESPACE : CONSTANTS.COMMON.PREBID_NAMESPACE; @@ -57,6 +58,12 @@ refThis.setConfig = function(){ timeout: CONFIG.getCCPATimeout(), }; } + + // Set Gpp consent config + if (CONFIG.getGppConsent()) { + prebidConfig = owIdhubCommon.setConsentConfig(prebidConfig, "gpp", CONFIG.getGppCmpApi(), CONFIG.getGppTimeout()); + } + window.IHPWT.ssoEnabled = CONFIG.isSSOEnabled() || false; if(CONFIG.isUserIdModuleEnabled()){ prebidConfig["userSync"]["userIds"] = util.getUserIdConfiguration(); diff --git a/src_new/owIdhubCommon.js b/src_new/owIdhubCommon.js new file mode 100644 index 00000000..f25b4f8e --- /dev/null +++ b/src_new/owIdhubCommon.js @@ -0,0 +1,15 @@ +// NOTE: This file will contains only common code/function used in OW and IDHUB. +// Do not import any other file into it. + + +exports.setConsentConfig = function (prebidConfig, key, cmpApi, timeout) { + prebidConfig = prebidConfig || {}; + if (!prebidConfig["consentManagement"]) { + prebidConfig["consentManagement"] = {}; + } + prebidConfig["consentManagement"][key] = { + cmpApi: cmpApi, + timeout: timeout + }; + return prebidConfig; +}; \ No newline at end of file diff --git a/test/owIdhubCommon.spec.js b/test/owIdhubCommon.spec.js new file mode 100644 index 00000000..6bede58a --- /dev/null +++ b/test/owIdhubCommon.spec.js @@ -0,0 +1,58 @@ +/* global describe, it, xit, sinon, expect */ +// var sinon = require("sinon"); +var should = require("chai").should(); +var expect = require("chai").expect; +var OWIDHUBCOMMON = require("../src_new/owIdhubCommon"); + +describe('owIdhubCommon', function() { + describe('setConsentConfig', function() { + var prebidConfig = {}; + var cmpApi = 'iab'; + var timeout = 2000; + + it('setConsentConfig a function', function(done) { + OWIDHUBCOMMON.setConsentConfig.should.be.a('function'); + done(); + }); + + it('should set consent management config when its not present', function(done) { + var expPrebidConfig = { + consentManagement: { + gpp: { + cmpApi, + timeout + } + } + }; + const actPrebifConfig = OWIDHUBCOMMON.setConsentConfig(prebidConfig, 'gpp', cmpApi, timeout); + expect(actPrebifConfig).to.be.deep.equal(expPrebidConfig); + done(); + }); + + it('should set consent management config when its present', function(done) { + var prebidConfig = { + consentManagement: { + gdpr: { + cmpApi, + timeout + } + } + } + var expPrebidConfig = { + consentManagement: { + gdpr: { + cmpApi, + timeout + }, + gpp: { + cmpApi, + timeout + } + } + }; + const actPrebifConfig = OWIDHUBCOMMON.setConsentConfig(prebidConfig, 'gpp', cmpApi, timeout); + expect(actPrebifConfig).to.be.deep.equal(expPrebidConfig); + done(); + }); + }); +}); \ No newline at end of file From 55ebda40fc6be3e9169afb22daf01e4abe1e0709 Mon Sep 17 00:00:00 2001 From: Nitin Shirsat Date: Fri, 7 Apr 2023 17:51:28 +0530 Subject: [PATCH 04/17] Setting this config to PBJS_NAMESPACE as prebid needs to read consent from CMP and set it in a bidderRequest. --- src_new/controllers/idhub.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src_new/controllers/idhub.js b/src_new/controllers/idhub.js index ab8a43dd..d966f50a 100644 --- a/src_new/controllers/idhub.js +++ b/src_new/controllers/idhub.js @@ -61,7 +61,9 @@ refThis.setConfig = function(){ // Set Gpp consent config if (CONFIG.getGppConsent()) { - prebidConfig = owIdhubCommon.setConsentConfig(prebidConfig, "gpp", CONFIG.getGppCmpApi(), CONFIG.getGppTimeout()); + consentConfig = owIdhubCommon.setConsentConfig({}, "gpp", CONFIG.getGppCmpApi(), CONFIG.getGppTimeout()); + // Setting this config to PBJS_NAMESPACE as prebid needs to read consent from CMP and set it in a bidderRequest. + window[CONFIG.PBJS_NAMESPACE].setConfig(consentConfig); } window.IHPWT.ssoEnabled = CONFIG.isSSOEnabled() || false; From be872ac35191edb6cdeb90356b7944f6f15665ff Mon Sep 17 00:00:00 2001 From: Nitin Shirsat Date: Tue, 11 Apr 2023 17:05:58 +0530 Subject: [PATCH 05/17] Add gpp config to OW namespace in case of IH profiles --- src_new/controllers/idhub.js | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src_new/controllers/idhub.js b/src_new/controllers/idhub.js index d966f50a..ab8a43dd 100644 --- a/src_new/controllers/idhub.js +++ b/src_new/controllers/idhub.js @@ -61,9 +61,7 @@ refThis.setConfig = function(){ // Set Gpp consent config if (CONFIG.getGppConsent()) { - consentConfig = owIdhubCommon.setConsentConfig({}, "gpp", CONFIG.getGppCmpApi(), CONFIG.getGppTimeout()); - // Setting this config to PBJS_NAMESPACE as prebid needs to read consent from CMP and set it in a bidderRequest. - window[CONFIG.PBJS_NAMESPACE].setConfig(consentConfig); + prebidConfig = owIdhubCommon.setConsentConfig(prebidConfig, "gpp", CONFIG.getGppCmpApi(), CONFIG.getGppTimeout()); } window.IHPWT.ssoEnabled = CONFIG.isSSOEnabled() || false; From 2b670266fd91a81b1b5e3be4e165f38901d8c790 Mon Sep 17 00:00:00 2001 From: pm-nitin-shirsat <107102698+pm-nitin-shirsat@users.noreply.github.com> Date: Thu, 29 Jun 2023 17:02:54 +0530 Subject: [PATCH 06/17] Update init-build.sh --- init-build.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/init-build.sh b/init-build.sh index abeb17de..034bfdb2 100755 --- a/init-build.sh +++ b/init-build.sh @@ -52,14 +52,14 @@ then exit 1 fi -OpenWrapNodeModules="${GLOBAL_OPENWRAP_PKG_JSON_DIR_V7_51_0}/node_modules/" +OpenWrapNodeModules="${GLOBAL_OPENWRAP_PKG_JSON_DIR_V7_39_0}/node_modules/" function prebidNpmInstall() { echo "This is SymLinking Start" cd $1 - PrebidJSNodeModules="${GLOBAL_PREBID_PKG_JSON_DIR_V7_51_0}/node_modules/" + PrebidJSNodeModules="${GLOBAL_OPENWRAP_PKG_JSON_DIR_V7_39_0}/node_modules/" symLinkForPrebidNodeModules=node_modules if [ -L $symLinkForPrebidNodeModules ]; then From a75cf03e5648b99d6811632f69bad4d9f0736bb6 Mon Sep 17 00:00:00 2001 From: pm-nitin-shirsat <107102698+pm-nitin-shirsat@users.noreply.github.com> Date: Thu, 29 Jun 2023 17:07:44 +0530 Subject: [PATCH 07/17] Update init-build.sh --- init-build.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/init-build.sh b/init-build.sh index 034bfdb2..57aa2406 100755 --- a/init-build.sh +++ b/init-build.sh @@ -59,7 +59,7 @@ function prebidNpmInstall() { echo "This is SymLinking Start" cd $1 - PrebidJSNodeModules="${GLOBAL_OPENWRAP_PKG_JSON_DIR_V7_39_0}/node_modules/" + PrebidJSNodeModules="${GLOBAL_PREBID_PKG_JSON_DIR_V7_39_0}/node_modules/" symLinkForPrebidNodeModules=node_modules if [ -L $symLinkForPrebidNodeModules ]; then From 4ec83282eb3241f60e1635023ba270751d90c526 Mon Sep 17 00:00:00 2001 From: pm-azhar-mulla Date: Tue, 5 Mar 2024 12:24:57 +0530 Subject: [PATCH 08/17] Consuming buckets for custom PG --- src_new/config.js | 19 ++++++++++++++++- src_new/constants.js | 3 +++ test/config.spec.js | 50 +++++++++++++++++++++++++++++++++++++++++++- 3 files changed, 70 insertions(+), 2 deletions(-) diff --git a/src_new/config.js b/src_new/config.js index 4b5f7702..5bc69625 100644 --- a/src_new/config.js +++ b/src_new/config.js @@ -292,7 +292,24 @@ exports.isReduceCodeSizeFeatureEnabled = function(){ }; // endRemoveIf(removeAlways) exports.getPriceGranularity = function(){ - return config[CONSTANTS.CONFIG.COMMON][CONSTANTS.COMMON.PRICE_GRANULARITY] || null; + var priceGranularity = config[CONSTANTS.CONFIG.COMMON][CONSTANTS.COMMON.PRICE_GRANULARITY] || null; + + if (priceGranularity === CONSTANTS.COMMON.PRICE_GRANULARITY_CUSTOM) { + var bucketsValue = refThis.getPriceGranularityBuckets(); + if(bucketsValue !== null) { + return bucketsValue; + } else { + util.logWarning(CONSTANTS.MESSAGES.M33); + return null; + } + } + else { + return priceGranularity; + } +}; + +exports.getPriceGranularityBuckets = function(){ + return config[CONSTANTS.CONFIG.COMMON][CONSTANTS.COMMON.PRICE_GRANULARITY_BUCKETS] || null; }; exports.getGranularityMultiplier = function(){ diff --git a/src_new/constants.js b/src_new/constants.js index 35e213c4..ade79fdf 100644 --- a/src_new/constants.js +++ b/src_new/constants.js @@ -46,6 +46,8 @@ exports.COMMON = { "TEST_GROUP_DETAILS": "testConfigDetails", "TEST_PWT": "test_pwt", "PRICE_GRANULARITY" : "priceGranularity", + "PRICE_GRANULARITY_CUSTOM" : "custom", + "PRICE_GRANULARITY_BUCKETS" : "priceGranularityBuckets", "GRANULARITY_MULTIPLIER" : "granularityMultiplier", "TEST_PARTNER": "test_adapters", "REDUCE_CODE_SIZE": "reduceCodeSize", @@ -217,6 +219,7 @@ exports.MESSAGES = { "M30": "AB Test Enabled With Config", "M31": "AB Test Enabled With Partner Config", "M32": "Invalid MediaConfig regex pattern : ", + "M33": "Price Buckets should be set for custom price granularity", IDENTITY: { M1: "Unable to get User Id from OpenIdentity", M2: "Setting UserIds to EB ", diff --git a/test/config.spec.js b/test/config.spec.js index 7d1928bb..816d66e0 100644 --- a/test/config.spec.js +++ b/test/config.spec.js @@ -2183,11 +2183,13 @@ describe('Config', function() { describe('#getPriceGranularity',function(){ beforeEach(function(done){ CONF[CONSTANTS.CONFIG.COMMON][CONSTANTS.COMMON.PRICE_GRANULARITY] = "high"; + sinon.spy(UTIL, "logWarning"); done(); }); afterEach(function(done){ - delete CONF[CONSTANTS.CONFIG.COMMON][CONSTANTS.COMMON.PRICE_GRANULARITY] ; + delete CONF[CONSTANTS.CONFIG.COMMON][CONSTANTS.COMMON.PRICE_GRANULARITY]; + UTIL.logWarning.restore(); done(); }) @@ -2207,6 +2209,52 @@ describe('Config', function() { expect(CONFIG.getPriceGranularity()).to.equal(null); done(); }); + + it('should return PriceGranularity Buckets if price granularity is custom', function(done){ + CONF[CONSTANTS.CONFIG.COMMON][CONSTANTS.COMMON.PRICE_GRANULARITY] = 'custom'; + CONF[CONSTANTS.CONFIG.COMMON][CONSTANTS.COMMON.PRICE_GRANULARITY_BUCKETS] = 'customBuckets'; + + expect(CONFIG.getPriceGranularity()).to.equal('customBuckets'); + done(); + }); + + it('should return null and log warning if Buckets are missing for custom price granularity', function(done){ + CONF[CONSTANTS.CONFIG.COMMON][CONSTANTS.COMMON.PRICE_GRANULARITY] = 'custom'; + delete CONF[CONSTANTS.CONFIG.COMMON][CONSTANTS.COMMON.PRICE_GRANULARITY_BUCKETS] + + expect(CONFIG.getPriceGranularity()).to.equal(null); + UTIL.logWarning.calledWith(CONSTANTS.MESSAGES.M33).should.be.true; + done(); + }); + }); + + describe('#getPriceGranularityBuckets',function(){ + beforeEach(function(done){ + CONF[CONSTANTS.CONFIG.COMMON][CONSTANTS.COMMON.PRICE_GRANULARITY_BUCKETS] = "customBuckets"; + done(); + }); + + afterEach(function(done){ + delete CONF[CONSTANTS.CONFIG.COMMON][CONSTANTS.COMMON.PRICE_GRANULARITY_BUCKETS]; + done(); + }) + + it('is a function', function(done) { + CONFIG.getPriceGranularityBuckets.should.be.a('function'); + done(); + }); + + it('should return the buckets by reading from config', function(done) { + var expectedResult = 'customBuckets'; + CONFIG.getPriceGranularityBuckets().should.be.deep.equal(expectedResult); + done(); + }); + + it('should return null if bucket is not present',function(done){ + delete CONF[CONSTANTS.CONFIG.COMMON][CONSTANTS.COMMON.PRICE_GRANULARITY_BUCKETS]; + expect(CONFIG.getPriceGranularityBuckets()).to.equal(null); + done(); + }); }); describe('#getGranularityMultiplier',function(){ From eb83d2d5fda0fd4d42f067e8b00e4a7d61fa3dd9 Mon Sep 17 00:00:00 2001 From: pm-azhar-mulla Date: Tue, 5 Mar 2024 17:16:40 +0530 Subject: [PATCH 09/17] Passing pwtpb with price bucket value to GAM --- src_new/adapters/prebid.js | 5 +++++ src_new/constants.js | 9 +++++++++ src_new/controllers/custom.js | 2 +- 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/src_new/adapters/prebid.js b/src_new/adapters/prebid.js index b382feb8..39885dd3 100644 --- a/src_new/adapters/prebid.js +++ b/src_new/adapters/prebid.js @@ -1320,6 +1320,11 @@ function getPbjsAdServerTargetingConfig(){ val: function(bidResponse){ return bidResponse.creativeId ? bidResponse.creativeId : ''; } + }, { + key: 'pwtpb', + val: function(bidResponse){ + return bidResponse[CONSTANTS.PRICE_GRANULARITY_KEYS[owpbjs.readConfig('priceGranularity')]] || null; + } } ]; } diff --git a/src_new/constants.js b/src_new/constants.js index ade79fdf..4c8a5a09 100644 --- a/src_new/constants.js +++ b/src_new/constants.js @@ -356,3 +356,12 @@ exports.REGEX_BROWSERS = [/\b(?:crmo|crios)\/([\w\.]+)/i,/edg(?:e|ios|a)?\/([\w\ /(firefox)\/([\w\.]+)/i,/(mozilla)\/([\w\.]+) .+rv\:.+gecko\/\d+/i,/(polaris|lynx|dillo|icab|doris|amaya|w3m|netsurf|sleipnir|obigo|mosaic|(?:go|ice|up)[\. ]?browser)[-\/ ]?v?([\w\.]+)/i,/(links) \(([\w\.]+)/i]; exports.BROWSER_MAPPING = [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,42,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64, 65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90]; + +exports.PRICE_GRANULARITY_KEYS = { + auto: "pbAg", + dense: "pbDg", + low: "pbLg", + medium: "pbMg", + high:"pbHg", + custom: "pbCg" +}; \ No newline at end of file diff --git a/src_new/controllers/custom.js b/src_new/controllers/custom.js index 66690b3d..e3c2cee6 100644 --- a/src_new/controllers/custom.js +++ b/src_new/controllers/custom.js @@ -189,7 +189,7 @@ function findWinningBidAndGenerateTargeting(divId) { util.forEachOnObject(keyValuePairs, function(key) { // if winning bid is not pubmatic then remove buyId targeting key. Ref : UOE-5277 /* istanbul ignore else*/ - if (util.isOwnProperty(ignoreTheseKeys, key) || util.isOwnProperty({"pwtpb":1}, key) || (winningBid && winningBid.adapterID !== "pubmatic" && util.isOwnProperty({"hb_buyid_pubmatic":1,"pwtbuyid_pubmatic":1}, key))) { + if (util.isOwnProperty(ignoreTheseKeys, key) || (winningBid && winningBid.adapterID !== "pubmatic" && util.isOwnProperty({"hb_buyid_pubmatic":1,"pwtbuyid_pubmatic":1}, key))) { delete keyValuePairs[key]; } else { From 1a6a811e0ba2f47fd686449479486d5668f418e5 Mon Sep 17 00:00:00 2001 From: pm-azhar-mulla Date: Tue, 5 Mar 2024 17:18:09 +0530 Subject: [PATCH 10/17] Added pwtpb in wrapper targetting keys --- src_new/constants.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src_new/constants.js b/src_new/constants.js index 4c8a5a09..634b971d 100644 --- a/src_new/constants.js +++ b/src_new/constants.js @@ -163,7 +163,8 @@ exports.WRAPPER_TARGETING_KEYS = { "CACHE_PATH": "pwtcpath", "ACAT": "pwtacat", "CRID": "pwtcrid", - "DSP": "pwtdsp" + "DSP": "pwtdsp", + "PRICE_BUCKET": "pwtpb" }; exports.IGNORE_PREBID_KEYS = { From 9ac2b1fbd6aed2eeabae6c3c0860272a132ba001 Mon Sep 17 00:00:00 2001 From: pm-azhar-mulla Date: Fri, 15 Mar 2024 12:26:58 +0530 Subject: [PATCH 11/17] Updated the functionality as per changes in API side --- src_new/config.js | 12 ++++++++++-- src_new/constants.js | 2 +- test/config.spec.js | 10 +++++----- 3 files changed, 16 insertions(+), 8 deletions(-) diff --git a/src_new/config.js b/src_new/config.js index 5bc69625..83a77b7d 100644 --- a/src_new/config.js +++ b/src_new/config.js @@ -308,8 +308,16 @@ exports.getPriceGranularity = function(){ } }; -exports.getPriceGranularityBuckets = function(){ - return config[CONSTANTS.CONFIG.COMMON][CONSTANTS.COMMON.PRICE_GRANULARITY_BUCKETS] || null; +exports.getPriceGranularityBuckets = function () { + var pgBuckets = config[CONSTANTS.CONFIG.COMMON][CONSTANTS.COMMON.PRICE_GRANULARITY_BUCKETS] || null; + if(pgBuckets === null) + return null; + + // API would be providing us with ranges as keyword, we need to raplace it by buckets before processing + var transformedBuckets = {}; + delete Object.assign(transformedBuckets, pgBuckets, {['buckets']: pgBuckets['ranges'] })['ranges']; + + return transformedBuckets; }; exports.getGranularityMultiplier = function(){ diff --git a/src_new/constants.js b/src_new/constants.js index ade79fdf..2d06d67a 100644 --- a/src_new/constants.js +++ b/src_new/constants.js @@ -47,7 +47,7 @@ exports.COMMON = { "TEST_PWT": "test_pwt", "PRICE_GRANULARITY" : "priceGranularity", "PRICE_GRANULARITY_CUSTOM" : "custom", - "PRICE_GRANULARITY_BUCKETS" : "priceGranularityBuckets", + "PRICE_GRANULARITY_BUCKETS" : "customPriceGranularityConfig", "GRANULARITY_MULTIPLIER" : "granularityMultiplier", "TEST_PARTNER": "test_adapters", "REDUCE_CODE_SIZE": "reduceCodeSize", diff --git a/test/config.spec.js b/test/config.spec.js index 816d66e0..53b2d7b6 100644 --- a/test/config.spec.js +++ b/test/config.spec.js @@ -2212,9 +2212,9 @@ describe('Config', function() { it('should return PriceGranularity Buckets if price granularity is custom', function(done){ CONF[CONSTANTS.CONFIG.COMMON][CONSTANTS.COMMON.PRICE_GRANULARITY] = 'custom'; - CONF[CONSTANTS.CONFIG.COMMON][CONSTANTS.COMMON.PRICE_GRANULARITY_BUCKETS] = 'customBuckets'; - - expect(CONFIG.getPriceGranularity()).to.equal('customBuckets'); + CONF[CONSTANTS.CONFIG.COMMON][CONSTANTS.COMMON.PRICE_GRANULARITY_BUCKETS] = {'ranges':'customBuckets'}; + var expectedResult = {'buckets':'customBuckets'}; + expect(CONFIG.getPriceGranularity()).to.deep.equal(expectedResult); done(); }); @@ -2230,7 +2230,7 @@ describe('Config', function() { describe('#getPriceGranularityBuckets',function(){ beforeEach(function(done){ - CONF[CONSTANTS.CONFIG.COMMON][CONSTANTS.COMMON.PRICE_GRANULARITY_BUCKETS] = "customBuckets"; + CONF[CONSTANTS.CONFIG.COMMON][CONSTANTS.COMMON.PRICE_GRANULARITY_BUCKETS] = {'ranges':'customBuckets'}; done(); }); @@ -2245,7 +2245,7 @@ describe('Config', function() { }); it('should return the buckets by reading from config', function(done) { - var expectedResult = 'customBuckets'; + var expectedResult = {'buckets':'customBuckets'}; CONFIG.getPriceGranularityBuckets().should.be.deep.equal(expectedResult); done(); }); From 8389bf4b84aa3f64765866d55956f376b9d526b5 Mon Sep 17 00:00:00 2001 From: kapil-tuptewar Date: Thu, 11 Jul 2024 09:14:16 +0530 Subject: [PATCH 12/17] Changing bidderSequence to random or fixed based on bidderOrderingEnabled flag --- src_new/adapters/prebid.js | 12 +------- src_new/conf.js | 3 +- test/adapters/prebid.spec.js | 50 ++++++++++++++++++++++++--------- test/controllers/custom.spec.js | 2 -- test/controllers/gpt.spec.js | 2 -- 5 files changed, 39 insertions(+), 30 deletions(-) diff --git a/src_new/adapters/prebid.js b/src_new/adapters/prebid.js index 1c10db69..d1447bd2 100644 --- a/src_new/adapters/prebid.js +++ b/src_new/adapters/prebid.js @@ -1017,7 +1017,7 @@ function setPrebidConfig(){ url: CONSTANTS.CONFIG.CACHE_URL + CONSTANTS.CONFIG.CACHE_PATH, ignoreBidderCacheKey: true }, - bidderSequence: "random", + bidderSequence: CONF.pwt.bidderOrderingEnabled === "1" ? "fixed" : "random", disableAjaxTimeout: CONFIG.getDisableAjaxTimeout(), enableSendAllBids: CONFIG.getSendAllBidsStatus(), targetingControls: { @@ -1065,15 +1065,6 @@ function setPrebidConfig(){ exports.setPrebidConfig = setPrebidConfig; -function realignPubmaticAdapters(){ - if(CONF.adapters && CONF.adapters["pubmatic"]){ - var pubmaticAdpater = {"pubmatic": CONF.adapters["pubmatic"]}; - CONF.adapters = Object.assign(pubmaticAdpater, CONF.adapters); - } -} - -exports.realignPubmaticAdapters = realignPubmaticAdapters; - function gets2sConfig(prebidConfig){ var bidderParams = {}; var s2sBidders = CONFIG.getServerEnabledAdaptars(); @@ -1409,7 +1400,6 @@ function initPbjsConfig(){ return; } window[pbNameSpace].logging = util.isDebugLogEnabled(); - refThis.realignPubmaticAdapters(); refThis.setPrebidConfig(); refThis.configureBidderAliasesIfAvailable(); refThis.enablePrebidPubMaticAnalyticIfRequired(); diff --git a/src_new/conf.js b/src_new/conf.js index bcca26f1..86f4e5d7 100644 --- a/src_new/conf.js +++ b/src_new/conf.js @@ -27,7 +27,8 @@ exports.pwt = { reduceCodeSize:1, pbGlobalVarNamespace: "owpbjs", owGlobalVarNamespace: "PWT", - localStorageAccess: "1" // Added new field for allow local storage feature + localStorageAccess: "1", // Added new field for allow local storage feature + bidderOrderingEnabled: "0" }; // singleImpression is used to enable feature of sending single impression for multiple size ad slot earlier there were multiple impression for multiple sizes diff --git a/test/adapters/prebid.spec.js b/test/adapters/prebid.spec.js index e51f85bb..2b06fd42 100644 --- a/test/adapters/prebid.spec.js +++ b/test/adapters/prebid.spec.js @@ -2116,20 +2116,6 @@ describe('ADAPTER: Prebid', function() { expect(response).to.deep.equal(outputObj); done(); }); - }) - - describe('realignPubmaticAdapters', function() { - it('should be a functiion',function(done){ - PREBID.realignPubmaticAdapters.should.be.a('function'); - done(); - }); - it('should realignPubmaticAdapters', function(done) { - PREBID.realignPubmaticAdapters(); - expect(CONF.adapters['pubmatic']).should.have.object; - expect(CONF.adapters['pubmatic']).to.be.an('object'); - expect(CONF.adapters['pubmatic']).to.have.property('throttle'); - done(); - }); }); describe('getPbjsAdServerTargetingConfig', function() { @@ -2250,4 +2236,40 @@ describe('ADAPTER: Prebid', function() { done(); }); }) + + describe('dynamicBidderOrdering', function() { + let originalOwPbJs; + let mockSetConfig; + beforeEach(() => { + // Save the original owpbjs and setConfig function + originalOwPbJs = window['owpbjs']; + mockSetConfig = sinon.spy(); + window['owpbjs'] = { + setConfig: mockSetConfig, + }; + }) + + afterEach(() => { + // Restore the original owpbjs + window['owpbjs'] = originalOwPbJs; + CONF.pwt.bidderOrderingEnabled = '0'; + }); + + it('should set bidderSequence to random when dynamic bidder ordering is disabled', function(done) { + PREBID.setPrebidConfig(); + expect(mockSetConfig.calledOnce).to.be.true; + const configArg = mockSetConfig.getCall(0).args[0]; + expect(configArg).to.have.property('bidderSequence', 'random'); + done(); + }); + + it('should set bidderSequence to fixed when dynamic bidder ordering is enabled', function(done) { + CONF.pwt.bidderOrderingEnabled = '1'; + PREBID.setPrebidConfig(); + expect(mockSetConfig.calledOnce).to.be.true; + const configArg = mockSetConfig.getCall(0).args[0]; + expect(configArg).to.have.property('bidderSequence', 'fixed'); + done(); + }); + }) }); diff --git a/test/controllers/custom.spec.js b/test/controllers/custom.spec.js index 4e2c56e9..e36915e1 100644 --- a/test/controllers/custom.spec.js +++ b/test/controllers/custom.spec.js @@ -899,7 +899,6 @@ describe("CONTROLLER: CUSTOM", function() { sinon.spy(CUSTOM, "setWindowReference"); sinon.spy(CUSTOM, "defineWrapperTargetingKeys"); sinon.spy(CUSTOM, "initSafeFrameListener"); - sinon.stub(PREBID, "realignPubmaticAdapters"); sinon.stub(UTIL, "getGeoInfo").returns({}); done(); }); @@ -909,7 +908,6 @@ describe("CONTROLLER: CUSTOM", function() { CUSTOM.setWindowReference.restore(); CUSTOM.defineWrapperTargetingKeys.restore(); CUSTOM.initSafeFrameListener.restore(); - PREBID.realignPubmaticAdapters.restore(); UTIL.getGeoInfo.restore(); done(); }); diff --git a/test/controllers/gpt.spec.js b/test/controllers/gpt.spec.js index 2e5f45e0..b18e36b5 100644 --- a/test/controllers/gpt.spec.js +++ b/test/controllers/gpt.spec.js @@ -2965,7 +2965,6 @@ describe("CONTROLLER: GPT", function() { sinon.spy(GPT, "defineGPTVariables"); sinon.spy(GPT, "addHooksIfPossible"); sinon.spy(GPT, "initSafeFrameListener"); - sinon.stub(PREBID, "realignPubmaticAdapters") sinon.stub(UTIL, "getGeoInfo").returns({}); done(); }); @@ -2977,7 +2976,6 @@ describe("CONTROLLER: GPT", function() { GPT.defineGPTVariables.restore(); GPT.addHooksIfPossible.restore(); GPT.initSafeFrameListener.restore(); - PREBID.realignPubmaticAdapters.restore(); UTIL.getGeoInfo.restore(); done(); }); From aa01a3f19900d143c0ce7b27d811716d432ea819 Mon Sep 17 00:00:00 2001 From: pm-azhar-mulla Date: Fri, 26 Jul 2024 11:49:41 +0530 Subject: [PATCH 13/17] Updated test cases --- test/config.spec.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/config.spec.js b/test/config.spec.js index 53b2d7b6..28d8f7a6 100644 --- a/test/config.spec.js +++ b/test/config.spec.js @@ -2223,7 +2223,7 @@ describe('Config', function() { delete CONF[CONSTANTS.CONFIG.COMMON][CONSTANTS.COMMON.PRICE_GRANULARITY_BUCKETS] expect(CONFIG.getPriceGranularity()).to.equal(null); - UTIL.logWarning.calledWith(CONSTANTS.MESSAGES.M33).should.be.true; + UTIL.logWarning.calledWith(CONSTANTS.MESSAGES.M36).should.be.true; done(); }); }); From 8ae915c227231d19ba99577d2661340f9ee3c12e Mon Sep 17 00:00:00 2001 From: Nitin Shirsat Date: Tue, 13 Aug 2024 17:23:41 +0530 Subject: [PATCH 14/17] Added Support for GPP --- src_new/adapters/prebid.js | 2 +- src_new/common.config.js | 14 +++++++++ src_new/controllers/idhub.js | 2 +- src_new/owIdhubCommon.js | 15 ---------- test/common.config.spec.js | 55 +++++++++++++++++++++++++++++++++- test/owIdhubCommon.spec.js | 58 ------------------------------------ 6 files changed, 70 insertions(+), 76 deletions(-) delete mode 100644 src_new/owIdhubCommon.js delete mode 100644 test/owIdhubCommon.spec.js diff --git a/src_new/adapters/prebid.js b/src_new/adapters/prebid.js index 4cec6eb7..9a378660 100644 --- a/src_new/adapters/prebid.js +++ b/src_new/adapters/prebid.js @@ -861,7 +861,7 @@ exports.assignCcpaConfigIfRequired = assignCcpaConfigIfRequired; function assignGppConfigIfRequired(prebidConfig) { if (CONFIG.getGppConsent()) { - prebidConfig = owIdhubCommon.setConsentConfig(prebidConfig, "gpp", CONFIG.getGppCmpApi(), CONFIG.getGppTimeout()); + prebidConfig = COMMON_CONFIG.setConsentConfig(prebidConfig, "gpp", CONFIG.getGppCmpApi(), CONFIG.getGppTimeout()); } } diff --git a/src_new/common.config.js b/src_new/common.config.js index ab04ac9a..29c02546 100644 --- a/src_new/common.config.js +++ b/src_new/common.config.js @@ -1,7 +1,21 @@ +// NOTE: This file will contains only common code/function used in OW and IDHUB. + var config = require("./conf.js"); var CONSTANTS = require("./constants.js"); exports.getGdprActionTimeout = function() { var gdprActionTimeout = config[CONSTANTS.CONFIG.COMMON][CONSTANTS.CONFIG.GDPR_ACTION_TIMEOUT]; return gdprActionTimeout ? window.parseInt(gdprActionTimeout) : 0; +}; + +exports.setConsentConfig = function (prebidConfig, key, cmpApi, timeout) { + prebidConfig = prebidConfig || {}; + if (!prebidConfig["consentManagement"]) { + prebidConfig["consentManagement"] = {}; + } + prebidConfig["consentManagement"][key] = { + cmpApi: cmpApi, + timeout: timeout + }; + return prebidConfig; }; \ No newline at end of file diff --git a/src_new/controllers/idhub.js b/src_new/controllers/idhub.js index 36b1c9ef..329908ec 100644 --- a/src_new/controllers/idhub.js +++ b/src_new/controllers/idhub.js @@ -69,7 +69,7 @@ refThis.setConfig = function(){ // Set Gpp consent config if (CONFIG.getGppConsent()) { - prebidConfig = owIdhubCommon.setConsentConfig(prebidConfig, "gpp", CONFIG.getGppCmpApi(), CONFIG.getGppTimeout()); + prebidConfig = COMMON_CONFIG.setConsentConfig(prebidConfig, "gpp", CONFIG.getGppCmpApi(), CONFIG.getGppTimeout()); } window.IHPWT.ssoEnabled = CONFIG.isSSOEnabled() || false; diff --git a/src_new/owIdhubCommon.js b/src_new/owIdhubCommon.js deleted file mode 100644 index f25b4f8e..00000000 --- a/src_new/owIdhubCommon.js +++ /dev/null @@ -1,15 +0,0 @@ -// NOTE: This file will contains only common code/function used in OW and IDHUB. -// Do not import any other file into it. - - -exports.setConsentConfig = function (prebidConfig, key, cmpApi, timeout) { - prebidConfig = prebidConfig || {}; - if (!prebidConfig["consentManagement"]) { - prebidConfig["consentManagement"] = {}; - } - prebidConfig["consentManagement"][key] = { - cmpApi: cmpApi, - timeout: timeout - }; - return prebidConfig; -}; \ No newline at end of file diff --git a/test/common.config.spec.js b/test/common.config.spec.js index f6c103eb..b1673fd8 100644 --- a/test/common.config.spec.js +++ b/test/common.config.spec.js @@ -1,6 +1,7 @@ var CONF = require("../src_new/conf.js"); var CONSTANTS = require("../src_new/constants.js"); var COMMON_CONFIG = require("../src_new/common.config.js"); +var expect = require("chai").expect; describe('COMMON CONFIG FILE', function () { describe('#getGdprActionTimeout', function () { @@ -21,4 +22,56 @@ describe('COMMON CONFIG FILE', function () { done(); }); }); -}); \ No newline at end of file + + describe('setConsentConfig function', function () { + var prebidConfig = {}; + var cmpApi = 'iab'; + var timeout = 2000; + + it('setConsentConfig a function', function (done) { + COMMON_CONFIG.setConsentConfig.should.be.a('function'); + done(); + }); + + it('should set consent management config when its not present', function (done) { + var expPrebidConfig = { + consentManagement: { + gpp: { + cmpApi, + timeout + } + } + }; + const actPrebifConfig = COMMON_CONFIG.setConsentConfig(prebidConfig, 'gpp', cmpApi, timeout); + expect(actPrebifConfig).to.be.deep.equal(expPrebidConfig); + done(); + }); + + it('should set consent management config when its present', function (done) { + var prebidConfig = { + consentManagement: { + gdpr: { + cmpApi, + timeout + } + } + } + var expPrebidConfig = { + consentManagement: { + gdpr: { + cmpApi, + timeout + }, + gpp: { + cmpApi, + timeout + } + } + }; + const actPrebifConfig = COMMON_CONFIG.setConsentConfig(prebidConfig, 'gpp', cmpApi, timeout); + expect(actPrebifConfig).to.be.deep.equal(expPrebidConfig); + done(); + }); + }); +}); + diff --git a/test/owIdhubCommon.spec.js b/test/owIdhubCommon.spec.js deleted file mode 100644 index 6bede58a..00000000 --- a/test/owIdhubCommon.spec.js +++ /dev/null @@ -1,58 +0,0 @@ -/* global describe, it, xit, sinon, expect */ -// var sinon = require("sinon"); -var should = require("chai").should(); -var expect = require("chai").expect; -var OWIDHUBCOMMON = require("../src_new/owIdhubCommon"); - -describe('owIdhubCommon', function() { - describe('setConsentConfig', function() { - var prebidConfig = {}; - var cmpApi = 'iab'; - var timeout = 2000; - - it('setConsentConfig a function', function(done) { - OWIDHUBCOMMON.setConsentConfig.should.be.a('function'); - done(); - }); - - it('should set consent management config when its not present', function(done) { - var expPrebidConfig = { - consentManagement: { - gpp: { - cmpApi, - timeout - } - } - }; - const actPrebifConfig = OWIDHUBCOMMON.setConsentConfig(prebidConfig, 'gpp', cmpApi, timeout); - expect(actPrebifConfig).to.be.deep.equal(expPrebidConfig); - done(); - }); - - it('should set consent management config when its present', function(done) { - var prebidConfig = { - consentManagement: { - gdpr: { - cmpApi, - timeout - } - } - } - var expPrebidConfig = { - consentManagement: { - gdpr: { - cmpApi, - timeout - }, - gpp: { - cmpApi, - timeout - } - } - }; - const actPrebifConfig = OWIDHUBCOMMON.setConsentConfig(prebidConfig, 'gpp', cmpApi, timeout); - expect(actPrebifConfig).to.be.deep.equal(expPrebidConfig); - done(); - }); - }); -}); \ No newline at end of file From 02281ba09db411a4246213f1535941882b7963b6 Mon Sep 17 00:00:00 2001 From: Nitin Shirsat Date: Mon, 26 Aug 2024 11:43:23 +0530 Subject: [PATCH 15/17] Sync with nightly --- init-build.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/init-build.sh b/init-build.sh index 6a269da5..c8f7e59d 100755 --- a/init-build.sh +++ b/init-build.sh @@ -53,7 +53,7 @@ then fi -OpenWrapNodeModules="${GLOBAL_OPENWRAP_PKG_JSON_DIR_V8_52_0}/node_modules/" +OpenWrapNodeModules="${GLOBAL_OPENWRAP_PKG_JSON_DIR_V9_6_0}/node_modules/" function prebidNpmInstall() { @@ -62,7 +62,7 @@ function prebidNpmInstall() { -PrebidJSNodeModules="${GLOBAL_PREBID_PKG_JSON_DIR_V8_52_0}/node_modules/" +PrebidJSNodeModules="${GLOBAL_PREBID_PKG_JSON_DIR_V9_6_0}/node_modules/" symLinkForPrebidNodeModules=node_modules From 3525837d5c6c3ed9a444fbb35a2affb181b13619 Mon Sep 17 00:00:00 2001 From: Nitin Shirsat Date: Mon, 26 Aug 2024 11:45:49 +0530 Subject: [PATCH 16/17] Sync with nightly --- init-build.sh | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/init-build.sh b/init-build.sh index c8f7e59d..2d9b8ded 100755 --- a/init-build.sh +++ b/init-build.sh @@ -52,19 +52,15 @@ then exit 1 fi - OpenWrapNodeModules="${GLOBAL_OPENWRAP_PKG_JSON_DIR_V9_6_0}/node_modules/" - function prebidNpmInstall() { echo "This is SymLinking Start" cd $1 - PrebidJSNodeModules="${GLOBAL_PREBID_PKG_JSON_DIR_V9_6_0}/node_modules/" - symLinkForPrebidNodeModules=node_modules if [ -L $symLinkForPrebidNodeModules ]; then unlink $symLinkForPrebidNodeModules @@ -111,4 +107,4 @@ elif [ "$platform" = "$PLATFORM_AMP" ] ./build.sh --task=$task --mode=$mode else echo "None" -fi +fi \ No newline at end of file From ecb045bbc63229bc046f70a77fc760c67f1f96fe Mon Sep 17 00:00:00 2001 From: pm-azhar-mulla Date: Tue, 27 Aug 2024 14:20:03 +0530 Subject: [PATCH 17/17] removed the pwtpb key from ignore list --- src_new/controllers/gpt.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src_new/controllers/gpt.js b/src_new/controllers/gpt.js index 645d2e1f..aeff4eb2 100644 --- a/src_new/controllers/gpt.js +++ b/src_new/controllers/gpt.js @@ -320,7 +320,7 @@ function findWinningBidAndApplyTargeting(divID, parentArgs) { // TDD, i/o : done delete keyValuePairs[key]; } /* istanbul ignore else*/ - else if (!util.isOwnProperty(ignoreTheseKeys, key) && !util.isOwnProperty({"pwtpb":1}, key)) { + else if (!util.isOwnProperty(ignoreTheseKeys, key)) { googleDefinedSlot.setTargeting(key, value); // adding key in wrapperTargetingKeys as every key added by OpenWrap should be removed before calling refresh on slot refThis.defineWrapperTargetingKey(key);