From 9b8b10ec457f044a0680f4bafe1914b035d1f712 Mon Sep 17 00:00:00 2001 From: 3link <34981284+3link@users.noreply.github.com> Date: Tue, 5 Dec 2023 09:26:22 +0100 Subject: [PATCH] Support EID translation for sovrn id --- modules/liveIntentIdSystem.js | 4 +++ modules/userId/eids.js | 14 ++++++++ modules/userId/eids.md | 8 +++++ test/spec/modules/eids_spec.js | 35 ++++++++++++++++++- .../modules/liveIntentIdMinimalSystem_spec.js | 5 +++ test/spec/modules/liveIntentIdSystem_spec.js | 5 +++ 6 files changed, 70 insertions(+), 1 deletion(-) diff --git a/modules/liveIntentIdSystem.js b/modules/liveIntentIdSystem.js index 54f57695f16..a17af227886 100644 --- a/modules/liveIntentIdSystem.js +++ b/modules/liveIntentIdSystem.js @@ -213,6 +213,10 @@ export const liveIntentIdSubmodule = { result.index = { 'id': value.index } } + if (value.sovrn) { + result.sovrn = { 'id': value.sovrn } + } + return result } diff --git a/modules/userId/eids.js b/modules/userId/eids.js index a0eb722d41c..661f576ca6a 100644 --- a/modules/userId/eids.js +++ b/modules/userId/eids.js @@ -193,6 +193,20 @@ export const USER_IDS_CONFIG = { } }, + // sovrn + 'sovrn': { + source: 'liveintent.sovrn.com', + atype: 3, + getValue: function(data) { + return data.id; + }, + getUidExt: function(data) { + if (data.ext) { + return data.ext; + } + } + }, + // britepoolId 'britepoolid': { source: 'britepool.com', diff --git a/modules/userId/eids.md b/modules/userId/eids.md index 427450d8874..62f7449c8c5 100644 --- a/modules/userId/eids.md +++ b/modules/userId/eids.md @@ -122,6 +122,14 @@ userIdAsEids = [ }] }, + { + source: 'liveintent.sovrn.com'', + uids: [{ + id: 'some-random-id-value', + atype: 3 + }] + }, + { source: 'media.net', uids: [{ diff --git a/test/spec/modules/eids_spec.js b/test/spec/modules/eids_spec.js index 5226fec7de2..00cc8570c92 100644 --- a/test/spec/modules/eids_spec.js +++ b/test/spec/modules/eids_spec.js @@ -246,7 +246,7 @@ describe('eids array generation for known sub-modules', function() { }); }); - it('magnite with ext', function() { + it('index with ext', function() { const userId = { index: {'id': 'sample_id', 'ext': {'provider': 'some.provider.com'}} }; @@ -264,6 +264,39 @@ describe('eids array generation for known sub-modules', function() { }); }); + it('sovrn', function() { + const userId = { + sovrn: {'id': 'sample_id'} + }; + const newEids = createEidsArray(userId); + expect(newEids.length).to.equal(1); + expect(newEids[0]).to.deep.equal({ + source: 'liveintent.sovrn.com', + uids: [{ + id: 'sample_id', + atype: 3 + }] + }); + }); + + it('sovrn with ext', function() { + const userId = { + sovrn: {'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: 'liveintent.sovrn.com', + uids: [{ + id: 'sample_id', + atype: 3, + ext: { + provider: 'some.provider.com' + } + }] + }); + }); + it('britepoolId', function() { const userId = { britepoolid: 'some-random-id-value' diff --git a/test/spec/modules/liveIntentIdMinimalSystem_spec.js b/test/spec/modules/liveIntentIdMinimalSystem_spec.js index ddcd164a685..340489da4d0 100644 --- a/test/spec/modules/liveIntentIdMinimalSystem_spec.js +++ b/test/spec/modules/liveIntentIdMinimalSystem_spec.js @@ -261,6 +261,11 @@ describe('LiveIntentMinimalId', function() { expect(result).to.eql({'lipb': {'lipbid': 'foo', 'nonId': 'foo', 'index': 'bar'}, 'index': {'id': 'bar'}}); }); + it('should decode a sovrn id to a seperate object when present', function() { + const result = liveIntentIdSubmodule.decode({ nonId: 'foo', sovrn: 'bar' }); + expect(result).to.eql({'lipb': {'lipbid': 'foo', 'nonId': 'foo', 'sovrn': 'bar'}, 'sovrn': {'id': 'bar'}}); + }); + it('should allow disabling nonId resolution', function() { let callBackSpy = sinon.spy(); let submoduleCallback = liveIntentIdSubmodule.getId({ params: { diff --git a/test/spec/modules/liveIntentIdSystem_spec.js b/test/spec/modules/liveIntentIdSystem_spec.js index 78259a833aa..45b5e5d17f5 100644 --- a/test/spec/modules/liveIntentIdSystem_spec.js +++ b/test/spec/modules/liveIntentIdSystem_spec.js @@ -383,6 +383,11 @@ describe('LiveIntentId', function() { expect(result).to.eql({'lipb': {'lipbid': 'foo', 'nonId': 'foo', 'medianet': 'bar'}, 'medianet': {'id': 'bar'}}); }); + it('should decode a sovrn id to a seperate object when present', function() { + const result = liveIntentIdSubmodule.decode({ nonId: 'foo', sovrn: 'bar' }); + expect(result).to.eql({'lipb': {'lipbid': 'foo', 'nonId': 'foo', 'sovrn': 'bar'}, 'sovrn': {'id': 'bar'}}); + }); + it('should decode a magnite id to a seperate object when present', function() { const result = liveIntentIdSubmodule.decode({ nonId: 'foo', magnite: 'bar' }); expect(result).to.eql({'lipb': {'lipbid': 'foo', 'nonId': 'foo', 'magnite': 'bar'}, 'magnite': {'id': 'bar'}});