diff --git a/integrationExamples/gpt/userId_example.html b/integrationExamples/gpt/userId_example.html index 7886e5b13ca..53c58e8e87e 100644 --- a/integrationExamples/gpt/userId_example.html +++ b/integrationExamples/gpt/userId_example.html @@ -189,6 +189,16 @@ name: "sharedid", expires: 28 } + }, { + name: "liveIntentId", + params: { + publisherId: "9896876" + }, + storage: { + type: "cookie", + name: "_li_pbid", + expires: 28 + } }], syncDelay: 5000, auctionDelay: 1000 diff --git a/modules/liveIntentIdSystem.js b/modules/liveIntentIdSystem.js index b0e8cfc1c0f..bd2638e5936 100644 --- a/modules/liveIntentIdSystem.js +++ b/modules/liveIntentIdSystem.js @@ -21,6 +21,9 @@ let liveConnect = null; * This function is used in tests */ export function reset() { + if (window && window.liQ) { + window.liQ = []; + } eventFired = false; liveConnect = null; } @@ -45,16 +48,12 @@ function parseLiveIntentCollectorConfig(collectConfig) { } function initializeLiveConnect(configParams) { + configParams = configParams || {}; if (liveConnect) { return liveConnect; } - const publisherId = configParams && configParams.publisherId; - if (!publisherId && typeof publisherId !== 'string') { - utils.logError(`${MODULE_NAME} - publisherId must be defined, not a '${publisherId}'`); - return; - } - + const publisherId = configParams.publisherId || 'any'; const identityResolutionConfig = { source: 'prebid', publisherId: publisherId @@ -65,20 +64,11 @@ function initializeLiveConnect(configParams) { if (configParams.partner) { identityResolutionConfig.source = configParams.partner } - if (configParams.storage && configParams.storage.expires) { - identityResolutionConfig.expirationDays = configParams.storage.expires; - } - if (configParams.ajaxTimeout) { - identityResolutionConfig.ajaxTimeout = configParams.ajaxTimeout; - } const liveConnectConfig = parseLiveIntentCollectorConfig(configParams.liCollectConfig); liveConnectConfig.wrapperName = 'prebid'; liveConnectConfig.identityResolutionConfig = identityResolutionConfig; liveConnectConfig.identifiersToResolve = configParams.identifiersToResolve || []; - if (configParams.providedIdentifierName) { - liveConnectConfig.providedIdentifierName = configParams.providedIdentifierName; - } const usPrivacyString = uspDataHandler.getConsentData(); if (usPrivacyString) { liveConnectConfig.usPrivacyString = usPrivacyString; @@ -120,10 +110,10 @@ export const liveIntentIdSubmodule = { return { 'lipb': { ...base, ...value } }; } - if (configParams) { + if (!liveConnect) { initializeLiveConnect(configParams); - tryFireEvent(); } + tryFireEvent(); return (value && typeof value['unifiedId'] === 'string') ? composeIdObject(value) : undefined; }, diff --git a/modules/userId/index.js b/modules/userId/index.js index a47565a53de..88a0a636caf 100644 --- a/modules/userId/index.js +++ b/modules/userId/index.js @@ -449,7 +449,7 @@ function initSubmodules(submodules, consentData) { if (storedId) { // cache decoded value (this is copied to every adUnit bid) - submodule.idObj = submodule.submodule.decode(storedId, submodule.config); + submodule.idObj = submodule.submodule.decode(storedId, submodule.config.params); } } else if (submodule.config.value) { // cache decoded value (this is copied to every adUnit bid) @@ -458,7 +458,7 @@ function initSubmodules(submodules, consentData) { const response = submodule.submodule.getId(submodule.config.params, consentData, undefined); if (utils.isPlainObject(response)) { if (typeof response.callback === 'function') { submodule.callback = response.callback; } - if (response.id) { submodule.idObj = submodule.submodule.decode(response.id, submodule.config); } + if (response.id) { submodule.idObj = submodule.submodule.decode(response.id, submodule.config.params); } } } carry.push(submodule); diff --git a/package-lock.json b/package-lock.json index 583d25d3459..2fc53a75352 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "prebid.js", - "version": "3.23.0-pre", + "version": "3.24.0-pre", "lockfileVersion": 1, "requires": true, "dependencies": { @@ -15211,15 +15211,14 @@ "dev": true }, "live-connect-js": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/live-connect-js/-/live-connect-js-1.1.1.tgz", - "integrity": "sha512-PsYiZ6R6ecBQgcg3BWvzGf2TNOqpNFK1lUyfYAUEZ+DPwPciKNRM3CQIDtytVvR9vsH7nhotMaU3bBgb7iuPfQ==", + "version": "1.1.10", + "resolved": "https://registry.npmjs.org/live-connect-js/-/live-connect-js-1.1.10.tgz", + "integrity": "sha512-G/LJKN3b21DZILCQRyataC/znLvJRyogtu7mAkKlkhP9B9UJ8bcOL7ihW/clD2PsT4hVUkeabHhUGsPCmhsjFw==", "requires": { "@kiosked/ulid": "^3.0.0", - "abab": "^2.0.2", + "abab": "^2.0.3", "browser-cookies": "^1.2.0", - "tiny-hashes": "1.0.1", - "tiny-uuid4": "^1.0.1" + "tiny-hashes": "1.0.1" } }, "livereload-js": { @@ -20779,11 +20778,6 @@ } } }, - "tiny-uuid4": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/tiny-uuid4/-/tiny-uuid4-1.0.1.tgz", - "integrity": "sha1-vUTp3V9fvRdo1tH78wIMiGobd2Y=" - }, "tmp": { "version": "0.0.33", "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.0.33.tgz", diff --git a/package.json b/package.json index c84e354bd1b..5f08b7356fa 100644 --- a/package.json +++ b/package.json @@ -112,6 +112,6 @@ "fun-hooks": "^0.9.9", "jsencrypt": "^3.0.0-rc.1", "just-clone": "^1.0.2", - "live-connect-js": "1.1.1" + "live-connect-js": "1.1.10" } } diff --git a/test/spec/modules/liveIntentIdSystem_spec.js b/test/spec/modules/liveIntentIdSystem_spec.js index 85e0d30b348..b19d38d5859 100644 --- a/test/spec/modules/liveIntentIdSystem_spec.js +++ b/test/spec/modules/liveIntentIdSystem_spec.js @@ -33,21 +33,6 @@ describe('LiveIntentId', function () { resetLiveIntentIdSubmodule(); }); - it('should log an error if no configParams were passed when getId', function () { - liveIntentIdSubmodule.getId(); - expect(logErrorStub.calledOnce).to.be.true; - }); - - it('should log an error if publisherId configParam was not passed when getId', function () { - liveIntentIdSubmodule.getId({}); - expect(logErrorStub.calledOnce).to.be.true; - }); - - it('should log an error if publisherId configParam was not passed when decode', function () { - liveIntentIdSubmodule.decode({}, {}); - expect(logErrorStub.calledOnce).to.be.true; - }); - it('should initialize LiveConnect with a us privacy string when getId, and include it in all requests', function () { consentDataStub.returns('1YNY'); let callBackSpy = sinon.spy();