From 301b88e84ee665a8a746481cb4b47ff77d408d1c Mon Sep 17 00:00:00 2001 From: Peixun Zhang Date: Wed, 21 Aug 2024 14:56:12 +0200 Subject: [PATCH] only keep collect and rename --- .../liveIntentIdHubSystem.js | 6 +-- .../liveIntentIdSystemShared.js | 1 - modules/liveIntentIdSystem.js | 2 +- .../modules/liveIntentIdHubSystem_spec.js | 52 ++++--------------- 4 files changed, 12 insertions(+), 49 deletions(-) diff --git a/libraries/liveIntentIdSystem/liveIntentIdHubSystem.js b/libraries/liveIntentIdSystem/liveIntentIdHubSystem.js index 064f4d20801..88903ec1081 100644 --- a/libraries/liveIntentIdSystem/liveIntentIdHubSystem.js +++ b/libraries/liveIntentIdSystem/liveIntentIdHubSystem.js @@ -1,7 +1,7 @@ import { logError } from '../../src/utils.js'; import { gdprDataHandler, uspDataHandler, gppDataHandler } from '../../src/adapterManager.js'; import { submodule } from '../../src/hook.js'; -import { DEFAULT_AJAX_TIMEOUT, MODULE_NAME, parseRequestedAttributes, composeIdObject, eids, DEFAULT_DELAY, GVLID } from './liveIntentIdSystemShared.js' +import { DEFAULT_AJAX_TIMEOUT, MODULE_NAME, parseRequestedAttributes, composeIdObject, eids, GVLID } from './liveIntentIdSystemShared.js' // reference to the client for the liQHub let cachedClientRef @@ -97,11 +97,9 @@ function initializeClient(configParams) { resolveSettings }) - // fire default collect request + // only collect call if there is email hash if (configParams.emailHash != null) { window.liQHub.push({ type: 'collect', clientRef, sourceEvent: { hash: configParams.emailHash } }) - } else { - window.liQHub.push({ type: 'schedule_default_collect', clientRef, delay: configParams.fireEventDelay ?? DEFAULT_DELAY }) } cachedClientRef = clientRef diff --git a/libraries/liveIntentIdSystem/liveIntentIdSystemShared.js b/libraries/liveIntentIdSystem/liveIntentIdSystemShared.js index d8045800faa..fb3c37e2670 100644 --- a/libraries/liveIntentIdSystem/liveIntentIdSystemShared.js +++ b/libraries/liveIntentIdSystem/liveIntentIdSystemShared.js @@ -8,7 +8,6 @@ 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_DELAY = 500 export function parseRequestedAttributes(overrides) { function renameAttribute(attribute) { diff --git a/modules/liveIntentIdSystem.js b/modules/liveIntentIdSystem.js index 00d05787ff7..55ccd9420a4 100644 --- a/modules/liveIntentIdSystem.js +++ b/modules/liveIntentIdSystem.js @@ -2,7 +2,7 @@ function loadModule() { // Load appropriate module based on the build flag. Constant folding ensures // that the other one will not be included in the bundle. // eslint-disable-next-line no-constant-condition - if ('$$LIVE_INTENT_MODULE_MODE$$' === 'hub') { + if ('$$LIVE_INTENT_MODULE_MODE$$' === 'external') { // eslint-disable-next-line no-restricted-globals return require('../libraries/liveIntentIdSystem/liveIntentIdHubSystem.js') } else { diff --git a/test/spec/modules/liveIntentIdHubSystem_spec.js b/test/spec/modules/liveIntentIdHubSystem_spec.js index 16a66ac4f23..6580ca339f5 100644 --- a/test/spec/modules/liveIntentIdHubSystem_spec.js +++ b/test/spec/modules/liveIntentIdHubSystem_spec.js @@ -73,7 +73,7 @@ describe('LiveIntentIdHub', function() { const expectedConsent = { gdpr: { consentString: 'consentDataString', gdprApplies: true }, gpp: { applicableSections: [1, 2], consentString: 'gppConsentDataString' }, usPrivacy: { consentString: '1YNY' } } - expect(window.liQHub).to.have.length(3) + expect(window.liQHub).to.have.length(2) expect(window.liQHub[0]).to.eql({ clientDetails: { name: 'prebid', version: '$prebid.version$' }, @@ -86,13 +86,7 @@ describe('LiveIntentIdHub', function() { type: 'register_client' }) - expect(window.liQHub[1]).to.eql({ - clientRef: {}, - delay: defaultConfigParams.params.fireEventDelay, - type: 'schedule_default_collect' - }) - - const resolveCommand = window.liQHub[2] + const resolveCommand = window.liQHub[1] // functions cannot be reasonably compared, remove them delete resolveCommand.onSuccess[0].callback delete resolveCommand.onFailure @@ -159,11 +153,6 @@ describe('LiveIntentIdHub', function() { partnerCookies: new Set(), resolveSettings: { identityPartner: 'prebid', timeout: DEFAULT_AJAX_TIMEOUT }, type: 'register_client' - }, - { - clientRef: {}, - delay: defaultConfigParams.params.fireEventDelay, - type: 'schedule_default_collect' }]) }); @@ -241,11 +230,6 @@ describe('LiveIntentIdHub', function() { partnerCookies: new Set(), resolveSettings: { identityPartner: 'prebid', timeout: DEFAULT_AJAX_TIMEOUT }, type: 'register_client' - }, - { - clientRef: {}, - delay: defaultConfigParams.params.fireEventDelay, - type: 'schedule_default_collect' }]) }); @@ -253,7 +237,7 @@ describe('LiveIntentIdHub', function() { liveIntentIdHubSubmodule.decode({}, defaultConfigParams); liveIntentIdHubSubmodule.decode({}, defaultConfigParams); - expect(window.liQHub).to.have.length(2) // instead of 4 + expect(window.liQHub).to.have.length(1) // instead of 2 }); it('should not return a decoded identifier when the unifiedId is not present in the value', function() { @@ -277,7 +261,7 @@ describe('LiveIntentIdHub', function() { ...{ requestedAttributesOverrides: { 'foo': true, 'bar': false } } } }).callback(() => {}); - expect(window.liQHub).to.have.length(3) + expect(window.liQHub).to.have.length(2) expect(window.liQHub[0]).to.eql({ clientDetails: { name: 'prebid', version: '$prebid.version$' }, clientRef: {}, @@ -289,13 +273,7 @@ describe('LiveIntentIdHub', function() { type: 'register_client' }) - expect(window.liQHub[1]).to.eql({ - clientRef: {}, - delay: defaultConfigParams.params.fireEventDelay, - type: 'schedule_default_collect' - }) - - const resolveCommand = window.liQHub[2] + const resolveCommand = window.liQHub[1] // functions cannot be reasonably compared, remove them delete resolveCommand.onSuccess[0].callback @@ -367,7 +345,7 @@ describe('LiveIntentIdHub', function() { ...{ requestedAttributesOverrides: { 'nonId': false, 'uid2': true } } } }).callback(() => {}); - expect(window.liQHub).to.have.length(3) + expect(window.liQHub).to.have.length(2) expect(window.liQHub[0]).to.eql({ clientDetails: { name: 'prebid', version: '$prebid.version$' }, clientRef: {}, @@ -379,13 +357,7 @@ describe('LiveIntentIdHub', function() { type: 'register_client' }) - expect(window.liQHub[1]).to.eql({ - clientRef: {}, - delay: defaultConfigParams.params.fireEventDelay, - type: 'schedule_default_collect' - }) - - const resolveCommand = window.liQHub[2] + const resolveCommand = window.liQHub[1] // functions cannot be reasonably compared, remove them delete resolveCommand.onSuccess[0].callback delete resolveCommand.onFailure @@ -418,7 +390,7 @@ describe('LiveIntentIdHub', function() { requestedAttributesOverrides: { 'fpid': true } } }).callback(() => {}); - expect(window.liQHub).to.have.length(3) + expect(window.liQHub).to.have.length(2) expect(window.liQHub[0]).to.eql({ clientDetails: { name: 'prebid', version: '$prebid.version$' }, clientRef: {}, @@ -431,13 +403,7 @@ describe('LiveIntentIdHub', function() { type: 'register_client' }) - expect(window.liQHub[1]).to.eql({ - clientRef: {}, - delay: defaultConfigParams.params.fireEventDelay, - type: 'schedule_default_collect' - }) - - const resolveCommand = window.liQHub[2] + const resolveCommand = window.liQHub[1] // functions cannot be reasonably compared, remove them delete resolveCommand.onSuccess[0].callback