From ffcd4218a4ad9bf671fd60fdac33de925e05a43c Mon Sep 17 00:00:00 2001 From: Peixun Zhang Date: Mon, 15 Jan 2024 16:13:06 +0100 Subject: [PATCH 01/19] test --- src/adapterManager.js | 2 +- test/spec/modules/eids_spec.js | 2 +- test/spec/modules/liveIntentIdSystem_spec.js | 12 ++++++++++-- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/src/adapterManager.js b/src/adapterManager.js index 72695be0946..cad1fc6ac00 100644 --- a/src/adapterManager.js +++ b/src/adapterManager.js @@ -29,7 +29,7 @@ import {hook} from './hook.js'; import {find, includes} from './polyfill.js'; import {adunitCounter} from './adUnits.js'; import {getRefererInfo} from './refererDetection.js'; -import {GDPR_GVLIDS, gdprDataHandler, gppDataHandler, uspDataHandler, } from './consentHandler.js'; +import {GDPR_GVLIDS, gdprDataHandler, gppDataHandler, uspDataHandler} from './consentHandler.js'; import * as events from './events.js'; import CONSTANTS from './constants.json'; import {useMetrics} from './utils/perfMetrics.js'; diff --git a/test/spec/modules/eids_spec.js b/test/spec/modules/eids_spec.js index 25e70f12ced..02d6c7490b2 100644 --- a/test/spec/modules/eids_spec.js +++ b/test/spec/modules/eids_spec.js @@ -1,7 +1,7 @@ import {createEidsArray} from 'modules/userId/eids.js'; import {expect} from 'chai'; -// Note: In unit tets cases for bidders, call the createEidsArray function over userId object that is used for calling fetchBids +// Note: In unit test cases for bidders, call the createEidsArray function over userId object that is used for calling fetchBids // this way the request will stay consistent and unit test cases will not need lots of changes. describe('eids array generation for known sub-modules', function() { diff --git a/test/spec/modules/liveIntentIdSystem_spec.js b/test/spec/modules/liveIntentIdSystem_spec.js index 3af598c5d4e..96bd3b9566b 100644 --- a/test/spec/modules/liveIntentIdSystem_spec.js +++ b/test/spec/modules/liveIntentIdSystem_spec.js @@ -1,6 +1,6 @@ import { liveIntentIdSubmodule, reset as resetLiveIntentIdSubmodule, storage } from 'modules/liveIntentIdSystem.js'; import * as utils from 'src/utils.js'; -import { gdprDataHandler, uspDataHandler, gppDataHandler } from '../../../src/adapterManager.js'; +import { gdprDataHandler, uspDataHandler, gppDataHandler, coppaDataHandler} from '../../../src/adapterManager.js'; import { server } from 'test/mocks/xhr.js'; resetLiveIntentIdSubmodule(); liveIntentIdSubmodule.setModuleMode('standard') @@ -16,6 +16,7 @@ describe('LiveIntentId', function() { let getCookieStub; let getDataFromLocalStorageStub; let imgStub; + let coppaConsentDataStub; beforeEach(function() { liveIntentIdSubmodule.setModuleMode('standard'); @@ -26,6 +27,7 @@ describe('LiveIntentId', function() { uspConsentDataStub = sinon.stub(uspDataHandler, 'getConsentData'); gdprConsentDataStub = sinon.stub(gdprDataHandler, 'getConsentData'); gppConsentDataStub = sinon.stub(gppDataHandler, 'getConsentData'); + coppaConsentDataStub = sinon.stub(coppaDataHandler); }); afterEach(function() { @@ -36,6 +38,7 @@ describe('LiveIntentId', function() { uspConsentDataStub.restore(); gdprConsentDataStub.restore(); gppConsentDataStub.restore(); + coppaConsentDataStub.restore(); resetLiveIntentIdSubmodule(); }); @@ -439,4 +442,9 @@ describe('LiveIntentId', function() { ); expect(callBackSpy.calledOnce).to.be.true; }); -}); + + it('should decode a idcookie cookie as shared id if exist', function() { + const result = coppaConsentDataStub.returns(getCoppa()) && liveIntentIdSubmodule.decode({nonid: 'foo', pubcid: 'bar'}) + expect(result).to.eql({'lipb': {'lipbid': 'foo', 'nonId': 'foo', 'pubcid': 'bar'}, 'pubcid': {'id': 'bar', 'ext': {'provider': 'pubcid.org'}}}) + }); +}) From 511ac6aac3d6287aa6a6c93291b2fca18eb5e311 Mon Sep 17 00:00:00 2001 From: Peixun Zhang Date: Mon, 15 Jan 2024 16:19:00 +0100 Subject: [PATCH 02/19] correct test --- test/spec/modules/liveIntentIdSystem_spec.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/spec/modules/liveIntentIdSystem_spec.js b/test/spec/modules/liveIntentIdSystem_spec.js index 96bd3b9566b..3c0aca2748b 100644 --- a/test/spec/modules/liveIntentIdSystem_spec.js +++ b/test/spec/modules/liveIntentIdSystem_spec.js @@ -443,8 +443,8 @@ describe('LiveIntentId', function() { expect(callBackSpy.calledOnce).to.be.true; }); - it('should decode a idcookie cookie as shared id if exist', function() { - const result = coppaConsentDataStub.returns(getCoppa()) && liveIntentIdSubmodule.decode({nonid: 'foo', pubcid: 'bar'}) + it('should decode a idcookie as sharedId if exist', function() { + const result = !coppaConsentDataStub.returns(getCoppa()) && liveIntentIdSubmodule.decode({nonid: 'foo', pubcid: 'bar'}) expect(result).to.eql({'lipb': {'lipbid': 'foo', 'nonId': 'foo', 'pubcid': 'bar'}, 'pubcid': {'id': 'bar', 'ext': {'provider': 'pubcid.org'}}}) }); }) From fb537d01e1bb295a2e8d440ec338ec2ffed4ed1b Mon Sep 17 00:00:00 2001 From: Peixun Zhang Date: Mon, 15 Jan 2024 17:09:20 +0100 Subject: [PATCH 03/19] test --- modules/liveIntentIdSystem.js | 12 +++++++++--- test/spec/modules/liveIntentIdSystem_spec.js | 17 ++++++++++++----- 2 files changed, 21 insertions(+), 8 deletions(-) diff --git a/modules/liveIntentIdSystem.js b/modules/liveIntentIdSystem.js index ad71a584e42..7835317a5d8 100644 --- a/modules/liveIntentIdSystem.js +++ b/modules/liveIntentIdSystem.js @@ -194,9 +194,8 @@ export const liveIntentIdSubmodule = { // old versions stored lipbid in unifiedId. Ensure that we can still read the data. const lipbid = value.nonId || value.unifiedId if (lipbid) { - value.lipbid = lipbid - delete value.unifiedId - result.lipb = value + result.lipb = { ...value, lipbid } + delete result.lipb.unifiedId } // Lift usage of uid2 by exposing uid2 if we were asked to resolve it. @@ -234,6 +233,13 @@ export const liveIntentIdSubmodule = { result.sovrn = { 'id': value.sovrn, ext: { provider: LI_PROVIDER_DOMAIN } } } + if (value.idcookie && !coppaDataHandler.getCoppa()) { + result.lipb.pubcid = value.idcookie + delete result.lipb.idcookie + + result.pubcid = { 'id': value.idcookie, ext: { provider: LI_PROVIDER_DOMAIN } } + } + return result } diff --git a/test/spec/modules/liveIntentIdSystem_spec.js b/test/spec/modules/liveIntentIdSystem_spec.js index 3c0aca2748b..ce52fe72c3e 100644 --- a/test/spec/modules/liveIntentIdSystem_spec.js +++ b/test/spec/modules/liveIntentIdSystem_spec.js @@ -1,6 +1,6 @@ import { liveIntentIdSubmodule, reset as resetLiveIntentIdSubmodule, storage } from 'modules/liveIntentIdSystem.js'; import * as utils from 'src/utils.js'; -import { gdprDataHandler, uspDataHandler, gppDataHandler, coppaDataHandler} from '../../../src/adapterManager.js'; +import { gdprDataHandler, uspDataHandler, gppDataHandler, coppaDataHandler } from '../../../src/adapterManager.js'; import { server } from 'test/mocks/xhr.js'; resetLiveIntentIdSubmodule(); liveIntentIdSubmodule.setModuleMode('standard') @@ -27,7 +27,7 @@ describe('LiveIntentId', function() { uspConsentDataStub = sinon.stub(uspDataHandler, 'getConsentData'); gdprConsentDataStub = sinon.stub(gdprDataHandler, 'getConsentData'); gppConsentDataStub = sinon.stub(gppDataHandler, 'getConsentData'); - coppaConsentDataStub = sinon.stub(coppaDataHandler); + coppaConsentDataStub = sinon.stub(coppaDataHandler, 'getConsentData'); }); afterEach(function() { @@ -443,8 +443,15 @@ describe('LiveIntentId', function() { expect(callBackSpy.calledOnce).to.be.true; }); - it('should decode a idcookie as sharedId if exist', function() { - const result = !coppaConsentDataStub.returns(getCoppa()) && liveIntentIdSubmodule.decode({nonid: 'foo', pubcid: 'bar'}) - expect(result).to.eql({'lipb': {'lipbid': 'foo', 'nonId': 'foo', 'pubcid': 'bar'}, 'pubcid': {'id': 'bar', 'ext': {'provider': 'pubcid.org'}}}) + it('should decode a idcookie as sharedId if it exist and coppa is false', function() { + coppaConsentDataStub.returns(false) + const result = liveIntentIdSubmodule.decode({nonId: 'foo', idcookie: 'bar'}) + expect(result).to.eql({'lipb': {'lipbid': 'foo', 'nonId': 'foo', 'pubcid': 'bar'}, 'pubcid': {'id': 'bar', 'ext': {'provider': 'liveintent.com'}}}) + }); + + it('should not decode a idcookie as sharedId if it exist and coppa is true', function() { + coppaConsentDataStub.returns(true) + const result = liveIntentIdSubmodule.decode({nonId: 'foo', idcookie: 'bar'}) + expect(result).to.eql({'lipb': {'lipbid': 'foo', 'nonId': 'foo', 'pubcid': 'bar'}, 'pubcid': {'id': 'bar', 'ext': {'provider': 'liveintent.com'}}}) }); }) From a70f85b3d32123ea777bda9beec0a18772c5c0be Mon Sep 17 00:00:00 2001 From: Peixun Zhang Date: Tue, 16 Jan 2024 18:12:55 +0100 Subject: [PATCH 04/19] ext field --- libraries/pubcidEids/pubcidEids.js | 18 ++++++++++++++++++ modules/liveIntentIdSystem.js | 20 +++++++++++++++++--- package-lock.json | 12 ++++++------ package.json | 2 +- 4 files changed, 42 insertions(+), 10 deletions(-) create mode 100644 libraries/pubcidEids/pubcidEids.js diff --git a/libraries/pubcidEids/pubcidEids.js b/libraries/pubcidEids/pubcidEids.js new file mode 100644 index 00000000000..df262c9486a --- /dev/null +++ b/libraries/pubcidEids/pubcidEids.js @@ -0,0 +1,18 @@ +export const PUBCID_EIDS = { + 'pubcid': { + source: 'pubcid.org', + atype: 1, + getValue: function(data) { + if (data.id) { + return data.id + } else { + return data + } + }, + getUidExt: function(data) { + if (data.ext) { + return data.ext; + } + } + } +} diff --git a/modules/liveIntentIdSystem.js b/modules/liveIntentIdSystem.js index 7835317a5d8..9e53ccb3f99 100644 --- a/modules/liveIntentIdSystem.js +++ b/modules/liveIntentIdSystem.js @@ -84,8 +84,15 @@ function parseLiveIntentCollectorConfig(collectConfig) { * @returns {Array} */ function parseRequestedAttributes(overrides) { + function renameAttribute(attribute) { + if (attribute === 'sharedId') { + return 'idcookie' + } else { + return attribute + } + } function createParameterArray(config) { - return Object.entries(config).flatMap(([k, v]) => (typeof v === 'boolean' && v) ? [k] : []); + return Object.entries(config).flatMap(([k, v]) => (typeof v === 'boolean' && v) ? [renameAttribute(k)] : []); } if (typeof overrides === 'object') { return createParameterArray({...defaultRequestedAttributes, ...overrides}) @@ -125,6 +132,13 @@ function initializeLiveConnect(configParams) { liveConnectConfig.identityResolutionConfig = identityResolutionConfig; liveConnectConfig.identifiersToResolve = configParams.identifiersToResolve || []; liveConnectConfig.fireEventDelay = configParams.fireEventDelay; + + liveConnectConfig.idCookie = {} + const sharedIdConfig = configParams.sharedId || {} + liveConnectConfig.idCookie.mode = sharedIdConfig.mode || 'generated' + liveConnectConfig.idCookie.name = sharedIdConfig.name + liveConnectConfig.idCookie.strategy = sharedIdConfig.strategy + const usPrivacyString = uspDataHandler.getConsentData(); if (usPrivacyString) { liveConnectConfig.usPrivacyString = usPrivacyString; @@ -189,7 +203,7 @@ export const liveIntentIdSubmodule = { decode(value, config) { const configParams = (config && config.params) || {}; function composeIdObject(value) { - const result = {}; + const result = { }; // old versions stored lipbid in unifiedId. Ensure that we can still read the data. const lipbid = value.nonId || value.unifiedId @@ -234,7 +248,7 @@ export const liveIntentIdSubmodule = { } if (value.idcookie && !coppaDataHandler.getCoppa()) { - result.lipb.pubcid = value.idcookie + result.lipb = { ...result.lipb, pubcid: value.idcookie } delete result.lipb.idcookie result.pubcid = { 'id': value.idcookie, ext: { provider: LI_PROVIDER_DOMAIN } } diff --git a/package-lock.json b/package-lock.json index 4686462599c..e3734b4ca65 100644 --- a/package-lock.json +++ b/package-lock.json @@ -19705,9 +19705,9 @@ } }, "node_modules/live-connect-js": { - "version": "6.3.4", - "resolved": "https://registry.npmjs.org/live-connect-js/-/live-connect-js-6.3.4.tgz", - "integrity": "sha512-lg2XeCaj/eEbK66QGGDEdz9IdT/K3ExZ83Qo6xGVLdP5XJ33xAUCk/gds34rRTmpIwUfAnboOpyj3UoYtS3QUQ==", + "version": "6.4.2", + "resolved": "https://registry.npmjs.org/live-connect-js/-/live-connect-js-6.4.2.tgz", + "integrity": "sha512-VXjOKh+GLFJxKA9pgNeB5SHkkEwuV/0zZIflN0eY5J3NB5VYgIVsyoaYGoY4F4C/ia8EDMDn1/4l0DxLEi2mIg==", "dependencies": { "live-connect-common": "^v3.0.3", "tiny-hashes": "1.0.1" @@ -44253,9 +44253,9 @@ "integrity": "sha512-ZPycT04ROBUvPiksnLTunrKC3ROhBSeO99fQ+4qMIkgKwP2CvS44L7fK+0WFV4nAi+65KbzSng7JWcSlckfw8w==" }, "live-connect-js": { - "version": "6.3.4", - "resolved": "https://registry.npmjs.org/live-connect-js/-/live-connect-js-6.3.4.tgz", - "integrity": "sha512-lg2XeCaj/eEbK66QGGDEdz9IdT/K3ExZ83Qo6xGVLdP5XJ33xAUCk/gds34rRTmpIwUfAnboOpyj3UoYtS3QUQ==", + "version": "6.4.2", + "resolved": "https://registry.npmjs.org/live-connect-js/-/live-connect-js-6.4.2.tgz", + "integrity": "sha512-VXjOKh+GLFJxKA9pgNeB5SHkkEwuV/0zZIflN0eY5J3NB5VYgIVsyoaYGoY4F4C/ia8EDMDn1/4l0DxLEi2mIg==", "requires": { "live-connect-common": "^v3.0.3", "tiny-hashes": "1.0.1" diff --git a/package.json b/package.json index 1954a8c1294..ea32f150455 100644 --- a/package.json +++ b/package.json @@ -133,7 +133,7 @@ "express": "^4.15.4", "fun-hooks": "^0.9.9", "just-clone": "^1.0.2", - "live-connect-js": "^6.3.4" + "live-connect-js": "^6.4.0" }, "optionalDependencies": { "fsevents": "^2.3.2" From 4449b86ccb98621c16b8e0973ef81d3df9bcee2e Mon Sep 17 00:00:00 2001 From: PeiZ <74068135+peixunzhang@users.noreply.github.com> Date: Mon, 22 Jan 2024 07:43:22 +0100 Subject: [PATCH 05/19] Update test/spec/modules/liveIntentIdSystem_spec.js Co-authored-by: Viktor Dreiling <34981284+3link@users.noreply.github.com> --- test/spec/modules/liveIntentIdSystem_spec.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/spec/modules/liveIntentIdSystem_spec.js b/test/spec/modules/liveIntentIdSystem_spec.js index ce52fe72c3e..0769540b4ba 100644 --- a/test/spec/modules/liveIntentIdSystem_spec.js +++ b/test/spec/modules/liveIntentIdSystem_spec.js @@ -443,7 +443,7 @@ describe('LiveIntentId', function() { expect(callBackSpy.calledOnce).to.be.true; }); - it('should decode a idcookie as sharedId if it exist and coppa is false', function() { + it('should decode a idcookie as sharedId if it exists and coppa is false', function() { coppaConsentDataStub.returns(false) const result = liveIntentIdSubmodule.decode({nonId: 'foo', idcookie: 'bar'}) expect(result).to.eql({'lipb': {'lipbid': 'foo', 'nonId': 'foo', 'pubcid': 'bar'}, 'pubcid': {'id': 'bar', 'ext': {'provider': 'liveintent.com'}}}) From da268585c885e459f1027266a3844442a50d09ba Mon Sep 17 00:00:00 2001 From: PeiZ <74068135+peixunzhang@users.noreply.github.com> Date: Mon, 22 Jan 2024 07:43:28 +0100 Subject: [PATCH 06/19] Update test/spec/modules/liveIntentIdSystem_spec.js Co-authored-by: Viktor Dreiling <34981284+3link@users.noreply.github.com> --- modules/liveIntentIdSystem.js | 49 +++++++++++--------- package-lock.json | 30 ++++++------ package.json | 2 +- test/spec/modules/eids_spec.js | 33 +++++++++++++ test/spec/modules/liveIntentIdSystem_spec.js | 2 +- 5 files changed, 76 insertions(+), 40 deletions(-) diff --git a/modules/liveIntentIdSystem.js b/modules/liveIntentIdSystem.js index 9e53ccb3f99..2b1cc8a663d 100644 --- a/modules/liveIntentIdSystem.js +++ b/modules/liveIntentIdSystem.js @@ -102,60 +102,61 @@ function parseRequestedAttributes(overrides) { } function initializeLiveConnect(configParams) { - configParams = configParams || {}; if (liveConnect) { return liveConnect; } + configParams = configParams || {}; + const sharedIdConfig = configParams.sharedId || {} + const publisherId = configParams.publisherId || 'any'; const identityResolutionConfig = { publisherId: publisherId, requestedAttributes: parseRequestedAttributes(configParams.requestedAttributesOverrides) - }; + } if (configParams.url) { identityResolutionConfig.url = configParams.url } - identityResolutionConfig.ajaxTimeout = configParams.ajaxTimeout || DEFAULT_AJAX_TIMEOUT; + identityResolutionConfig.ajaxTimeout = configParams.ajaxTimeout || DEFAULT_AJAX_TIMEOUT + identityResolutionConfig.idCookieMode = sharedIdConfig.mode || 'generated' const liveConnectConfig = parseLiveIntentCollectorConfig(configParams.liCollectConfig); if (!liveConnectConfig.appId && configParams.distributorId) { - liveConnectConfig.distributorId = configParams.distributorId; - identityResolutionConfig.source = configParams.distributorId; + liveConnectConfig.distributorId = configParams.distributorId + identityResolutionConfig.source = configParams.distributorId } else { identityResolutionConfig.source = configParams.partner || 'prebid' } - liveConnectConfig.wrapperName = 'prebid'; - liveConnectConfig.trackerVersion = '$prebid.version$'; - liveConnectConfig.identityResolutionConfig = identityResolutionConfig; - liveConnectConfig.identifiersToResolve = configParams.identifiersToResolve || []; - liveConnectConfig.fireEventDelay = configParams.fireEventDelay; + liveConnectConfig.wrapperName = 'prebid' + liveConnectConfig.trackerVersion = '$prebid.version$' + liveConnectConfig.identityResolutionConfig = identityResolutionConfig + liveConnectConfig.identifiersToResolve = configParams.identifiersToResolve || [] + liveConnectConfig.fireEventDelay = configParams.fireEventDelay liveConnectConfig.idCookie = {} - const sharedIdConfig = configParams.sharedId || {} - liveConnectConfig.idCookie.mode = sharedIdConfig.mode || 'generated' liveConnectConfig.idCookie.name = sharedIdConfig.name liveConnectConfig.idCookie.strategy = sharedIdConfig.strategy - const usPrivacyString = uspDataHandler.getConsentData(); + const usPrivacyString = uspDataHandler.getConsentData() if (usPrivacyString) { - liveConnectConfig.usPrivacyString = usPrivacyString; + liveConnectConfig.usPrivacyString = usPrivacyString } const gdprConsent = gdprDataHandler.getConsentData() if (gdprConsent) { - liveConnectConfig.gdprApplies = gdprConsent.gdprApplies; - liveConnectConfig.gdprConsent = gdprConsent.consentString; + liveConnectConfig.gdprApplies = gdprConsent.gdprApplies + liveConnectConfig.gdprConsent = gdprConsent.consentString } - const gppConsent = gppDataHandler.getConsentData(); + const gppConsent = gppDataHandler.getConsentData() if (gppConsent) { - liveConnectConfig.gppString = gppConsent.gppString; - liveConnectConfig.gppApplicableSections = gppConsent.applicableSections; + liveConnectConfig.gppString = gppConsent.gppString + liveConnectConfig.gppApplicableSections = gppConsent.applicableSections } // The second param is the storage object, LS & Cookie manipulation uses PBJS // The third param is the ajax and pixel object, the ajax and pixel use PBJS - liveConnect = liveIntentIdSubmodule.getInitializer()(liveConnectConfig, storage, calls); + liveConnect = liveIntentIdSubmodule.getInitializer()(liveConnectConfig, storage, calls) if (configParams.emailHash) { liveConnect.push({ hash: configParams.emailHash }) } @@ -203,13 +204,15 @@ export const liveIntentIdSubmodule = { decode(value, config) { const configParams = (config && config.params) || {}; function composeIdObject(value) { - const result = { }; + const result = { }; // old versions stored lipbid in unifiedId. Ensure that we can still read the data. const lipbid = value.nonId || value.unifiedId if (lipbid) { - result.lipb = { ...value, lipbid } - delete result.lipb.unifiedId + const lipb = { ...value, lipbid } + delete lipb.unifiedId + + result.lipb = lipb } // Lift usage of uid2 by exposing uid2 if we were asked to resolve it. diff --git a/package-lock.json b/package-lock.json index e3734b4ca65..9b5409114ee 100644 --- a/package-lock.json +++ b/package-lock.json @@ -22,7 +22,7 @@ "express": "^4.15.4", "fun-hooks": "^0.9.9", "just-clone": "^1.0.2", - "live-connect-js": "^6.3.4" + "live-connect-js": "^6.4.5" }, "devDependencies": { "@babel/eslint-parser": "^7.16.5", @@ -19697,19 +19697,19 @@ "dev": true }, "node_modules/live-connect-common": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/live-connect-common/-/live-connect-common-3.0.3.tgz", - "integrity": "sha512-ZPycT04ROBUvPiksnLTunrKC3ROhBSeO99fQ+4qMIkgKwP2CvS44L7fK+0WFV4nAi+65KbzSng7JWcSlckfw8w==", + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/live-connect-common/-/live-connect-common-3.1.1.tgz", + "integrity": "sha512-sV0oUvJnaTN41f30hOo3wDjZL2y8TYu5BQKvlxmek7Agpe2AGGN/dsPA8i2sHkessRKpcTfrPjmpnG2bIxq7Gg==", "engines": { "node": ">=18" } }, "node_modules/live-connect-js": { - "version": "6.4.2", - "resolved": "https://registry.npmjs.org/live-connect-js/-/live-connect-js-6.4.2.tgz", - "integrity": "sha512-VXjOKh+GLFJxKA9pgNeB5SHkkEwuV/0zZIflN0eY5J3NB5VYgIVsyoaYGoY4F4C/ia8EDMDn1/4l0DxLEi2mIg==", + "version": "6.4.5", + "resolved": "https://registry.npmjs.org/live-connect-js/-/live-connect-js-6.4.5.tgz", + "integrity": "sha512-MVlUGMmy3BbyFKvzMy2GItMMUzEc0XY308MoOQ3BNvT1zy4NXjIvxEXEvx0I9jRz21UZthxZpjzHxT/hbLD3ug==", "dependencies": { - "live-connect-common": "^v3.0.3", + "live-connect-common": "^v3.1.1", "tiny-hashes": "1.0.1" }, "engines": { @@ -44248,16 +44248,16 @@ "dev": true }, "live-connect-common": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/live-connect-common/-/live-connect-common-3.0.3.tgz", - "integrity": "sha512-ZPycT04ROBUvPiksnLTunrKC3ROhBSeO99fQ+4qMIkgKwP2CvS44L7fK+0WFV4nAi+65KbzSng7JWcSlckfw8w==" + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/live-connect-common/-/live-connect-common-3.1.1.tgz", + "integrity": "sha512-sV0oUvJnaTN41f30hOo3wDjZL2y8TYu5BQKvlxmek7Agpe2AGGN/dsPA8i2sHkessRKpcTfrPjmpnG2bIxq7Gg==" }, "live-connect-js": { - "version": "6.4.2", - "resolved": "https://registry.npmjs.org/live-connect-js/-/live-connect-js-6.4.2.tgz", - "integrity": "sha512-VXjOKh+GLFJxKA9pgNeB5SHkkEwuV/0zZIflN0eY5J3NB5VYgIVsyoaYGoY4F4C/ia8EDMDn1/4l0DxLEi2mIg==", + "version": "6.4.5", + "resolved": "https://registry.npmjs.org/live-connect-js/-/live-connect-js-6.4.5.tgz", + "integrity": "sha512-MVlUGMmy3BbyFKvzMy2GItMMUzEc0XY308MoOQ3BNvT1zy4NXjIvxEXEvx0I9jRz21UZthxZpjzHxT/hbLD3ug==", "requires": { - "live-connect-common": "^v3.0.3", + "live-connect-common": "^v3.1.1", "tiny-hashes": "1.0.1" } }, diff --git a/package.json b/package.json index ea32f150455..e36959dcddb 100644 --- a/package.json +++ b/package.json @@ -133,7 +133,7 @@ "express": "^4.15.4", "fun-hooks": "^0.9.9", "just-clone": "^1.0.2", - "live-connect-js": "^6.4.0" + "live-connect-js": "^6.4.5" }, "optionalDependencies": { "fsevents": "^2.3.2" diff --git a/test/spec/modules/eids_spec.js b/test/spec/modules/eids_spec.js index 02d6c7490b2..3ad6dfe061b 100644 --- a/test/spec/modules/eids_spec.js +++ b/test/spec/modules/eids_spec.js @@ -417,6 +417,39 @@ describe('eids array generation for known sub-modules', function() { }); }); + it('pubcid', function() { + const userId = { + pubcid: {'id': 'sample_id'} + }; + const newEids = createEidsArray(userId); + expect(newEids.length).to.equal(1); + expect(newEids[0]).to.deep.equal({ + source: 'pubcid.org', + uids: [{ + id: 'sample_id', + atype: 1 + }] + }); + }); + + it('pubcid with ext', function() { + const userId = { + pubcid: {'id': 'sample_id', 'ext': {'provider': 'some.provider.com'}} + }; + const newEids = createEidsArray(userId); + expect(newEids.length).to.equal(1); + expect(newEids[0]).to.deep.equal({ + source: 'pubcid.org', + uids: [{ + id: 'sample_id', + atype: 1, + ext: { + provider: 'some.provider.com' + } + }] + }); + }); + it('britepoolId', function() { const userId = { britepoolid: 'some-random-id-value' diff --git a/test/spec/modules/liveIntentIdSystem_spec.js b/test/spec/modules/liveIntentIdSystem_spec.js index 0769540b4ba..26068727a29 100644 --- a/test/spec/modules/liveIntentIdSystem_spec.js +++ b/test/spec/modules/liveIntentIdSystem_spec.js @@ -449,7 +449,7 @@ describe('LiveIntentId', function() { expect(result).to.eql({'lipb': {'lipbid': 'foo', 'nonId': 'foo', 'pubcid': 'bar'}, 'pubcid': {'id': 'bar', 'ext': {'provider': 'liveintent.com'}}}) }); - it('should not decode a idcookie as sharedId if it exist and coppa is true', function() { + it('should not decode a idcookie as sharedId if it exists and coppa is true', function() { coppaConsentDataStub.returns(true) const result = liveIntentIdSubmodule.decode({nonId: 'foo', idcookie: 'bar'}) expect(result).to.eql({'lipb': {'lipbid': 'foo', 'nonId': 'foo', 'pubcid': 'bar'}, 'pubcid': {'id': 'bar', 'ext': {'provider': 'liveintent.com'}}}) From f4475c3b35fc391994438f0582a56138034adfe1 Mon Sep 17 00:00:00 2001 From: Peixun Zhang Date: Tue, 23 Jan 2024 17:59:00 +0100 Subject: [PATCH 07/19] add flat --- libraries/pubcidEids/pubcidEids.js | 2 +- test/spec/modules/eids_spec.js | 15 +++++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/libraries/pubcidEids/pubcidEids.js b/libraries/pubcidEids/pubcidEids.js index df262c9486a..ceb238f37c7 100644 --- a/libraries/pubcidEids/pubcidEids.js +++ b/libraries/pubcidEids/pubcidEids.js @@ -2,7 +2,7 @@ export const PUBCID_EIDS = { 'pubcid': { source: 'pubcid.org', atype: 1, - getValue: function(data) { + getValue: function(data) { if (data.id) { return data.id } else { diff --git a/test/spec/modules/eids_spec.js b/test/spec/modules/eids_spec.js index 3ad6dfe061b..b82f675785c 100644 --- a/test/spec/modules/eids_spec.js +++ b/test/spec/modules/eids_spec.js @@ -432,6 +432,21 @@ describe('eids array generation for known sub-modules', function() { }); }); + it('pubcid flat', function() { + const userId = { + pubcid: 'sample_id' + }; + const newEids = createEidsArray(userId); + expect(newEids.length).to.equal(1); + expect(newEids[0]).to.deep.equal({ + source: 'pubcid.org', + uids: [{ + id: 'sample_id', + atype: 1 + }] + }); + }); + it('pubcid with ext', function() { const userId = { pubcid: {'id': 'sample_id', 'ext': {'provider': 'some.provider.com'}} From 75e00f1033e5338e2cf9659ea56905924533a3fe Mon Sep 17 00:00:00 2001 From: Peixun Zhang Date: Thu, 8 Feb 2024 16:22:14 +0100 Subject: [PATCH 08/19] remove generated --- modules/liveIntentIdSystem.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/liveIntentIdSystem.js b/modules/liveIntentIdSystem.js index 2b1cc8a663d..adcb4458312 100644 --- a/modules/liveIntentIdSystem.js +++ b/modules/liveIntentIdSystem.js @@ -119,7 +119,7 @@ function initializeLiveConnect(configParams) { } identityResolutionConfig.ajaxTimeout = configParams.ajaxTimeout || DEFAULT_AJAX_TIMEOUT - identityResolutionConfig.idCookieMode = sharedIdConfig.mode || 'generated' + identityResolutionConfig.idCookieMode = sharedIdConfig.mode const liveConnectConfig = parseLiveIntentCollectorConfig(configParams.liCollectConfig); From ed33a00a4010abdac1e6fa60c75cff38bb91b58d Mon Sep 17 00:00:00 2001 From: Peixun Zhang Date: Thu, 8 Feb 2024 17:40:59 +0100 Subject: [PATCH 09/19] no mode --- modules/liveIntentIdSystem.js | 1 - 1 file changed, 1 deletion(-) diff --git a/modules/liveIntentIdSystem.js b/modules/liveIntentIdSystem.js index adcb4458312..ac5861b760d 100644 --- a/modules/liveIntentIdSystem.js +++ b/modules/liveIntentIdSystem.js @@ -119,7 +119,6 @@ function initializeLiveConnect(configParams) { } identityResolutionConfig.ajaxTimeout = configParams.ajaxTimeout || DEFAULT_AJAX_TIMEOUT - identityResolutionConfig.idCookieMode = sharedIdConfig.mode const liveConnectConfig = parseLiveIntentCollectorConfig(configParams.liCollectConfig); From 7c353efe27c9fadce169998e1283758b511808f9 Mon Sep 17 00:00:00 2001 From: Peixun Zhang Date: Fri, 9 Feb 2024 15:34:10 +0100 Subject: [PATCH 10/19] fix test --- modules/liveIntentIdSystem.js | 53 ++++++++++---------- package-lock.json | 14 +++--- package.json | 2 +- test/spec/modules/liveIntentIdSystem_spec.js | 4 +- 4 files changed, 37 insertions(+), 36 deletions(-) diff --git a/modules/liveIntentIdSystem.js b/modules/liveIntentIdSystem.js index ac5861b760d..becbcf1bd07 100644 --- a/modules/liveIntentIdSystem.js +++ b/modules/liveIntentIdSystem.js @@ -113,49 +113,49 @@ function initializeLiveConnect(configParams) { const identityResolutionConfig = { publisherId: publisherId, requestedAttributes: parseRequestedAttributes(configParams.requestedAttributesOverrides) - } + }; if (configParams.url) { - identityResolutionConfig.url = configParams.url - } + identityResolutionConfig.url = configParams.url; + }; - identityResolutionConfig.ajaxTimeout = configParams.ajaxTimeout || DEFAULT_AJAX_TIMEOUT + identityResolutionConfig.ajaxTimeout = configParams.ajaxTimeout || DEFAULT_AJAX_TIMEOUT; const liveConnectConfig = parseLiveIntentCollectorConfig(configParams.liCollectConfig); if (!liveConnectConfig.appId && configParams.distributorId) { - liveConnectConfig.distributorId = configParams.distributorId - identityResolutionConfig.source = configParams.distributorId + liveConnectConfig.distributorId = configParams.distributorId; + identityResolutionConfig.source = configParams.distributorId; } else { identityResolutionConfig.source = configParams.partner || 'prebid' } - liveConnectConfig.wrapperName = 'prebid' - liveConnectConfig.trackerVersion = '$prebid.version$' - liveConnectConfig.identityResolutionConfig = identityResolutionConfig - liveConnectConfig.identifiersToResolve = configParams.identifiersToResolve || [] - liveConnectConfig.fireEventDelay = configParams.fireEventDelay + liveConnectConfig.wrapperName = 'prebid'; + liveConnectConfig.trackerVersion = '$prebid.version$'; + liveConnectConfig.identityResolutionConfig = identityResolutionConfig; + liveConnectConfig.identifiersToResolve = configParams.identifiersToResolve || []; + liveConnectConfig.fireEventDelay = configParams.fireEventDelay; - liveConnectConfig.idCookie = {} - liveConnectConfig.idCookie.name = sharedIdConfig.name - liveConnectConfig.idCookie.strategy = sharedIdConfig.strategy + liveConnectConfig.idCookie = {}; + liveConnectConfig.idCookie.name = sharedIdConfig.name; + liveConnectConfig.idCookie.strategy = sharedIdConfig.strategy; const usPrivacyString = uspDataHandler.getConsentData() if (usPrivacyString) { - liveConnectConfig.usPrivacyString = usPrivacyString + liveConnectConfig.usPrivacyString = usPrivacyString; } const gdprConsent = gdprDataHandler.getConsentData() if (gdprConsent) { - liveConnectConfig.gdprApplies = gdprConsent.gdprApplies - liveConnectConfig.gdprConsent = gdprConsent.consentString + liveConnectConfig.gdprApplies = gdprConsent.gdprApplies; + liveConnectConfig.gdprConsent = gdprConsent.consentString; } - const gppConsent = gppDataHandler.getConsentData() + const gppConsent = gppDataHandler.getConsentData(); if (gppConsent) { - liveConnectConfig.gppString = gppConsent.gppString - liveConnectConfig.gppApplicableSections = gppConsent.applicableSections + liveConnectConfig.gppString = gppConsent.gppString; + liveConnectConfig.gppApplicableSections = gppConsent.applicableSections; } // The second param is the storage object, LS & Cookie manipulation uses PBJS // The third param is the ajax and pixel object, the ajax and pixel use PBJS - liveConnect = liveIntentIdSubmodule.getInitializer()(liveConnectConfig, storage, calls) + liveConnect = liveIntentIdSubmodule.getInitializer()(liveConnectConfig, storage, calls); if (configParams.emailHash) { liveConnect.push({ hash: configParams.emailHash }) } @@ -203,7 +203,7 @@ export const liveIntentIdSubmodule = { decode(value, config) { const configParams = (config && config.params) || {}; function composeIdObject(value) { - const result = { }; + const result = {}; // old versions stored lipbid in unifiedId. Ensure that we can still read the data. const lipbid = value.nonId || value.unifiedId @@ -249,11 +249,12 @@ export const liveIntentIdSubmodule = { result.sovrn = { 'id': value.sovrn, ext: { provider: LI_PROVIDER_DOMAIN } } } - if (value.idcookie && !coppaDataHandler.getCoppa()) { - result.lipb = { ...result.lipb, pubcid: value.idcookie } + if (value.idcookie) { + if (!coppaDataHandler.getCoppa()) { + result.lipb = { ...result.lipb, pubcid: value.idcookie } + result.pubcid = { 'id': value.idcookie, ext: { provider: LI_PROVIDER_DOMAIN } } + } delete result.lipb.idcookie - - result.pubcid = { 'id': value.idcookie, ext: { provider: LI_PROVIDER_DOMAIN } } } return result diff --git a/package-lock.json b/package-lock.json index 9b5409114ee..9faa175887d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -22,7 +22,7 @@ "express": "^4.15.4", "fun-hooks": "^0.9.9", "just-clone": "^1.0.2", - "live-connect-js": "^6.4.5" + "live-connect-js": "^6.5.0" }, "devDependencies": { "@babel/eslint-parser": "^7.16.5", @@ -19705,9 +19705,9 @@ } }, "node_modules/live-connect-js": { - "version": "6.4.5", - "resolved": "https://registry.npmjs.org/live-connect-js/-/live-connect-js-6.4.5.tgz", - "integrity": "sha512-MVlUGMmy3BbyFKvzMy2GItMMUzEc0XY308MoOQ3BNvT1zy4NXjIvxEXEvx0I9jRz21UZthxZpjzHxT/hbLD3ug==", + "version": "6.5.0", + "resolved": "https://registry.npmjs.org/live-connect-js/-/live-connect-js-6.5.0.tgz", + "integrity": "sha512-gZOKtGjPjTf6JuUtA6OZgg8w/uEP2lEtlAKWSox+rTiTRmD4U6o28MB9WEgSJWlZWwUwmWu9dL8ByxBFbsWZyg==", "dependencies": { "live-connect-common": "^v3.1.1", "tiny-hashes": "1.0.1" @@ -44253,9 +44253,9 @@ "integrity": "sha512-sV0oUvJnaTN41f30hOo3wDjZL2y8TYu5BQKvlxmek7Agpe2AGGN/dsPA8i2sHkessRKpcTfrPjmpnG2bIxq7Gg==" }, "live-connect-js": { - "version": "6.4.5", - "resolved": "https://registry.npmjs.org/live-connect-js/-/live-connect-js-6.4.5.tgz", - "integrity": "sha512-MVlUGMmy3BbyFKvzMy2GItMMUzEc0XY308MoOQ3BNvT1zy4NXjIvxEXEvx0I9jRz21UZthxZpjzHxT/hbLD3ug==", + "version": "6.5.0", + "resolved": "https://registry.npmjs.org/live-connect-js/-/live-connect-js-6.5.0.tgz", + "integrity": "sha512-gZOKtGjPjTf6JuUtA6OZgg8w/uEP2lEtlAKWSox+rTiTRmD4U6o28MB9WEgSJWlZWwUwmWu9dL8ByxBFbsWZyg==", "requires": { "live-connect-common": "^v3.1.1", "tiny-hashes": "1.0.1" diff --git a/package.json b/package.json index e36959dcddb..1e3086ca5fb 100644 --- a/package.json +++ b/package.json @@ -133,7 +133,7 @@ "express": "^4.15.4", "fun-hooks": "^0.9.9", "just-clone": "^1.0.2", - "live-connect-js": "^6.4.5" + "live-connect-js": "^6.5.0" }, "optionalDependencies": { "fsevents": "^2.3.2" diff --git a/test/spec/modules/liveIntentIdSystem_spec.js b/test/spec/modules/liveIntentIdSystem_spec.js index 26068727a29..363f2bb7b9b 100644 --- a/test/spec/modules/liveIntentIdSystem_spec.js +++ b/test/spec/modules/liveIntentIdSystem_spec.js @@ -27,7 +27,7 @@ describe('LiveIntentId', function() { uspConsentDataStub = sinon.stub(uspDataHandler, 'getConsentData'); gdprConsentDataStub = sinon.stub(gdprDataHandler, 'getConsentData'); gppConsentDataStub = sinon.stub(gppDataHandler, 'getConsentData'); - coppaConsentDataStub = sinon.stub(coppaDataHandler, 'getConsentData'); + coppaConsentDataStub = sinon.stub(coppaDataHandler, 'getCoppa'); }); afterEach(function() { @@ -452,6 +452,6 @@ describe('LiveIntentId', function() { it('should not decode a idcookie as sharedId if it exists and coppa is true', function() { coppaConsentDataStub.returns(true) const result = liveIntentIdSubmodule.decode({nonId: 'foo', idcookie: 'bar'}) - expect(result).to.eql({'lipb': {'lipbid': 'foo', 'nonId': 'foo', 'pubcid': 'bar'}, 'pubcid': {'id': 'bar', 'ext': {'provider': 'liveintent.com'}}}) + expect(result).to.eql({'lipb': {'lipbid': 'foo', 'nonId': 'foo'}}) }); }) From 9700ce357c8faae626606a2ec165d252dc61f957 Mon Sep 17 00:00:00 2001 From: Peixun Zhang Date: Fri, 9 Feb 2024 16:09:26 +0100 Subject: [PATCH 11/19] add example --- modules/userId/eids.md | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/modules/userId/eids.md b/modules/userId/eids.md index c8d27cc9d52..8352a0bc55c 100644 --- a/modules/userId/eids.md +++ b/modules/userId/eids.md @@ -106,7 +106,7 @@ userIdAsEids = [ segments: ['s1', 's2'] } }, - + { source: 'bidswitch.net', uids: [{ @@ -117,7 +117,7 @@ userIdAsEids = [ } }] }, - + { source: 'liveintent.indexexchange.com', uids: [{ @@ -160,7 +160,7 @@ userIdAsEids = [ provider: 'liveintent.com' } }] - }, + }, { source: 'media.net', @@ -184,6 +184,17 @@ userIdAsEids = [ }] }, + { + source: 'pubcid.org', + uids: [{ + id: 'some-random-id-value', + atype: 1, + ext: { + provider: 'liveintent.com' + } + }] + }, + { source: 'merkleinc.com', uids: [{ From cc0a587bd9452ae1b6f9fd34e1fd68af329922a4 Mon Sep 17 00:00:00 2001 From: Peixun Zhang Date: Fri, 9 Feb 2024 17:27:12 +0100 Subject: [PATCH 12/19] lc version --- package-lock.json | 14 +++++++------- package.json | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/package-lock.json b/package-lock.json index 9faa175887d..ac5ac66fd0c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -22,7 +22,7 @@ "express": "^4.15.4", "fun-hooks": "^0.9.9", "just-clone": "^1.0.2", - "live-connect-js": "^6.5.0" + "live-connect-js": "^6.6.0" }, "devDependencies": { "@babel/eslint-parser": "^7.16.5", @@ -19705,9 +19705,9 @@ } }, "node_modules/live-connect-js": { - "version": "6.5.0", - "resolved": "https://registry.npmjs.org/live-connect-js/-/live-connect-js-6.5.0.tgz", - "integrity": "sha512-gZOKtGjPjTf6JuUtA6OZgg8w/uEP2lEtlAKWSox+rTiTRmD4U6o28MB9WEgSJWlZWwUwmWu9dL8ByxBFbsWZyg==", + "version": "6.6.0", + "resolved": "https://registry.npmjs.org/live-connect-js/-/live-connect-js-6.6.0.tgz", + "integrity": "sha512-007CQoS/ebr0iv1Bvj1D9YK5nOkQG6GJXBHnHtT2CRAwFs7Da+wequFnfpZ5I9TwhzCwZ+oPuInRp7qaSwfVvQ==", "dependencies": { "live-connect-common": "^v3.1.1", "tiny-hashes": "1.0.1" @@ -44253,9 +44253,9 @@ "integrity": "sha512-sV0oUvJnaTN41f30hOo3wDjZL2y8TYu5BQKvlxmek7Agpe2AGGN/dsPA8i2sHkessRKpcTfrPjmpnG2bIxq7Gg==" }, "live-connect-js": { - "version": "6.5.0", - "resolved": "https://registry.npmjs.org/live-connect-js/-/live-connect-js-6.5.0.tgz", - "integrity": "sha512-gZOKtGjPjTf6JuUtA6OZgg8w/uEP2lEtlAKWSox+rTiTRmD4U6o28MB9WEgSJWlZWwUwmWu9dL8ByxBFbsWZyg==", + "version": "6.6.0", + "resolved": "https://registry.npmjs.org/live-connect-js/-/live-connect-js-6.6.0.tgz", + "integrity": "sha512-007CQoS/ebr0iv1Bvj1D9YK5nOkQG6GJXBHnHtT2CRAwFs7Da+wequFnfpZ5I9TwhzCwZ+oPuInRp7qaSwfVvQ==", "requires": { "live-connect-common": "^v3.1.1", "tiny-hashes": "1.0.1" diff --git a/package.json b/package.json index 1e3086ca5fb..3ba8473b681 100644 --- a/package.json +++ b/package.json @@ -133,7 +133,7 @@ "express": "^4.15.4", "fun-hooks": "^0.9.9", "just-clone": "^1.0.2", - "live-connect-js": "^6.5.0" + "live-connect-js": "^6.6.0" }, "optionalDependencies": { "fsevents": "^2.3.2" From 8f038276e8071455aaa09106fad380a42269cc77 Mon Sep 17 00:00:00 2001 From: 3link <34981284+3link@users.noreply.github.com> Date: Mon, 12 Feb 2024 13:14:32 +0100 Subject: [PATCH 13/19] Use PUBCID EIDS recipe --- libraries/pubcidEids/pubcidEids.js | 6 +++--- modules/liveIntentIdSystem.js | 2 ++ modules/sharedIdSystem.js | 6 ++---- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/libraries/pubcidEids/pubcidEids.js b/libraries/pubcidEids/pubcidEids.js index ceb238f37c7..72eb60009d1 100644 --- a/libraries/pubcidEids/pubcidEids.js +++ b/libraries/pubcidEids/pubcidEids.js @@ -4,9 +4,9 @@ export const PUBCID_EIDS = { atype: 1, getValue: function(data) { if (data.id) { - return data.id + return data.id; } else { - return data + return data; } }, getUidExt: function(data) { @@ -15,4 +15,4 @@ export const PUBCID_EIDS = { } } } -} +}; diff --git a/modules/liveIntentIdSystem.js b/modules/liveIntentIdSystem.js index becbcf1bd07..0d012497cf1 100644 --- a/modules/liveIntentIdSystem.js +++ b/modules/liveIntentIdSystem.js @@ -12,6 +12,7 @@ import { gdprDataHandler, uspDataHandler, gppDataHandler } from '../src/adapterM import {getStorageManager} from '../src/storageManager.js'; import {MODULE_TYPE_UID} from '../src/activities/modules.js'; import {UID2_EIDS} from '../libraries/uid2Eids/uid2Eids.js'; +import {PUBCID_EIDS} from '../libraries/pubcidEids/pubcidEids.js'; /** * @typedef {import('../modules/userId/index.js').Submodule} Submodule @@ -297,6 +298,7 @@ export const liveIntentIdSubmodule = { }, eids: { ...UID2_EIDS, + ...PUBCID_EIDS, 'lipb': { getValue: function(data) { return data.lipbid; diff --git a/modules/sharedIdSystem.js b/modules/sharedIdSystem.js index fa8b5e3bfdb..05793fbc519 100644 --- a/modules/sharedIdSystem.js +++ b/modules/sharedIdSystem.js @@ -12,6 +12,7 @@ import {getStorageManager} from '../src/storageManager.js'; import {VENDORLESS_GVLID} from '../src/consentHandler.js'; import {MODULE_TYPE_UID} from '../src/activities/modules.js'; import {domainOverrideToRootDomain} from '../libraries/domainOverrideToRootDomain/index.js'; +import {PUBCID_EIDS} from '../libraries/pubcidEids/pubcidEids.js'; /** * @typedef {import('../modules/userId/index.js').Submodule} Submodule @@ -183,10 +184,7 @@ export const sharedIdSystemSubmodule = { domainOverride: domainOverrideToRootDomain(storage, 'sharedId'), eids: { - 'pubcid': { - source: 'pubcid.org', - atype: 1 - }, + ...PUBCID_EIDS } }; From 361781172ddbe2da72028ab973d1fed18c93b956 Mon Sep 17 00:00:00 2001 From: 3link <34981284+3link@users.noreply.github.com> Date: Mon, 12 Feb 2024 13:39:08 +0100 Subject: [PATCH 14/19] Add semicolons --- modules/liveIntentIdSystem.js | 85 +++++++++++++++++------------------ 1 file changed, 42 insertions(+), 43 deletions(-) diff --git a/modules/liveIntentIdSystem.js b/modules/liveIntentIdSystem.js index 0d012497cf1..181726eb96a 100644 --- a/modules/liveIntentIdSystem.js +++ b/modules/liveIntentIdSystem.js @@ -8,11 +8,11 @@ import { triggerPixel, logError } from '../src/utils.js'; import { ajaxBuilder } from '../src/ajax.js'; import { submodule } from '../src/hook.js'; import { LiveConnect } from 'live-connect-js'; // eslint-disable-line prebid/validate-imports -import { gdprDataHandler, uspDataHandler, gppDataHandler } from '../src/adapterManager.js'; -import {getStorageManager} from '../src/storageManager.js'; -import {MODULE_TYPE_UID} from '../src/activities/modules.js'; -import {UID2_EIDS} from '../libraries/uid2Eids/uid2Eids.js'; -import {PUBCID_EIDS} from '../libraries/pubcidEids/pubcidEids.js'; +import { gdprDataHandler, uspDataHandler, gppDataHandler, coppaDataHandler } from '../src/adapterManager.js'; +import { getStorageManager } from '../src/storageManager.js'; +import { MODULE_TYPE_UID } from '../src/activities/modules.js'; +import { UID2_EIDS } from '../libraries/uid2Eids/uid2Eids.js'; +import { PUBCID_EIDS } from '../libraries/pubcidEids/pubcidEids.js'; /** * @typedef {import('../modules/userId/index.js').Submodule} Submodule @@ -20,12 +20,12 @@ import {PUBCID_EIDS} from '../libraries/pubcidEids/pubcidEids.js'; * @typedef {import('../modules/userId/index.js').IdResponse} IdResponse */ -const DEFAULT_AJAX_TIMEOUT = 5000 -const EVENTS_TOPIC = 'pre_lips' +const DEFAULT_AJAX_TIMEOUT = 5000; +const EVENTS_TOPIC = 'pre_lips'; const MODULE_NAME = 'liveIntentId'; const LI_PROVIDER_DOMAIN = 'liveintent.com'; export const storage = getStorageManager({moduleType: MODULE_TYPE_UID, moduleName: MODULE_NAME}); -const defaultRequestedAttributes = {'nonId': true} +const defaultRequestedAttributes = {'nonId': true}; const calls = { ajaxGet: (url, onSuccess, onError, timeout) => { ajaxBuilder(timeout)( @@ -52,10 +52,10 @@ let liveConnect = null; */ export function reset() { if (window && window.liQ_instances) { - window.liQ_instances.forEach(i => i.eventBus.off(EVENTS_TOPIC, setEventFiredFlag)) + window.liQ_instances.forEach(i => i.eventBus.off(EVENTS_TOPIC, setEventFiredFlag)); window.liQ_instances = []; } - liveIntentIdSubmodule.setModuleMode(null) + liveIntentIdSubmodule.setModuleMode(null); eventFired = false; liveConnect = null; } @@ -69,7 +69,7 @@ export function setEventFiredFlag() { function parseLiveIntentCollectorConfig(collectConfig) { const config = {}; - collectConfig = collectConfig || {} + collectConfig = collectConfig || {}; collectConfig.appId && (config.appId = collectConfig.appId); collectConfig.fpiStorageStrategy && (config.storageStrategy = collectConfig.fpiStorageStrategy); collectConfig.fpiExpirationDays && (config.expirationDays = collectConfig.fpiExpirationDays); @@ -87,16 +87,16 @@ function parseLiveIntentCollectorConfig(collectConfig) { function parseRequestedAttributes(overrides) { function renameAttribute(attribute) { if (attribute === 'sharedId') { - return 'idcookie' + return 'idcookie'; } else { - return attribute - } + return attribute; + }; } function createParameterArray(config) { return Object.entries(config).flatMap(([k, v]) => (typeof v === 'boolean' && v) ? [renameAttribute(k)] : []); } if (typeof overrides === 'object') { - return createParameterArray({...defaultRequestedAttributes, ...overrides}) + return createParameterArray({...defaultRequestedAttributes, ...overrides}); } else { return createParameterArray(defaultRequestedAttributes); } @@ -108,7 +108,7 @@ function initializeLiveConnect(configParams) { } configParams = configParams || {}; - const sharedIdConfig = configParams.sharedId || {} + const sharedIdConfig = configParams.sharedId || {}; const publisherId = configParams.publisherId || 'any'; const identityResolutionConfig = { @@ -127,7 +127,7 @@ function initializeLiveConnect(configParams) { liveConnectConfig.distributorId = configParams.distributorId; identityResolutionConfig.source = configParams.distributorId; } else { - identityResolutionConfig.source = configParams.partner || 'prebid' + identityResolutionConfig.source = configParams.partner || 'prebid'; } liveConnectConfig.wrapperName = 'prebid'; @@ -140,11 +140,11 @@ function initializeLiveConnect(configParams) { liveConnectConfig.idCookie.name = sharedIdConfig.name; liveConnectConfig.idCookie.strategy = sharedIdConfig.strategy; - const usPrivacyString = uspDataHandler.getConsentData() + const usPrivacyString = uspDataHandler.getConsentData(); if (usPrivacyString) { liveConnectConfig.usPrivacyString = usPrivacyString; } - const gdprConsent = gdprDataHandler.getConsentData() + const gdprConsent = gdprDataHandler.getConsentData(); if (gdprConsent) { liveConnectConfig.gdprApplies = gdprConsent.gdprApplies; liveConnectConfig.gdprConsent = gdprConsent.consentString; @@ -158,21 +158,21 @@ function initializeLiveConnect(configParams) { // The third param is the ajax and pixel object, the ajax and pixel use PBJS liveConnect = liveIntentIdSubmodule.getInitializer()(liveConnectConfig, storage, calls); if (configParams.emailHash) { - liveConnect.push({ hash: configParams.emailHash }) + liveConnect.push({ hash: configParams.emailHash }); } return liveConnect; } function tryFireEvent() { if (!eventFired && liveConnect) { - const eventDelay = liveConnect.config.fireEventDelay || 500 + const eventDelay = liveConnect.config.fireEventDelay || 500; setTimeout(() => { - const instances = window.liQ_instances - instances.forEach(i => i.eventBus.once(EVENTS_TOPIC, setEventFiredFlag)) + const instances = window.liQ_instances; + instances.forEach(i => i.eventBus.once(EVENTS_TOPIC, setEventFiredFlag)); if (!eventFired && liveConnect) { liveConnect.fire(); } - }, eventDelay) + }, eventDelay); } } @@ -186,10 +186,10 @@ export const liveIntentIdSubmodule = { name: MODULE_NAME, setModuleMode(mode) { - this.moduleMode = mode + this.moduleMode = mode; }, getInitializer() { - return (liveConnectConfig, storage, calls) => LiveConnect(liveConnectConfig, storage, calls, this.moduleMode) + return (liveConnectConfig, storage, calls) => LiveConnect(liveConnectConfig, storage, calls, this.moduleMode); }, /** @@ -207,58 +207,57 @@ export const liveIntentIdSubmodule = { const result = {}; // old versions stored lipbid in unifiedId. Ensure that we can still read the data. - const lipbid = value.nonId || value.unifiedId + const lipbid = value.nonId || value.unifiedId; if (lipbid) { - const lipb = { ...value, lipbid } - delete lipb.unifiedId - - result.lipb = lipb + const lipb = { ...value, lipbid }; + delete lipb.unifiedId; + result.lipb = lipb; } // Lift usage of uid2 by exposing uid2 if we were asked to resolve it. // As adapters are applied in lexicographical order, we will always // be overwritten by the 'proper' uid2 module if it is present. if (value.uid2) { - result.uid2 = { 'id': value.uid2, ext: { provider: LI_PROVIDER_DOMAIN } } + result.uid2 = { 'id': value.uid2, ext: { provider: LI_PROVIDER_DOMAIN } }; } if (value.bidswitch) { - result.bidswitch = { 'id': value.bidswitch, ext: { provider: LI_PROVIDER_DOMAIN } } + result.bidswitch = { 'id': value.bidswitch, ext: { provider: LI_PROVIDER_DOMAIN } }; } if (value.medianet) { - result.medianet = { 'id': value.medianet, ext: { provider: LI_PROVIDER_DOMAIN } } + result.medianet = { 'id': value.medianet, ext: { provider: LI_PROVIDER_DOMAIN } }; } if (value.magnite) { - result.magnite = { 'id': value.magnite, ext: { provider: LI_PROVIDER_DOMAIN } } + result.magnite = { 'id': value.magnite, ext: { provider: LI_PROVIDER_DOMAIN } }; } if (value.index) { - result.index = { 'id': value.index, ext: { provider: LI_PROVIDER_DOMAIN } } + result.index = { 'id': value.index, ext: { provider: LI_PROVIDER_DOMAIN } }; } if (value.openx) { - result.openx = { 'id': value.openx, ext: { provider: LI_PROVIDER_DOMAIN } } + result.openx = { 'id': value.openx, ext: { provider: LI_PROVIDER_DOMAIN } }; } if (value.pubmatic) { - result.pubmatic = { 'id': value.pubmatic, ext: { provider: LI_PROVIDER_DOMAIN } } + result.pubmatic = { 'id': value.pubmatic, ext: { provider: LI_PROVIDER_DOMAIN } }; } if (value.sovrn) { - result.sovrn = { 'id': value.sovrn, ext: { provider: LI_PROVIDER_DOMAIN } } + result.sovrn = { 'id': value.sovrn, ext: { provider: LI_PROVIDER_DOMAIN } }; } if (value.idcookie) { if (!coppaDataHandler.getCoppa()) { - result.lipb = { ...result.lipb, pubcid: value.idcookie } - result.pubcid = { 'id': value.idcookie, ext: { provider: LI_PROVIDER_DOMAIN } } + result.lipb = { ...result.lipb, pubcid: value.idcookie }; + result.pubcid = { 'id': value.idcookie, ext: { provider: LI_PROVIDER_DOMAIN } }; } - delete result.lipb.idcookie + delete result.lipb.idcookie; } - return result + return result; } if (!liveConnect) { From 7a202640f94d1736be4c1a2026fe9f843cfc1ae6 Mon Sep 17 00:00:00 2001 From: Peixun Zhang Date: Tue, 13 Feb 2024 11:12:30 +0100 Subject: [PATCH 15/19] add test for shared id --- package-lock.json | 2 +- test/spec/modules/liveIntentIdSystem_spec.js | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/package-lock.json b/package-lock.json index ac5ac66fd0c..7bab0bd7611 100644 --- a/package-lock.json +++ b/package-lock.json @@ -6,7 +6,7 @@ "packages": { "": { "name": "prebid.js", - "version": "8.35.0-pre", + "version": "8.37.0-pre", "license": "Apache-2.0", "dependencies": { "@babel/core": "^7.16.7", diff --git a/test/spec/modules/liveIntentIdSystem_spec.js b/test/spec/modules/liveIntentIdSystem_spec.js index 363f2bb7b9b..7b9a7761639 100644 --- a/test/spec/modules/liveIntentIdSystem_spec.js +++ b/test/spec/modules/liveIntentIdSystem_spec.js @@ -454,4 +454,13 @@ describe('LiveIntentId', function() { const result = liveIntentIdSubmodule.decode({nonId: 'foo', idcookie: 'bar'}) expect(result).to.eql({'lipb': {'lipbid': 'foo', 'nonId': 'foo'}}) }); + + it('should translate sharedId to idcookie when creating requestedAttributes', function() { + let callBackSpy = sinon.spy(); + let submoduleCallback = liveIntentIdSubmodule.getId({ params: + { requestedAttributesOverrides: { 'sharedId': true } } + }).callback; + submoduleCallback(callBackSpy); + expect({'idcookie': true}); + }); }) From 40d0be51abbd9d8df93fa823367b27b08d7ce862 Mon Sep 17 00:00:00 2001 From: Peixun Zhang Date: Tue, 13 Feb 2024 15:40:09 +0100 Subject: [PATCH 16/19] fix test --- modules/liveIntentIdSystem.js | 10 ++--- test/spec/modules/liveIntentIdSystem_spec.js | 44 +++++++++++++++----- 2 files changed, 38 insertions(+), 16 deletions(-) diff --git a/modules/liveIntentIdSystem.js b/modules/liveIntentIdSystem.js index 181726eb96a..dc93d78a9a8 100644 --- a/modules/liveIntentIdSystem.js +++ b/modules/liveIntentIdSystem.js @@ -87,7 +87,7 @@ function parseLiveIntentCollectorConfig(collectConfig) { function parseRequestedAttributes(overrides) { function renameAttribute(attribute) { if (attribute === 'sharedId') { - return 'idcookie'; + return 'idCookie'; } else { return attribute; }; @@ -249,12 +249,12 @@ export const liveIntentIdSubmodule = { result.sovrn = { 'id': value.sovrn, ext: { provider: LI_PROVIDER_DOMAIN } }; } - if (value.idcookie) { + if (value.idCookie) { if (!coppaDataHandler.getCoppa()) { - result.lipb = { ...result.lipb, pubcid: value.idcookie }; - result.pubcid = { 'id': value.idcookie, ext: { provider: LI_PROVIDER_DOMAIN } }; + result.lipb = { ...result.lipb, pubcid: value.idCookie }; + result.pubcid = { 'id': value.idCookie, ext: { provider: LI_PROVIDER_DOMAIN } }; } - delete result.lipb.idcookie; + delete result.lipb.idCookie; } return result; diff --git a/test/spec/modules/liveIntentIdSystem_spec.js b/test/spec/modules/liveIntentIdSystem_spec.js index 7b9a7761639..72ff1618579 100644 --- a/test/spec/modules/liveIntentIdSystem_spec.js +++ b/test/spec/modules/liveIntentIdSystem_spec.js @@ -443,24 +443,46 @@ describe('LiveIntentId', function() { expect(callBackSpy.calledOnce).to.be.true; }); - it('should decode a idcookie as sharedId if it exists and coppa is false', function() { + it('should decode a idCookie as sharedId if it exists and coppa is false', function() { coppaConsentDataStub.returns(false) - const result = liveIntentIdSubmodule.decode({nonId: 'foo', idcookie: 'bar'}) + const result = liveIntentIdSubmodule.decode({nonId: 'foo', idCookie: 'bar'}) expect(result).to.eql({'lipb': {'lipbid': 'foo', 'nonId': 'foo', 'pubcid': 'bar'}, 'pubcid': {'id': 'bar', 'ext': {'provider': 'liveintent.com'}}}) }); - it('should not decode a idcookie as sharedId if it exists and coppa is true', function() { + it('should not decode a idCookie as sharedId if it exists and coppa is true', function() { coppaConsentDataStub.returns(true) - const result = liveIntentIdSubmodule.decode({nonId: 'foo', idcookie: 'bar'}) + const result = liveIntentIdSubmodule.decode({nonId: 'foo', idCookie: 'bar'}) expect(result).to.eql({'lipb': {'lipbid': 'foo', 'nonId': 'foo'}}) }); - it('should translate sharedId to idcookie when creating requestedAttributes', function() { - let callBackSpy = sinon.spy(); - let submoduleCallback = liveIntentIdSubmodule.getId({ params: - { requestedAttributesOverrides: { 'sharedId': true } } - }).callback; - submoduleCallback(callBackSpy); - expect({'idcookie': true}); + it('should parse sharedId to idCookie', async function() { + const expectedValue = 'someValue' + const cookieName = 'testcookie' + getCookieStub.withArgs(cookieName).returns(expectedValue) + const config = { params: { + ...defaultConfigParams.params, + sharedId: { 'strategy': 'cookie', 'name': cookieName }, + requestedAttributesOverrides: { 'sharedId': true } } + } + const submoduleCallback = liveIntentIdSubmodule.getId(config).callback; + const decodedResult = new Promise(resolve => { + submoduleCallback((x) => resolve(liveIntentIdSubmodule.decode(x, config))); + }); + const request = server.requests[0]; + expect(request.url).to.be.eq(`https://idx.liadm.com/idex/prebid/89899?cd=.localhost&ic=someValue&resolve=nonId`); + request.respond( + 200, + responseHeader, + JSON.stringify({}) + ); + + const result = await decodedResult + expect(result).to.be.eql({ + lipb: { 'pubcid': expectedValue }, + pubcid: { + ext: { 'provider': 'liveintent.com' }, + id: expectedValue + } + }); }); }) From cdb45ce204a602114fb720744ac20f0456eb1444 Mon Sep 17 00:00:00 2001 From: Peixun Zhang Date: Tue, 13 Feb 2024 16:55:41 +0100 Subject: [PATCH 17/19] correct name --- test/spec/modules/liveIntentIdSystem_spec.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/spec/modules/liveIntentIdSystem_spec.js b/test/spec/modules/liveIntentIdSystem_spec.js index 72ff1618579..1c49fc7cf29 100644 --- a/test/spec/modules/liveIntentIdSystem_spec.js +++ b/test/spec/modules/liveIntentIdSystem_spec.js @@ -42,7 +42,7 @@ describe('LiveIntentId', function() { resetLiveIntentIdSubmodule(); }); - it('should initialize LiveConnect with a privacy string when getId, and include it in the resolution request', function () { + it('should initialize LiveConnect with a privacy string when getId but not send request', function () { uspConsentDataStub.returns('1YNY'); gdprConsentDataStub.returns({ gdprApplies: true, @@ -455,7 +455,7 @@ describe('LiveIntentId', function() { expect(result).to.eql({'lipb': {'lipbid': 'foo', 'nonId': 'foo'}}) }); - it('should parse sharedId to idCookie', async function() { + it('should parse sharedId to pubcid', async function() { const expectedValue = 'someValue' const cookieName = 'testcookie' getCookieStub.withArgs(cookieName).returns(expectedValue) From c17b11c5c725a432174b035dce76cf2d39b90ec9 Mon Sep 17 00:00:00 2001 From: Peixun Zhang Date: Tue, 13 Feb 2024 17:55:18 +0100 Subject: [PATCH 18/19] tests --- test/spec/modules/liveIntentIdSystem_spec.js | 69 ++++++++------------ 1 file changed, 29 insertions(+), 40 deletions(-) diff --git a/test/spec/modules/liveIntentIdSystem_spec.js b/test/spec/modules/liveIntentIdSystem_spec.js index 1c49fc7cf29..1c62baa70d8 100644 --- a/test/spec/modules/liveIntentIdSystem_spec.js +++ b/test/spec/modules/liveIntentIdSystem_spec.js @@ -5,7 +5,7 @@ import { server } from 'test/mocks/xhr.js'; resetLiveIntentIdSubmodule(); liveIntentIdSubmodule.setModuleMode('standard') const PUBLISHER_ID = '89899'; -const defaultConfigParams = { params: {publisherId: PUBLISHER_ID, fireEventDelay: 1} }; +const defaultConfigParams = {publisherId: PUBLISHER_ID, fireEventDelay: 1}; const responseHeader = {'Content-Type': 'application/json'} describe('LiveIntentId', function() { @@ -53,35 +53,26 @@ describe('LiveIntentId', function() { applicableSections: [1, 2] }) let callBackSpy = sinon.spy(); - let submoduleCallback = liveIntentIdSubmodule.getId(defaultConfigParams).callback; + let submoduleCallback = liveIntentIdSubmodule.getId({ params: defaultConfigParams }).callback; submoduleCallback(callBackSpy); - let request = server.requests[0]; - expect(request.url).to.match(/.*us_privacy=1YNY.*&gdpr=1&n3pc=1&gdpr_consent=consentDataString.*&gpp_s=gppConsentDataString&gpp_as=1%2C2.*/); - const response = { - unifiedId: 'a_unified_id', - segments: [123, 234] - } - request.respond( - 200, - responseHeader, - JSON.stringify(response) - ); - expect(callBackSpy.calledOnceWith(response)).to.be.true; + expect(server.requests).to.be.empty; + expect(callBackSpy.notCalled).to.be.true; }); - it('should fire an event when getId', function(done) { + it('should fire an event without privacy setting when getId', function(done) { uspConsentDataStub.returns('1YNY'); gdprConsentDataStub.returns({ - gdprApplies: true, + gdprApplies: false, consentString: 'consentDataString' }) gppConsentDataStub.returns({ gppString: 'gppConsentDataString', applicableSections: [1] }) - liveIntentIdSubmodule.getId(defaultConfigParams); + liveIntentIdSubmodule.getId({ params: defaultConfigParams }); setTimeout(() => { - expect(server.requests[0].url).to.match(/https:\/\/rp.liadm.com\/j\?.*&us_privacy=1YNY.*&wpn=prebid.*&gdpr=1&n3pc=1&n3pct=1&nb=1&gdpr_consent=consentDataString&gpp_s=gppConsentDataString&gpp_as=1.*/); + console.log(server.requests[0].url) + expect(server.requests[0].url).to.match(/https:\/\/rp.liadm.com\/j\?.*&us_privacy=1YNY.*&wpn=prebid.*&gdpr=0&gdpr_consent=consentDataString&gpp_s=gppConsentDataString&gpp_as=1.*/); done(); }, 200); }); @@ -98,9 +89,7 @@ describe('LiveIntentId', function() { }); it('should initialize LiveConnect and forward the prebid version when decode and emit an event', function(done) { - liveIntentIdSubmodule.decode({}, { params: { - ...defaultConfigParams - }}); + liveIntentIdSubmodule.decode({}, { params: defaultConfigParams }); setTimeout(() => { expect(server.requests[0].url).to.contain('tv=$prebid.version$') done(); @@ -109,7 +98,7 @@ describe('LiveIntentId', function() { it('should initialize LiveConnect with the config params when decode and emit an event', function (done) { liveIntentIdSubmodule.decode({}, { params: { - ...defaultConfigParams.params, + ...defaultConfigParams, ...{ url: 'https://dummy.liveintent.com', liCollectConfig: { @@ -151,7 +140,7 @@ describe('LiveIntentId', function() { gppString: 'gppConsentDataString', applicableSections: [1] }) - liveIntentIdSubmodule.decode({}, defaultConfigParams); + liveIntentIdSubmodule.decode({}, { params: defaultConfigParams }); setTimeout(() => { expect(server.requests[0].url).to.match(/.*us_privacy=1YNY.*&gdpr=0&gdpr_consent=consentDataString.*&gpp_s=gppConsentDataString&gpp_as=1.*/); done(); @@ -160,7 +149,7 @@ describe('LiveIntentId', function() { it('should fire an event when decode and a hash is provided', function(done) { liveIntentIdSubmodule.decode({}, { params: { - ...defaultConfigParams.params, + ...defaultConfigParams, emailHash: '58131bc547fb87af94cebdaf3102321f' }}); setTimeout(() => { @@ -175,7 +164,7 @@ describe('LiveIntentId', function() { }); it('should fire an event when decode', function(done) { - liveIntentIdSubmodule.decode({}, defaultConfigParams); + liveIntentIdSubmodule.decode({}, { params: defaultConfigParams }); setTimeout(() => { expect(server.requests[0].url).to.be.not.null done(); @@ -183,10 +172,10 @@ describe('LiveIntentId', function() { }); it('should initialize LiveConnect and send data only once', function(done) { - liveIntentIdSubmodule.getId(defaultConfigParams); - liveIntentIdSubmodule.decode({}, defaultConfigParams); - liveIntentIdSubmodule.getId(defaultConfigParams); - liveIntentIdSubmodule.decode({}, defaultConfigParams); + liveIntentIdSubmodule.getId({ params: defaultConfigParams }); + liveIntentIdSubmodule.decode({}, { params: defaultConfigParams }); + liveIntentIdSubmodule.getId({ params: defaultConfigParams }); + liveIntentIdSubmodule.decode({}, { params: defaultConfigParams }); setTimeout(() => { expect(server.requests.length).to.be.eq(1); done(); @@ -196,7 +185,7 @@ describe('LiveIntentId', function() { it('should call the custom URL of the LiveIntent Identity Exchange endpoint', function() { getCookieStub.returns(null); let callBackSpy = sinon.spy(); - let submoduleCallback = liveIntentIdSubmodule.getId({ params: {...defaultConfigParams.params, ...{'url': 'https://dummy.liveintent.com/idex'}} }).callback; + let submoduleCallback = liveIntentIdSubmodule.getId({ params: {...defaultConfigParams, ...{'url': 'https://dummy.liveintent.com/idex'}} }).callback; submoduleCallback(callBackSpy); let request = server.requests[0]; expect(request.url).to.be.eq('https://dummy.liveintent.com/idex/prebid/89899?cd=.localhost&resolve=nonId'); @@ -239,7 +228,7 @@ describe('LiveIntentId', function() { getCookieStub.returns(null); let callBackSpy = sinon.spy(); let submoduleCallback = liveIntentIdSubmodule.getId({ params: { - ...defaultConfigParams.params, + ...defaultConfigParams, ...{ 'url': 'https://dummy.liveintent.com/idex', 'partner': 'rubicon' @@ -259,7 +248,7 @@ describe('LiveIntentId', function() { it('should call the LiveIntent Identity Exchange endpoint, with no additional query params', function() { getCookieStub.returns(null); let callBackSpy = sinon.spy(); - let submoduleCallback = liveIntentIdSubmodule.getId(defaultConfigParams).callback; + let submoduleCallback = liveIntentIdSubmodule.getId({ params: defaultConfigParams }).callback; submoduleCallback(callBackSpy); let request = server.requests[0]; expect(request.url).to.be.eq('https://idx.liadm.com/idex/prebid/89899?cd=.localhost&resolve=nonId'); @@ -274,7 +263,7 @@ describe('LiveIntentId', function() { it('should log an error and continue to callback if ajax request errors', function() { getCookieStub.returns(null); let callBackSpy = sinon.spy(); - let submoduleCallback = liveIntentIdSubmodule.getId(defaultConfigParams).callback; + let submoduleCallback = liveIntentIdSubmodule.getId({ params: defaultConfigParams }).callback; submoduleCallback(callBackSpy); let request = server.requests[0]; expect(request.url).to.be.eq('https://idx.liadm.com/idex/prebid/89899?cd=.localhost&resolve=nonId'); @@ -291,7 +280,7 @@ describe('LiveIntentId', function() { const oldCookie = 'a-xxxx--123e4567-e89b-12d3-a456-426655440000' getCookieStub.withArgs('_lc2_fpi').returns(oldCookie) let callBackSpy = sinon.spy(); - let submoduleCallback = liveIntentIdSubmodule.getId(defaultConfigParams).callback; + let submoduleCallback = liveIntentIdSubmodule.getId({ params: defaultConfigParams }).callback; submoduleCallback(callBackSpy); let request = server.requests[0]; expect(request.url).to.be.eq(`https://idx.liadm.com/idex/prebid/89899?duid=${oldCookie}&cd=.localhost&resolve=nonId`); @@ -308,7 +297,7 @@ describe('LiveIntentId', function() { getCookieStub.withArgs('_lc2_fpi').returns(oldCookie); getDataFromLocalStorageStub.withArgs('_thirdPC').returns('third-pc'); const configParams = { params: { - ...defaultConfigParams.params, + ...defaultConfigParams, ...{ 'identifiersToResolve': ['_thirdPC'] } @@ -330,7 +319,7 @@ describe('LiveIntentId', function() { getCookieStub.returns(null); getDataFromLocalStorageStub.withArgs('_thirdPC').returns({'key': 'value'}); const configParams = { params: { - ...defaultConfigParams.params, + ...defaultConfigParams, ...{ 'identifiersToResolve': ['_thirdPC'] } @@ -350,7 +339,7 @@ describe('LiveIntentId', function() { it('should send an error when the cookie jar throws an unexpected error', function() { getCookieStub.throws('CookieError', 'A message'); - liveIntentIdSubmodule.getId(defaultConfigParams); + liveIntentIdSubmodule.getId({ params: defaultConfigParams }); expect(imgStub.getCall(0).args[0]).to.match(/.*ae=.+/); }); @@ -367,7 +356,7 @@ describe('LiveIntentId', function() { it('should resolve extra attributes', function() { let callBackSpy = sinon.spy(); let submoduleCallback = liveIntentIdSubmodule.getId({ params: { - ...defaultConfigParams.params, + ...defaultConfigParams, ...{ requestedAttributesOverrides: { 'foo': true, 'bar': false } } } }).callback; submoduleCallback(callBackSpy); @@ -429,7 +418,7 @@ describe('LiveIntentId', function() { it('should allow disabling nonId resolution', function() { let callBackSpy = sinon.spy(); let submoduleCallback = liveIntentIdSubmodule.getId({ params: { - ...defaultConfigParams.params, + ...defaultConfigParams, ...{ requestedAttributesOverrides: { 'nonId': false, 'uid2': true } } } }).callback; submoduleCallback(callBackSpy); @@ -460,7 +449,7 @@ describe('LiveIntentId', function() { const cookieName = 'testcookie' getCookieStub.withArgs(cookieName).returns(expectedValue) const config = { params: { - ...defaultConfigParams.params, + ...defaultConfigParams, sharedId: { 'strategy': 'cookie', 'name': cookieName }, requestedAttributesOverrides: { 'sharedId': true } } } From f8f4038a257bd6b25c7e51afc65eba84a29f934d Mon Sep 17 00:00:00 2001 From: 3link <34981284+3link@users.noreply.github.com> Date: Tue, 20 Feb 2024 09:44:43 +0100 Subject: [PATCH 19/19] Use html5 instead of localStorage for consistency --- modules/liveIntentIdSystem.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/liveIntentIdSystem.js b/modules/liveIntentIdSystem.js index dc93d78a9a8..b9f6c6843e2 100644 --- a/modules/liveIntentIdSystem.js +++ b/modules/liveIntentIdSystem.js @@ -138,7 +138,7 @@ function initializeLiveConnect(configParams) { liveConnectConfig.idCookie = {}; liveConnectConfig.idCookie.name = sharedIdConfig.name; - liveConnectConfig.idCookie.strategy = sharedIdConfig.strategy; + liveConnectConfig.idCookie.strategy = sharedIdConfig.strategy == 'html5' ? 'localStorage' : sharedIdConfig.strategy; const usPrivacyString = uspDataHandler.getConsentData(); if (usPrivacyString) {