From a95d622cabd2cf204fdc8466c83aeccb4e6cec52 Mon Sep 17 00:00:00 2001 From: Janko Ulaga Date: Mon, 2 Nov 2020 21:31:02 +0100 Subject: [PATCH 1/7] NT. Trying out how webpack plays with env vars --- package-lock.json | 17 +++++------------ package.json | 2 +- webpack.conf.js | 3 ++- 3 files changed, 8 insertions(+), 14 deletions(-) diff --git a/package-lock.json b/package-lock.json index bf95487ed9d..9cb3b86c7e1 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "prebid.js", - "version": "4.14.0-pre", + "version": "4.15.0-pre", "lockfileVersion": 1, "requires": true, "dependencies": { @@ -1920,11 +1920,6 @@ "schema-utils": "^2.7.0" } }, - "@kiosked/ulid": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/@kiosked/ulid/-/ulid-3.0.0.tgz", - "integrity": "sha512-ZKt2KIgGHDaGfKt6FjYvCpDvBXZRRoE8b+wDOlAV76aXKpq6ITiSUnPYevR4y55NKDnwCvwOrjWe+aVOCAK8kQ==" - }, "@sindresorhus/is": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/@sindresorhus/is/-/is-3.0.0.tgz", @@ -2771,7 +2766,8 @@ "abab": { "version": "2.0.3", "resolved": "https://registry.npmjs.org/abab/-/abab-2.0.3.tgz", - "integrity": "sha512-tsFzPpcttalNjFBCFMqsKYQcWxxen1pgJR56by//QwvJc4/OUS3kPOOttx2tSIfjsylB0pYu7f5D3K1RCxUnUg==" + "integrity": "sha512-tsFzPpcttalNjFBCFMqsKYQcWxxen1pgJR56by//QwvJc4/OUS3kPOOttx2tSIfjsylB0pYu7f5D3K1RCxUnUg==", + "dev": true }, "abbrev": { "version": "1.0.9", @@ -15727,12 +15723,9 @@ "dev": true }, "live-connect-js": { - "version": "1.1.23", - "resolved": "https://registry.npmjs.org/live-connect-js/-/live-connect-js-1.1.23.tgz", - "integrity": "sha512-alOXlYyDdMXt8zzCIs3+iCrdi6r/69c7YRN3sMETa3b2cCOxep3i9j2O0iepk2hxT5JxiR1MvqlqdWAL9d2Hcg==", + "version": "github:LiveIntent/live-connect#d183a7735cd9ec241900474443e9119d8da452c6", + "from": "github:LiveIntent/live-connect#NT-size-optimizations", "requires": { - "@kiosked/ulid": "^3.0.0", - "abab": "^2.0.3", "browser-cookies": "^1.2.0", "tiny-hashes": "1.0.1" } diff --git a/package.json b/package.json index c6c78a45c5c..25e5d4a1de5 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.23" + "live-connect-js": "LiveIntent/live-connect#NT-size-optimizations" } } diff --git a/webpack.conf.js b/webpack.conf.js index a5c75fa8a1a..6f0841757b0 100644 --- a/webpack.conf.js +++ b/webpack.conf.js @@ -13,7 +13,8 @@ var neverBundle = [ ]; var plugins = [ - new RequireEnsureWithoutJsonp() + new RequireEnsureWithoutJsonp(), + new webpack.EnvironmentPlugin(['LiveConnectMode']) ]; if (argv.analyze) { From bc3fac1587a25e6061031704eae48ef3d2b6f33e Mon Sep 17 00:00:00 2001 From: Janko Ulaga Date: Tue, 3 Nov 2020 15:22:41 +0100 Subject: [PATCH 2/7] NT. Test run before merge --- karma.conf.maker.js | 5 - .../modules/liveIntentIdMinimalSystem_spec.js | 259 ++++++++++++++++++ 2 files changed, 259 insertions(+), 5 deletions(-) create mode 100644 test/spec/modules/liveIntentIdMinimalSystem_spec.js diff --git a/karma.conf.maker.js b/karma.conf.maker.js index 8af216d6262..7c9928a263e 100644 --- a/karma.conf.maker.js +++ b/karma.conf.maker.js @@ -154,11 +154,6 @@ module.exports = function(codeCoverage, browserstack, watchMode, file) { reporters: ['mocha'], - mochaReporter: { - showDiff: true, - output: 'minimal' - }, - // Continuous Integration mode // if true, Karma captures browsers, runs the tests and exits singleRun: !watchMode, diff --git a/test/spec/modules/liveIntentIdMinimalSystem_spec.js b/test/spec/modules/liveIntentIdMinimalSystem_spec.js new file mode 100644 index 00000000000..559a8a6297e --- /dev/null +++ b/test/spec/modules/liveIntentIdMinimalSystem_spec.js @@ -0,0 +1,259 @@ +import { liveIntentIdSubmodule, reset as resetLiveIntentIdSubmodule, storage } from 'modules/liveIntentIdSystem.js'; +import * as utils from 'src/utils.js'; +import { gdprDataHandler, uspDataHandler } from '../../../src/adapterManager.js'; +import { server } from 'test/mocks/xhr.js'; + +const PUBLISHER_ID = '89899'; +const defaultConfigParams = { params: {publisherId: PUBLISHER_ID} }; +const responseHeader = {'Content-Type': 'application/json'} + +describe('LiveIntentId', function() { + let logErrorStub; + let uspConsentDataStub; + let gdprConsentDataStub; + let getCookieStub; + let getDataFromLocalStorageStub; + let imgStub; + + beforeEach(function() { + process.env.LiveConnectMode = 'minimal' + imgStub = sinon.stub(utils, 'triggerPixel'); + getCookieStub = sinon.stub(storage, 'getCookie'); + getDataFromLocalStorageStub = sinon.stub(storage, 'getDataFromLocalStorage'); + logErrorStub = sinon.stub(utils, 'logError'); + uspConsentDataStub = sinon.stub(uspDataHandler, 'getConsentData'); + gdprConsentDataStub = sinon.stub(gdprDataHandler, 'getConsentData'); + }); + + afterEach(function() { + process.env.LiveConnectMode = undefined + imgStub.restore(); + getCookieStub.restore(); + getDataFromLocalStorageStub.restore(); + logErrorStub.restore(); + uspConsentDataStub.restore(); + gdprConsentDataStub.restore(); + resetLiveIntentIdSubmodule(); + }); + + it('should initialize LiveConnect with a privacy string when getId, and include it in the resolution request', function() { + uspConsentDataStub.returns('1YNY'); + gdprConsentDataStub.returns({ + gdprApplies: true, + consentString: 'consentDataString' + }) + let callBackSpy = sinon.spy(); + let submoduleCallback = liveIntentIdSubmodule.getId(defaultConfigParams).callback; + submoduleCallback(callBackSpy); + let request = server.requests[1]; + expect(request.url).to.match(/.*us_privacy=1YNY.*&gdpr=1&gdpr_consent=consentDataString.*/); + request.respond( + 200, + responseHeader, + JSON.stringify({}) + ); + expect(callBackSpy.calledOnce).to.be.true; + }); + + it('should fire an event when getId', function() { + uspConsentDataStub.returns('1YNY'); + gdprConsentDataStub.returns({ + gdprApplies: true, + consentString: 'consentDataString' + }) + liveIntentIdSubmodule.getId(defaultConfigParams); + expect(server.requests[0].url).to.match(/https:\/\/rp.liadm.com\/j\?wpn=prebid.*us_privacy=1YNY.*&gdpr=1&gdpr_consent=consentDataString.*/); + }); + + it('should fire an event when getId and a hash is provided', function() { + liveIntentIdSubmodule.getId({ params: { + ...defaultConfigParams, + emailHash: '58131bc547fb87af94cebdaf3102321f' + }}); + expect(server.requests[0].url).to.match(/https:\/\/rp.liadm.com\/j\?.*e=58131bc547fb87af94cebdaf3102321f.+/) + }); + + it('should initialize LiveConnect with the config params when decode and emit an event', function () { + liveIntentIdSubmodule.decode({}, { params: { + ...defaultConfigParams.params, + ...{ + url: 'https://dummy.liveintent.com', + liCollectConfig: { + appId: 'a-0001', + collectorUrl: 'https://collector.liveintent.com' + } + } + }}); + expect(server.requests[0].url).to.match(/https:\/\/collector.liveintent.com\/j\?aid=a-0001&wpn=prebid.*/); + }); + + it('should initialize LiveConnect and emit an event with a privacy string when decode', function() { + uspConsentDataStub.returns('1YNY'); + gdprConsentDataStub.returns({ + gdprApplies: false, + consentString: 'consentDataString' + }) + liveIntentIdSubmodule.decode({}, defaultConfigParams); + expect(server.requests[0].url).to.match(/.*us_privacy=1YNY.*&gdpr=0&gdpr_consent=consentDataString.*/); + }); + + it('should fire an event when decode and a hash is provided', function() { + liveIntentIdSubmodule.decode({}, { params: { + ...defaultConfigParams.params, + emailHash: '58131bc547fb87af94cebdaf3102321f' + }}); + expect(server.requests[0].url).to.match(/https:\/\/rp.liadm.com\/j\?.*e=58131bc547fb87af94cebdaf3102321f.+/); + }); + + it('should not return a decoded identifier when the unifiedId is not present in the value', function() { + const result = liveIntentIdSubmodule.decode({ additionalData: 'data' }); + expect(result).to.be.undefined; + }); + + it('should fire an event when decode', function() { + liveIntentIdSubmodule.decode({}, defaultConfigParams); + expect(server.requests[0].url).to.be.not.null + }); + + it('should initialize LiveConnect and send data only once', function() { + liveIntentIdSubmodule.getId(defaultConfigParams); + liveIntentIdSubmodule.decode({}, defaultConfigParams); + liveIntentIdSubmodule.getId(defaultConfigParams); + liveIntentIdSubmodule.decode({}, defaultConfigParams); + expect(server.requests.length).to.be.eq(1); + }); + + 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; + submoduleCallback(callBackSpy); + let request = server.requests[1]; + expect(request.url).to.be.eq('https://dummy.liveintent.com/idex/prebid/89899'); + request.respond( + 200, + responseHeader, + JSON.stringify({}) + ); + expect(callBackSpy.calledOnce).to.be.true; + }); + + it('should call the default url of the LiveIntent Identity Exchange endpoint, with a partner', function() { + getCookieStub.returns(null); + let callBackSpy = sinon.spy(); + let submoduleCallback = liveIntentIdSubmodule.getId({ params: { + ...defaultConfigParams.params, + ...{ + 'url': 'https://dummy.liveintent.com/idex', + 'partner': 'rubicon' + } + } }).callback; + submoduleCallback(callBackSpy); + let request = server.requests[1]; + expect(request.url).to.be.eq('https://dummy.liveintent.com/idex/rubicon/89899'); + request.respond( + 200, + responseHeader, + JSON.stringify({}) + ); + expect(callBackSpy.calledOnce).to.be.true; + }); + + 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; + submoduleCallback(callBackSpy); + let request = server.requests[1]; + expect(request.url).to.be.eq('https://idx.liadm.com/idex/prebid/89899'); + request.respond( + 200, + responseHeader, + JSON.stringify({}) + ); + expect(callBackSpy.calledOnce).to.be.true; + }); + + 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; + submoduleCallback(callBackSpy); + let request = server.requests[1]; + expect(request.url).to.be.eq('https://idx.liadm.com/idex/prebid/89899'); + request.respond( + 503, + responseHeader, + 'Unavailable' + ); + expect(logErrorStub.calledOnce).to.be.true; + expect(callBackSpy.calledOnce).to.be.true; + }); + + it('should include the LiveConnect identifier when calling the LiveIntent Identity Exchange endpoint', function() { + const oldCookie = 'a-xxxx--123e4567-e89b-12d3-a456-426655440000' + getDataFromLocalStorageStub.withArgs('_li_duid').returns(oldCookie); + let callBackSpy = sinon.spy(); + let submoduleCallback = liveIntentIdSubmodule.getId(defaultConfigParams).callback; + submoduleCallback(callBackSpy); + let request = server.requests[1]; + expect(request.url).to.be.eq(`https://idx.liadm.com/idex/prebid/89899?duid=${oldCookie}`); + request.respond( + 200, + responseHeader, + JSON.stringify({}) + ); + expect(callBackSpy.calledOnce).to.be.true; + }); + + it('should include the LiveConnect identifier and additional Identifiers to resolve', function() { + const oldCookie = 'a-xxxx--123e4567-e89b-12d3-a456-426655440000' + getDataFromLocalStorageStub.withArgs('_li_duid').returns(oldCookie); + getDataFromLocalStorageStub.withArgs('_thirdPC').returns('third-pc'); + const configParams = { params: { + ...defaultConfigParams.params, + ...{ + 'identifiersToResolve': ['_thirdPC'] + } + }}; + let callBackSpy = sinon.spy(); + let submoduleCallback = liveIntentIdSubmodule.getId(configParams).callback; + submoduleCallback(callBackSpy); + let request = server.requests[1]; + expect(request.url).to.be.eq(`https://idx.liadm.com/idex/prebid/89899?duid=${oldCookie}&_thirdPC=third-pc`); + request.respond( + 200, + responseHeader, + JSON.stringify({}) + ); + expect(callBackSpy.calledOnce).to.be.true; + }); + + it('should include an additional identifier value to resolve even if it is an object', function() { + getCookieStub.returns(null); + getDataFromLocalStorageStub.withArgs('_thirdPC').returns({'key': 'value'}); + const configParams = { params: { + ...defaultConfigParams.params, + ...{ + 'identifiersToResolve': ['_thirdPC'] + } + }}; + let callBackSpy = sinon.spy(); + let submoduleCallback = liveIntentIdSubmodule.getId(configParams).callback; + submoduleCallback(callBackSpy); + let request = server.requests[1]; + expect(request.url).to.be.eq('https://idx.liadm.com/idex/prebid/89899?_thirdPC=%7B%22key%22%3A%22value%22%7D'); + request.respond( + 200, + responseHeader, + JSON.stringify({}) + ); + expect(callBackSpy.calledOnce).to.be.true; + }); + + it('should send an error when the cookie jar throws an unexpected error', function() { + getCookieStub.throws('CookieError', 'A message'); + liveIntentIdSubmodule.getId(defaultConfigParams); + expect(imgStub.getCall(0).args[0]).to.match(/.*ae=.+/); + }); +}); From e8d90ea9265826c286afef1a7d6500580cfe46d8 Mon Sep 17 00:00:00 2001 From: Janko Ulaga Date: Tue, 3 Nov 2020 18:57:28 +0100 Subject: [PATCH 3/7] NT. POC kinda ok for me now --- gulpfile.js | 2 +- modules/liveIntentIdSystem.js | 12 +- package-lock.json | 47 ++++++ .../modules/liveIntentIdMinimalSystem_spec.js | 144 ++---------------- test/spec/modules/liveIntentIdSystem_spec.js | 4 +- 5 files changed, 76 insertions(+), 133 deletions(-) diff --git a/gulpfile.js b/gulpfile.js index 879e34ae588..b10fda86f97 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -362,7 +362,7 @@ gulp.task('build-bundle-dev', gulp.series(makeDevpackPkg, gulpBundle.bind(null, gulp.task('build-bundle-prod', gulp.series(makeWebpackPkg, gulpBundle.bind(null, false))); // public tasks (dependencies are needed for each task since they can be ran on their own) -gulp.task('test', gulp.series(clean, lint, test)); +gulp.task('test', gulp.series(clean, test)); gulp.task('test-coverage', gulp.series(clean, testCoverage)); gulp.task(viewCoverage); diff --git a/modules/liveIntentIdSystem.js b/modules/liveIntentIdSystem.js index 4f18c73ad2a..611fef2e2e6 100644 --- a/modules/liveIntentIdSystem.js +++ b/modules/liveIntentIdSystem.js @@ -11,6 +11,7 @@ import { submodule } from '../src/hook.js'; import { LiveConnect } from 'live-connect-js/cjs/live-connect.js'; import { gdprDataHandler, uspDataHandler } from '../src/adapterManager.js'; import { getStorageManager } from '../src/storageManager.js'; +import { MinimalLiveConnect } from "live-connect-js/esm/live-connect"; const MODULE_NAME = 'liveIntentId'; export const storage = getStorageManager(null, MODULE_NAME); @@ -42,6 +43,7 @@ export function reset() { if (window && window.liQ) { window.liQ = []; } + liveIntentIdSubmodule.setModuleMode(null) eventFired = false; liveConnect = null; } @@ -105,7 +107,7 @@ function initializeLiveConnect(configParams) { // The second param is the storage object, LS & Cookie manipulation uses PBJS utils. // The third param is the ajax and pixel object, the ajax and pixel use PBJS utils. - liveConnect = LiveConnect(liveConnectConfig, storage, calls); + liveConnect = liveIntentIdSubmodule.getInitializer()(liveConnectConfig, storage, calls); return liveConnect; } @@ -118,12 +120,20 @@ function tryFireEvent() { /** @type {Submodule} */ export const liveIntentIdSubmodule = { + moduleMode: process.env.LiveConnectMode, /** * used to link submodule with config * @type {string} */ name: MODULE_NAME, + setModuleMode(mode) { + this.moduleMode = mode + }, + getInitializer() { + return this.moduleMode === 'minimal' ? MinimalLiveConnect : LiveConnect + }, + /** * decode the stored id value for passing to bid requests. Note that lipb object is a wrapper for everything, and * internally it could contain more data other than `lipbid`(e.g. `segments`) depending on the `partner` and diff --git a/package-lock.json b/package-lock.json index 9cb3b86c7e1..acd14541cd7 100644 --- a/package-lock.json +++ b/package-lock.json @@ -5658,6 +5658,12 @@ "integrity": "sha1-V00xLt2Iu13YkS6Sht1sCu1KrII=", "dev": true }, + "check-more-types": { + "version": "2.24.0", + "resolved": "https://registry.npmjs.org/check-more-types/-/check-more-types-2.24.0.tgz", + "integrity": "sha1-FCD/sQ/URNz8ebQ4kbv//TKoRgA=", + "dev": true + }, "check-types": { "version": "8.0.3", "resolved": "https://registry.npmjs.org/check-types/-/check-types-8.0.3.tgz", @@ -15603,6 +15609,12 @@ "es6-weak-map": "^2.0.1" } }, + "lazy-ass": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/lazy-ass/-/lazy-ass-1.6.0.tgz", + "integrity": "sha1-eZllXoZGwX8In90YfRUNMyTVRRM=", + "dev": true + }, "lazy-cache": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/lazy-cache/-/lazy-cache-1.0.4.tgz", @@ -16891,6 +16903,35 @@ } } }, + "mocked-env": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/mocked-env/-/mocked-env-1.3.2.tgz", + "integrity": "sha512-jwm3ziowCjpbLNhUNYwn2G0tawV/ZGRuWeEGt6PItrkQT74Nk3pDldL2pmwm9sQZw6a/x+ZBGeBVYq54acTauQ==", + "dev": true, + "requires": { + "check-more-types": "2.24.0", + "debug": "4.1.1", + "lazy-ass": "1.6.0", + "ramda": "0.26.1" + }, + "dependencies": { + "debug": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz", + "integrity": "sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==", + "dev": true, + "requires": { + "ms": "^2.1.1" + } + }, + "ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", + "dev": true + } + } + }, "module-deps-sortable": { "version": "4.0.6", "resolved": "https://registry.npmjs.org/module-deps-sortable/-/module-deps-sortable-4.0.6.tgz", @@ -18788,6 +18829,12 @@ "integrity": "sha512-WuyALRjWPDGtt/wzJiadO5AXY+8hZ80hVpe6MyivgraREW751X3SbhRvG3eLKOYN+8VEvqLcf3wdnt44Z4S4SA==", "dev": true }, + "ramda": { + "version": "0.26.1", + "resolved": "https://registry.npmjs.org/ramda/-/ramda-0.26.1.tgz", + "integrity": "sha512-hLWjpy7EnsDBb0p+Z3B7rPi3GDeRG5ZtiI33kJhTt+ORCd38AbAIjB/9zRIUoeTbE/AVX5ZkU7m6bznsvrf8eQ==", + "dev": true + }, "randomatic": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/randomatic/-/randomatic-3.1.1.tgz", diff --git a/test/spec/modules/liveIntentIdMinimalSystem_spec.js b/test/spec/modules/liveIntentIdMinimalSystem_spec.js index 559a8a6297e..b1632bad634 100644 --- a/test/spec/modules/liveIntentIdMinimalSystem_spec.js +++ b/test/spec/modules/liveIntentIdMinimalSystem_spec.js @@ -1,13 +1,13 @@ -import { liveIntentIdSubmodule, reset as resetLiveIntentIdSubmodule, storage } from 'modules/liveIntentIdSystem.js'; import * as utils from 'src/utils.js'; import { gdprDataHandler, uspDataHandler } from '../../../src/adapterManager.js'; import { server } from 'test/mocks/xhr.js'; +import { liveIntentIdSubmodule, reset as resetLiveIntentIdSubmodule, storage } from 'modules/liveIntentIdSystem.js'; const PUBLISHER_ID = '89899'; const defaultConfigParams = { params: {publisherId: PUBLISHER_ID} }; -const responseHeader = {'Content-Type': 'application/json'} +const responseHeader = {'Content-Type': 'application/json'}; -describe('LiveIntentId', function() { +describe('LiveIntentMinimalId', function() { let logErrorStub; let uspConsentDataStub; let gdprConsentDataStub; @@ -16,7 +16,7 @@ describe('LiveIntentId', function() { let imgStub; beforeEach(function() { - process.env.LiveConnectMode = 'minimal' + liveIntentIdSubmodule.setModuleMode('minimal'); imgStub = sinon.stub(utils, 'triggerPixel'); getCookieStub = sinon.stub(storage, 'getCookie'); getDataFromLocalStorageStub = sinon.stub(storage, 'getDataFromLocalStorage'); @@ -26,83 +26,23 @@ describe('LiveIntentId', function() { }); afterEach(function() { - process.env.LiveConnectMode = undefined imgStub.restore(); getCookieStub.restore(); getDataFromLocalStorageStub.restore(); logErrorStub.restore(); uspConsentDataStub.restore(); gdprConsentDataStub.restore(); + liveIntentIdSubmodule.setModuleMode('minimal'); resetLiveIntentIdSubmodule(); }); - - it('should initialize LiveConnect with a privacy string when getId, and include it in the resolution request', function() { - uspConsentDataStub.returns('1YNY'); - gdprConsentDataStub.returns({ - gdprApplies: true, - consentString: 'consentDataString' - }) - let callBackSpy = sinon.spy(); - let submoduleCallback = liveIntentIdSubmodule.getId(defaultConfigParams).callback; - submoduleCallback(callBackSpy); - let request = server.requests[1]; - expect(request.url).to.match(/.*us_privacy=1YNY.*&gdpr=1&gdpr_consent=consentDataString.*/); - request.respond( - 200, - responseHeader, - JSON.stringify({}) - ); - expect(callBackSpy.calledOnce).to.be.true; - }); - - it('should fire an event when getId', function() { + it('should not fire an event when getId', function() { uspConsentDataStub.returns('1YNY'); gdprConsentDataStub.returns({ gdprApplies: true, consentString: 'consentDataString' }) liveIntentIdSubmodule.getId(defaultConfigParams); - expect(server.requests[0].url).to.match(/https:\/\/rp.liadm.com\/j\?wpn=prebid.*us_privacy=1YNY.*&gdpr=1&gdpr_consent=consentDataString.*/); - }); - - it('should fire an event when getId and a hash is provided', function() { - liveIntentIdSubmodule.getId({ params: { - ...defaultConfigParams, - emailHash: '58131bc547fb87af94cebdaf3102321f' - }}); - expect(server.requests[0].url).to.match(/https:\/\/rp.liadm.com\/j\?.*e=58131bc547fb87af94cebdaf3102321f.+/) - }); - - it('should initialize LiveConnect with the config params when decode and emit an event', function () { - liveIntentIdSubmodule.decode({}, { params: { - ...defaultConfigParams.params, - ...{ - url: 'https://dummy.liveintent.com', - liCollectConfig: { - appId: 'a-0001', - collectorUrl: 'https://collector.liveintent.com' - } - } - }}); - expect(server.requests[0].url).to.match(/https:\/\/collector.liveintent.com\/j\?aid=a-0001&wpn=prebid.*/); - }); - - it('should initialize LiveConnect and emit an event with a privacy string when decode', function() { - uspConsentDataStub.returns('1YNY'); - gdprConsentDataStub.returns({ - gdprApplies: false, - consentString: 'consentDataString' - }) - liveIntentIdSubmodule.decode({}, defaultConfigParams); - expect(server.requests[0].url).to.match(/.*us_privacy=1YNY.*&gdpr=0&gdpr_consent=consentDataString.*/); - }); - - it('should fire an event when decode and a hash is provided', function() { - liveIntentIdSubmodule.decode({}, { params: { - ...defaultConfigParams.params, - emailHash: '58131bc547fb87af94cebdaf3102321f' - }}); - expect(server.requests[0].url).to.match(/https:\/\/rp.liadm.com\/j\?.*e=58131bc547fb87af94cebdaf3102321f.+/); + expect(server.requests[0]).to.eql(undefined) }); it('should not return a decoded identifier when the unifiedId is not present in the value', function() { @@ -110,17 +50,12 @@ describe('LiveIntentId', function() { expect(result).to.be.undefined; }); - it('should fire an event when decode', function() { - liveIntentIdSubmodule.decode({}, defaultConfigParams); - expect(server.requests[0].url).to.be.not.null - }); - - it('should initialize LiveConnect and send data only once', function() { + it('should initialize LiveConnect and send no data', function() { liveIntentIdSubmodule.getId(defaultConfigParams); liveIntentIdSubmodule.decode({}, defaultConfigParams); liveIntentIdSubmodule.getId(defaultConfigParams); liveIntentIdSubmodule.decode({}, defaultConfigParams); - expect(server.requests.length).to.be.eq(1); + expect(server.requests.length).to.be.eq(0); }); it('should call the Custom URL of the LiveIntent Identity Exchange endpoint', function() { @@ -128,7 +63,7 @@ describe('LiveIntentId', function() { let callBackSpy = sinon.spy(); let submoduleCallback = liveIntentIdSubmodule.getId({ params: {...defaultConfigParams.params, ...{'url': 'https://dummy.liveintent.com/idex'}} }).callback; submoduleCallback(callBackSpy); - let request = server.requests[1]; + let request = server.requests[0]; expect(request.url).to.be.eq('https://dummy.liveintent.com/idex/prebid/89899'); request.respond( 200, @@ -149,7 +84,7 @@ describe('LiveIntentId', function() { } } }).callback; submoduleCallback(callBackSpy); - let request = server.requests[1]; + let request = server.requests[0]; expect(request.url).to.be.eq('https://dummy.liveintent.com/idex/rubicon/89899'); request.respond( 200, @@ -164,7 +99,7 @@ describe('LiveIntentId', function() { let callBackSpy = sinon.spy(); let submoduleCallback = liveIntentIdSubmodule.getId(defaultConfigParams).callback; submoduleCallback(callBackSpy); - let request = server.requests[1]; + let request = server.requests[0]; expect(request.url).to.be.eq('https://idx.liadm.com/idex/prebid/89899'); request.respond( 200, @@ -179,7 +114,7 @@ describe('LiveIntentId', function() { let callBackSpy = sinon.spy(); let submoduleCallback = liveIntentIdSubmodule.getId(defaultConfigParams).callback; submoduleCallback(callBackSpy); - let request = server.requests[1]; + let request = server.requests[0]; expect(request.url).to.be.eq('https://idx.liadm.com/idex/prebid/89899'); request.respond( 503, @@ -196,7 +131,7 @@ describe('LiveIntentId', function() { let callBackSpy = sinon.spy(); let submoduleCallback = liveIntentIdSubmodule.getId(defaultConfigParams).callback; submoduleCallback(callBackSpy); - let request = server.requests[1]; + let request = server.requests[0]; expect(request.url).to.be.eq(`https://idx.liadm.com/idex/prebid/89899?duid=${oldCookie}`); request.respond( 200, @@ -205,55 +140,4 @@ describe('LiveIntentId', function() { ); expect(callBackSpy.calledOnce).to.be.true; }); - - it('should include the LiveConnect identifier and additional Identifiers to resolve', function() { - const oldCookie = 'a-xxxx--123e4567-e89b-12d3-a456-426655440000' - getDataFromLocalStorageStub.withArgs('_li_duid').returns(oldCookie); - getDataFromLocalStorageStub.withArgs('_thirdPC').returns('third-pc'); - const configParams = { params: { - ...defaultConfigParams.params, - ...{ - 'identifiersToResolve': ['_thirdPC'] - } - }}; - let callBackSpy = sinon.spy(); - let submoduleCallback = liveIntentIdSubmodule.getId(configParams).callback; - submoduleCallback(callBackSpy); - let request = server.requests[1]; - expect(request.url).to.be.eq(`https://idx.liadm.com/idex/prebid/89899?duid=${oldCookie}&_thirdPC=third-pc`); - request.respond( - 200, - responseHeader, - JSON.stringify({}) - ); - expect(callBackSpy.calledOnce).to.be.true; - }); - - it('should include an additional identifier value to resolve even if it is an object', function() { - getCookieStub.returns(null); - getDataFromLocalStorageStub.withArgs('_thirdPC').returns({'key': 'value'}); - const configParams = { params: { - ...defaultConfigParams.params, - ...{ - 'identifiersToResolve': ['_thirdPC'] - } - }}; - let callBackSpy = sinon.spy(); - let submoduleCallback = liveIntentIdSubmodule.getId(configParams).callback; - submoduleCallback(callBackSpy); - let request = server.requests[1]; - expect(request.url).to.be.eq('https://idx.liadm.com/idex/prebid/89899?_thirdPC=%7B%22key%22%3A%22value%22%7D'); - request.respond( - 200, - responseHeader, - JSON.stringify({}) - ); - expect(callBackSpy.calledOnce).to.be.true; - }); - - it('should send an error when the cookie jar throws an unexpected error', function() { - getCookieStub.throws('CookieError', 'A message'); - liveIntentIdSubmodule.getId(defaultConfigParams); - expect(imgStub.getCall(0).args[0]).to.match(/.*ae=.+/); - }); }); diff --git a/test/spec/modules/liveIntentIdSystem_spec.js b/test/spec/modules/liveIntentIdSystem_spec.js index aae60cbcd19..3b4e4b9d9a7 100644 --- a/test/spec/modules/liveIntentIdSystem_spec.js +++ b/test/spec/modules/liveIntentIdSystem_spec.js @@ -2,7 +2,8 @@ import { liveIntentIdSubmodule, reset as resetLiveIntentIdSubmodule, storage } f import * as utils from 'src/utils.js'; import { gdprDataHandler, uspDataHandler } from '../../../src/adapterManager.js'; import { server } from 'test/mocks/xhr.js'; - +resetLiveIntentIdSubmodule(); +liveIntentIdSubmodule.setModuleMode('standard') const PUBLISHER_ID = '89899'; const defaultConfigParams = { params: {publisherId: PUBLISHER_ID} }; const responseHeader = {'Content-Type': 'application/json'} @@ -16,6 +17,7 @@ describe('LiveIntentId', function() { let imgStub; beforeEach(function() { + liveIntentIdSubmodule.setModuleMode('standard'); imgStub = sinon.stub(utils, 'triggerPixel'); getCookieStub = sinon.stub(storage, 'getCookie'); getDataFromLocalStorageStub = sinon.stub(storage, 'getDataFromLocalStorage'); From 2aa420065ab4cd77ed14c76edde2e0aa58fa1c53 Mon Sep 17 00:00:00 2001 From: Janko Ulaga Date: Tue, 10 Nov 2020 12:59:45 +0100 Subject: [PATCH 4/7] NT. Updated the lc version to released one. --- modules/liveIntentIdSystem.js | 27 +++------ package-lock.json | 58 +------------------ package.json | 2 +- .../modules/liveIntentIdMinimalSystem_spec.js | 45 ++++++++++++++ 4 files changed, 58 insertions(+), 74 deletions(-) diff --git a/modules/liveIntentIdSystem.js b/modules/liveIntentIdSystem.js index 611fef2e2e6..8004b191f0f 100644 --- a/modules/liveIntentIdSystem.js +++ b/modules/liveIntentIdSystem.js @@ -8,10 +8,10 @@ import * as utils from '../src/utils.js'; import { triggerPixel } from '../src/utils.js'; import { ajaxBuilder } from '../src/ajax.js'; import { submodule } from '../src/hook.js'; -import { LiveConnect } from 'live-connect-js/cjs/live-connect.js'; +import { LiveConnect } from 'live-connect-js/esm/initializer.js'; import { gdprDataHandler, uspDataHandler } from '../src/adapterManager.js'; import { getStorageManager } from '../src/storageManager.js'; -import { MinimalLiveConnect } from "live-connect-js/esm/live-connect"; +import { MinimalLiveConnect } from "live-connect-js/esm/minimal-live-connect.js"; const MODULE_NAME = 'liveIntentId'; export const storage = getStorageManager(null, MODULE_NAME); @@ -50,20 +50,11 @@ export function reset() { function parseLiveIntentCollectorConfig(collectConfig) { const config = {}; - if (collectConfig) { - if (collectConfig.appId) { - config.appId = collectConfig.appId; - } - if (collectConfig.fpiStorageStrategy) { - config.storageStrategy = collectConfig.fpiStorageStrategy; - } - if (collectConfig.fpiExpirationDays) { - config.expirationDays = collectConfig.fpiExpirationDays; - } - if (collectConfig.collectorUrl) { - config.collectorUrl = collectConfig.collectorUrl; - } - } + collectConfig = collectConfig || {} + collectConfig.appId && (config.appId = collectConfig.appId); + collectConfig.fpiStorageStrategy && (config.storageStrategy = collectConfig.fpiStorageStrategy); + collectConfig.fpiExpirationDays && (config.expirationDays = collectConfig.fpiExpirationDays); + collectConfig.collectorUrl && (config.collectorUrl = collectConfig.collectorUrl); return config; } @@ -74,7 +65,7 @@ function initializeLiveConnect(configParams) { } const publisherId = configParams.publisherId || 'any'; - const identityResolutionConfig = { + const identityResolutionConfig = { source: 'prebid', publisherId: publisherId }; @@ -146,7 +137,7 @@ export const liveIntentIdSubmodule = { decode(value, config) { const configParams = (config && config.params) || {}; function composeIdObject(value) { - const base = { 'lipbid': value['unifiedId'] }; + const base = { 'lipbid': value.unifiedId }; delete value.unifiedId; return { 'lipb': { ...base, ...value } }; } diff --git a/package-lock.json b/package-lock.json index acd14541cd7..330298cbaac 100644 --- a/package-lock.json +++ b/package-lock.json @@ -5065,11 +5065,6 @@ "integrity": "sha1-EsJe/kCkXjwyPrhnWgoM5XsiNx8=", "dev": true }, - "browser-cookies": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/browser-cookies/-/browser-cookies-1.2.0.tgz", - "integrity": "sha1-/KP/ubamOq3E2MCZnGtX0Pp9KbU=" - }, "browser-process-hrtime": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/browser-process-hrtime/-/browser-process-hrtime-1.0.0.tgz", @@ -5658,12 +5653,6 @@ "integrity": "sha1-V00xLt2Iu13YkS6Sht1sCu1KrII=", "dev": true }, - "check-more-types": { - "version": "2.24.0", - "resolved": "https://registry.npmjs.org/check-more-types/-/check-more-types-2.24.0.tgz", - "integrity": "sha1-FCD/sQ/URNz8ebQ4kbv//TKoRgA=", - "dev": true - }, "check-types": { "version": "8.0.3", "resolved": "https://registry.npmjs.org/check-types/-/check-types-8.0.3.tgz", @@ -15609,12 +15598,6 @@ "es6-weak-map": "^2.0.1" } }, - "lazy-ass": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/lazy-ass/-/lazy-ass-1.6.0.tgz", - "integrity": "sha1-eZllXoZGwX8In90YfRUNMyTVRRM=", - "dev": true - }, "lazy-cache": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/lazy-cache/-/lazy-cache-1.0.4.tgz", @@ -15735,10 +15718,10 @@ "dev": true }, "live-connect-js": { - "version": "github:LiveIntent/live-connect#d183a7735cd9ec241900474443e9119d8da452c6", - "from": "github:LiveIntent/live-connect#NT-size-optimizations", + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/live-connect-js/-/live-connect-js-2.0.0.tgz", + "integrity": "sha512-Xhrj1JU5LoLjJuujjTlvDfc/n3Shzk2hPlYmLdCx/lsltFFVuCFa9uM8u5mcHlmOUKP5pu9I54bAITxZBMHoXg==", "requires": { - "browser-cookies": "^1.2.0", "tiny-hashes": "1.0.1" } }, @@ -16903,35 +16886,6 @@ } } }, - "mocked-env": { - "version": "1.3.2", - "resolved": "https://registry.npmjs.org/mocked-env/-/mocked-env-1.3.2.tgz", - "integrity": "sha512-jwm3ziowCjpbLNhUNYwn2G0tawV/ZGRuWeEGt6PItrkQT74Nk3pDldL2pmwm9sQZw6a/x+ZBGeBVYq54acTauQ==", - "dev": true, - "requires": { - "check-more-types": "2.24.0", - "debug": "4.1.1", - "lazy-ass": "1.6.0", - "ramda": "0.26.1" - }, - "dependencies": { - "debug": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz", - "integrity": "sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==", - "dev": true, - "requires": { - "ms": "^2.1.1" - } - }, - "ms": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", - "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", - "dev": true - } - } - }, "module-deps-sortable": { "version": "4.0.6", "resolved": "https://registry.npmjs.org/module-deps-sortable/-/module-deps-sortable-4.0.6.tgz", @@ -18829,12 +18783,6 @@ "integrity": "sha512-WuyALRjWPDGtt/wzJiadO5AXY+8hZ80hVpe6MyivgraREW751X3SbhRvG3eLKOYN+8VEvqLcf3wdnt44Z4S4SA==", "dev": true }, - "ramda": { - "version": "0.26.1", - "resolved": "https://registry.npmjs.org/ramda/-/ramda-0.26.1.tgz", - "integrity": "sha512-hLWjpy7EnsDBb0p+Z3B7rPi3GDeRG5ZtiI33kJhTt+ORCd38AbAIjB/9zRIUoeTbE/AVX5ZkU7m6bznsvrf8eQ==", - "dev": true - }, "randomatic": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/randomatic/-/randomatic-3.1.1.tgz", diff --git a/package.json b/package.json index 25e5d4a1de5..51717e2ab5c 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": "LiveIntent/live-connect#NT-size-optimizations" + "live-connect-js": "2.0.0" } } diff --git a/test/spec/modules/liveIntentIdMinimalSystem_spec.js b/test/spec/modules/liveIntentIdMinimalSystem_spec.js index b1632bad634..a5d4626acb3 100644 --- a/test/spec/modules/liveIntentIdMinimalSystem_spec.js +++ b/test/spec/modules/liveIntentIdMinimalSystem_spec.js @@ -140,4 +140,49 @@ describe('LiveIntentMinimalId', function() { ); expect(callBackSpy.calledOnce).to.be.true; }); + + it('should include the LiveConnect identifier and additional Identifiers to resolve', function() { + const oldCookie = 'a-xxxx--123e4567-e89b-12d3-a456-426655440000' + getDataFromLocalStorageStub.withArgs('_li_duid').returns(oldCookie); + getDataFromLocalStorageStub.withArgs('_thirdPC').returns('third-pc'); + const configParams = { params: { + ...defaultConfigParams.params, + ...{ + 'identifiersToResolve': ['_thirdPC'] + } + }}; + let callBackSpy = sinon.spy(); + let submoduleCallback = liveIntentIdSubmodule.getId(configParams).callback; + submoduleCallback(callBackSpy); + let request = server.requests[0]; + expect(request.url).to.be.eq(`https://idx.liadm.com/idex/prebid/89899?duid=${oldCookie}&_thirdPC=third-pc`); + request.respond( + 200, + responseHeader, + JSON.stringify({}) + ); + expect(callBackSpy.calledOnce).to.be.true; + }); + + it('should include an additional identifier value to resolve even if it is an object', function() { + getCookieStub.returns(null); + getDataFromLocalStorageStub.withArgs('_thirdPC').returns({'key': 'value'}); + const configParams = { params: { + ...defaultConfigParams.params, + ...{ + 'identifiersToResolve': ['_thirdPC'] + } + }}; + let callBackSpy = sinon.spy(); + let submoduleCallback = liveIntentIdSubmodule.getId(configParams).callback; + submoduleCallback(callBackSpy); + let request = server.requests[0]; + expect(request.url).to.be.eq('https://idx.liadm.com/idex/prebid/89899?_thirdPC=%7B%22key%22%3A%22value%22%7D'); + request.respond( + 200, + responseHeader, + JSON.stringify({}) + ); + expect(callBackSpy.calledOnce).to.be.true; + }); }); From edf5d96bf756a8bada5b9e33493a1e071ef0f19e Mon Sep 17 00:00:00 2001 From: Janko Ulaga Date: Mon, 23 Nov 2020 10:21:49 +0100 Subject: [PATCH 5/7] NT. Reverting test data. Ready for PR --- gulpfile.js | 2 +- karma.conf.maker.js | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/gulpfile.js b/gulpfile.js index b10fda86f97..879e34ae588 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -362,7 +362,7 @@ gulp.task('build-bundle-dev', gulp.series(makeDevpackPkg, gulpBundle.bind(null, gulp.task('build-bundle-prod', gulp.series(makeWebpackPkg, gulpBundle.bind(null, false))); // public tasks (dependencies are needed for each task since they can be ran on their own) -gulp.task('test', gulp.series(clean, test)); +gulp.task('test', gulp.series(clean, lint, test)); gulp.task('test-coverage', gulp.series(clean, testCoverage)); gulp.task(viewCoverage); diff --git a/karma.conf.maker.js b/karma.conf.maker.js index 7c9928a263e..8af216d6262 100644 --- a/karma.conf.maker.js +++ b/karma.conf.maker.js @@ -154,6 +154,11 @@ module.exports = function(codeCoverage, browserstack, watchMode, file) { reporters: ['mocha'], + mochaReporter: { + showDiff: true, + output: 'minimal' + }, + // Continuous Integration mode // if true, Karma captures browsers, runs the tests and exits singleRun: !watchMode, From 07bb071333107c2b2c11640444679fba8bc542b4 Mon Sep 17 00:00:00 2001 From: Janko Ulaga Date: Mon, 23 Nov 2020 11:04:48 +0100 Subject: [PATCH 6/7] NT. Fixing linting. --- modules/liveIntentIdSystem.js | 4 ++-- .../modules/liveIntentIdMinimalSystem_spec.js | 20 +++++++++---------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/modules/liveIntentIdSystem.js b/modules/liveIntentIdSystem.js index 8004b191f0f..a870324a40a 100644 --- a/modules/liveIntentIdSystem.js +++ b/modules/liveIntentIdSystem.js @@ -11,7 +11,7 @@ import { submodule } from '../src/hook.js'; import { LiveConnect } from 'live-connect-js/esm/initializer.js'; import { gdprDataHandler, uspDataHandler } from '../src/adapterManager.js'; import { getStorageManager } from '../src/storageManager.js'; -import { MinimalLiveConnect } from "live-connect-js/esm/minimal-live-connect.js"; +import { MinimalLiveConnect } from 'live-connect-js/esm/minimal-live-connect.js'; const MODULE_NAME = 'liveIntentId'; export const storage = getStorageManager(null, MODULE_NAME); @@ -65,7 +65,7 @@ function initializeLiveConnect(configParams) { } const publisherId = configParams.publisherId || 'any'; - const identityResolutionConfig = { + const identityResolutionConfig = { source: 'prebid', publisherId: publisherId }; diff --git a/test/spec/modules/liveIntentIdMinimalSystem_spec.js b/test/spec/modules/liveIntentIdMinimalSystem_spec.js index a5d4626acb3..b0f97ae0300 100644 --- a/test/spec/modules/liveIntentIdMinimalSystem_spec.js +++ b/test/spec/modules/liveIntentIdMinimalSystem_spec.js @@ -146,11 +146,11 @@ describe('LiveIntentMinimalId', function() { getDataFromLocalStorageStub.withArgs('_li_duid').returns(oldCookie); getDataFromLocalStorageStub.withArgs('_thirdPC').returns('third-pc'); const configParams = { params: { - ...defaultConfigParams.params, - ...{ - 'identifiersToResolve': ['_thirdPC'] - } - }}; + ...defaultConfigParams.params, + ...{ + 'identifiersToResolve': ['_thirdPC'] + } + }}; let callBackSpy = sinon.spy(); let submoduleCallback = liveIntentIdSubmodule.getId(configParams).callback; submoduleCallback(callBackSpy); @@ -168,11 +168,11 @@ describe('LiveIntentMinimalId', function() { getCookieStub.returns(null); getDataFromLocalStorageStub.withArgs('_thirdPC').returns({'key': 'value'}); const configParams = { params: { - ...defaultConfigParams.params, - ...{ - 'identifiersToResolve': ['_thirdPC'] - } - }}; + ...defaultConfigParams.params, + ...{ + 'identifiersToResolve': ['_thirdPC'] + } + }}; let callBackSpy = sinon.spy(); let submoduleCallback = liveIntentIdSubmodule.getId(configParams).callback; submoduleCallback(callBackSpy); From 92773603c9d7c3fc0e4f84b8786b1e364ef56665 Mon Sep 17 00:00:00 2001 From: Janko Ulaga Date: Mon, 23 Nov 2020 12:26:24 +0100 Subject: [PATCH 7/7] NT. Fixing the email hash scenario. --- modules/liveIntentIdSystem.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/modules/liveIntentIdSystem.js b/modules/liveIntentIdSystem.js index a870324a40a..f87d67aae8e 100644 --- a/modules/liveIntentIdSystem.js +++ b/modules/liveIntentIdSystem.js @@ -83,9 +83,6 @@ function initializeLiveConnect(configParams) { liveConnectConfig.wrapperName = 'prebid'; liveConnectConfig.identityResolutionConfig = identityResolutionConfig; liveConnectConfig.identifiersToResolve = configParams.identifiersToResolve || []; - if (configParams.emailHash) { - liveConnectConfig.eventSource = { hash: configParams.emailHash } - } const usPrivacyString = uspDataHandler.getConsentData(); if (usPrivacyString) { liveConnectConfig.usPrivacyString = usPrivacyString; @@ -99,6 +96,9 @@ function initializeLiveConnect(configParams) { // The second param is the storage object, LS & Cookie manipulation uses PBJS utils. // The third param is the ajax and pixel object, the ajax and pixel use PBJS utils. liveConnect = liveIntentIdSubmodule.getInitializer()(liveConnectConfig, storage, calls); + if (configParams.emailHash) { + liveConnect.push({ hash: configParams.emailHash }) + } return liveConnect; }