diff --git a/libraries/liveIntentIdSystem/liveIntentIdHubSystem.js b/libraries/liveIntentIdSystem/liveIntentIdHubSystem.js index 40d1126f4aa..064f4d20801 100644 --- a/libraries/liveIntentIdSystem/liveIntentIdHubSystem.js +++ b/libraries/liveIntentIdSystem/liveIntentIdHubSystem.js @@ -28,7 +28,7 @@ function initializeClient(configParams) { let integration if (collectConfig.appId != null) { integration = { type: 'application', appId: collectConfig.appId, publisherId: configParams.publisherId } - } else if (configParams.distributorId != null) { + } else if (configParams.distributorId != null && configParams.publisherId == null) { integration = { type: 'distributor', distributorId: configParams.distributorId } } else { integration = { type: 'custom', publisherId: configParams.publisherId, distributorId: configParams.distributorId } @@ -39,7 +39,7 @@ function initializeClient(configParams) { const collectSettings = { timeout: collectConfig.ajaxTimeout ?? DEFAULT_AJAX_TIMEOUT } let identityPartner - if (configParams.appId == null && configParams.distributorId != null) { + if (collectConfig.appId == null && configParams.distributorId != null) { identityPartner = configParams.distributorId } else if (configParams.partner != null) { identityPartner = configParams.partner diff --git a/libraries/liveIntentIdSystem/liveIntentIdSystemShared.js b/libraries/liveIntentIdSystem/liveIntentIdSystemShared.js index 02ab9165187..d8045800faa 100644 --- a/libraries/liveIntentIdSystem/liveIntentIdSystemShared.js +++ b/libraries/liveIntentIdSystem/liveIntentIdSystemShared.js @@ -7,9 +7,8 @@ export const GVLID = 148; export const DEFAULT_AJAX_TIMEOUT = 5000 export const MODULE_NAME = 'liveIntentId'; export const LI_PROVIDER_DOMAIN = 'liveintent.com'; -export const DEFAULT_REQUESTED_ATTRIBUTES = {'nonId': true} +export const DEFAULT_REQUESTED_ATTRIBUTES = { 'nonId': true } export const DEFAULT_DELAY = 500 -const defaultRequestedAttributes = {'nonId': true} export function parseRequestedAttributes(overrides) { function renameAttribute(attribute) { @@ -23,9 +22,9 @@ export function parseRequestedAttributes(overrides) { return Object.entries(config).flatMap(([k, v]) => (typeof v === 'boolean' && v) ? [renameAttribute(k)] : []); } if (typeof overrides === 'object') { - return createParameterArray({...defaultRequestedAttributes, ...overrides}); + return createParameterArray({...DEFAULT_REQUESTED_ATTRIBUTES, ...overrides}); } else { - return createParameterArray(defaultRequestedAttributes); + return createParameterArray(DEFAULT_REQUESTED_ATTRIBUTES); } } diff --git a/test/spec/modules/liveIntentIdHubSystem_spec.js b/test/spec/modules/liveIntentIdHubSystem_spec.js index ba952f16979..16a66ac4f23 100644 --- a/test/spec/modules/liveIntentIdHubSystem_spec.js +++ b/test/spec/modules/liveIntentIdHubSystem_spec.js @@ -30,6 +30,35 @@ describe('LiveIntentIdHub', function() { resetSubmodule(); }); + it('should use appId in integration when both appId and distributorId are provided', function() { + const configParams = { + params: { + ...defaultConfigParams.params, + distributorId: 'did-1111', + liCollectConfig: { + appId: 'a-0001' + }, + emailHash: '123' + } + } + liveIntentIdHubSubmodule.decode({}, configParams); + expect(window.liQHub).to.eql([{ + clientDetails: { name: 'prebid', version: '$prebid.version$' }, + clientRef: {}, + collectSettings: { timeout: DEFAULT_AJAX_TIMEOUT }, + consent: {}, + integration: { appId: 'a-0001', publisherId: '89899', type: 'application' }, + partnerCookies: new Set(), + resolveSettings: { identityPartner: 'prebid', timeout: DEFAULT_AJAX_TIMEOUT }, + type: 'register_client' + }, + { + clientRef: {}, + sourceEvent: { hash: '123' }, + type: 'collect' + }]) + }); + it('should fire an event and resolve when getId and include the privacy settings into the resolution request', function () { uspConsentDataStub.returns('1YNY'); gdprConsentDataStub.returns({ @@ -115,13 +144,18 @@ describe('LiveIntentIdHub', function() { }); it('should have the same data after call decode when appId, disrtributorId and sourceEvent is absent', function() { - liveIntentIdHubSubmodule.decode({}, defaultConfigParams); + liveIntentIdHubSubmodule.decode({}, { + params: { + ...defaultConfigParams.params, + distributorId: undefined + } + }); expect(window.liQHub).to.eql([{ clientDetails: { name: 'prebid', version: '$prebid.version$' }, clientRef: {}, collectSettings: { timeout: DEFAULT_AJAX_TIMEOUT }, consent: {}, - integration: { distributorId: defaultConfigParams.distributorId, publisherId: '89899', type: 'custom' }, + integration: { distributorId: undefined, publisherId: '89899', type: 'custom' }, partnerCookies: new Set(), resolveSettings: { identityPartner: 'prebid', timeout: DEFAULT_AJAX_TIMEOUT }, type: 'register_client' @@ -175,7 +209,7 @@ describe('LiveIntentIdHub', function() { clientRef: {}, collectSettings: { timeout: DEFAULT_AJAX_TIMEOUT }, consent: {}, - integration: { distributorId: 'did-1111', type: 'distributor' }, + integration: { distributorId: 'did-1111', publisherId: defaultConfigParams.params.publisherId, type: 'custom' }, partnerCookies: new Set(), resolveSettings: { identityPartner: 'did-1111', timeout: DEFAULT_AJAX_TIMEOUT }, type: 'register_client'