Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for sharethrough, sonobi, vidazoo #43

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 48 additions & 0 deletions libraries/liveIntentId/shared.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,18 @@ export function composeIdObject(value) {
delete result.lipb.thetradedesk
}

if (value.sharethrough) {
result.sharethrough = { 'id': value.sharethrough, ext: { provider: LI_PROVIDER_DOMAIN } }
}

if (value.sonobi) {
result.sonobi = { 'id': value.sonobi, ext: { provider: LI_PROVIDER_DOMAIN } }
}

if (value.vidazoo) {
result.vidazoo = { 'id': value.vidazoo, ext: { provider: LI_PROVIDER_DOMAIN } }
}

return result
}

Expand Down Expand Up @@ -199,5 +211,41 @@ export const eids = {
getValue: function(data) {
return data.id;
}
},
'sharethrough': {
source: 'sharethrough.com',
atype: 3,
getValue: function(data) {
return data.id;
},
getUidExt: function(data) {
if (data.ext) {
return data.ext;
}
}
},
'sonobi': {
source: 'liveintent.sonobi.com',
atype: 3,
getValue: function(data) {
return data.id;
},
getUidExt: function(data) {
if (data.ext) {
return data.ext;
}
}
},
'vidazoo': {
source: 'liveintent.vidazoo.com',
atype: 3,
getValue: function(data) {
return data.id;
},
getUidExt: function(data) {
if (data.ext) {
return data.ext;
}
}
}
}
15 changes: 15 additions & 0 deletions test/spec/modules/liveIntentExternalIdSystem_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -416,4 +416,19 @@ describe('LiveIntentExternalId', function() {
type: 'resolve'
})
});

it('should decode a sharethrough id to a separate object when present', function() {
const result = liveIntentExternalIdSubmodule.decode({ nonId: 'foo', sharethrough: 'bar' }, defaultConfigParams);
expect(result).to.eql({'lipb': {'lipbid': 'foo', 'nonId': 'foo', 'sharethrough': 'bar'}, 'sharethrough': {'id': 'bar', 'ext': {'provider': 'liveintent.com'}}});
});

it('should decode a sonobi id to a separate object when present', function() {
const result = liveIntentExternalIdSubmodule.decode({ nonId: 'foo', sonobi: 'bar' }, defaultConfigParams);
expect(result).to.eql({'lipb': {'lipbid': 'foo', 'nonId': 'foo', 'sonobi': 'bar'}, 'sonobi': {'id': 'bar', 'ext': {'provider': 'liveintent.com'}}});
});

it('should decode a vidazoo id to a separate object when present', function() {
const result = liveIntentExternalIdSubmodule.decode({ nonId: 'foo', vidazoo: 'bar' }, defaultConfigParams);
expect(result).to.eql({'lipb': {'lipbid': 'foo', 'nonId': 'foo', 'vidazoo': 'bar'}, 'vidazoo': {'id': 'bar', 'ext': {'provider': 'liveintent.com'}}});
});
});
15 changes: 15 additions & 0 deletions test/spec/modules/liveIntentIdMinimalSystem_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -313,4 +313,19 @@ describe('LiveIntentMinimalId', function() {
);
expect(callBackSpy.calledOnce).to.be.true;
});

it('should decode a sharethrough id to a separate object when present', function() {
const result = liveIntentIdSubmodule.decode({ nonId: 'foo', sharethrough: 'bar' });
expect(result).to.eql({'lipb': {'lipbid': 'foo', 'nonId': 'foo', 'sharethrough': 'bar'}, 'sharethrough': {'id': 'bar', 'ext': {'provider': 'liveintent.com'}}});
});

it('should decode a sonobi id to a separate object when present', function() {
const result = liveIntentIdSubmodule.decode({ nonId: 'foo', sonobi: 'bar' });
expect(result).to.eql({'lipb': {'lipbid': 'foo', 'nonId': 'foo', 'sonobi': 'bar'}, 'sonobi': {'id': 'bar', 'ext': {'provider': 'liveintent.com'}}});
});

it('should decode a vidazoo id to a separate object when present', function() {
const result = liveIntentIdSubmodule.decode({ nonId: 'foo', vidazoo: 'bar' });
expect(result).to.eql({'lipb': {'lipbid': 'foo', 'nonId': 'foo', 'vidazoo': 'bar'}, 'vidazoo': {'id': 'bar', 'ext': {'provider': 'liveintent.com'}}});
});
});
114 changes: 114 additions & 0 deletions test/spec/modules/liveIntentIdSystem_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -511,6 +511,21 @@ describe('LiveIntentId', function() {
});
});

it('should decode a sharethrough id to a separate object when present', function() {
const result = liveIntentIdSubmodule.decode({ nonId: 'foo', sharethrough: 'bar' }, { params: defaultConfigParams });
expect(result).to.eql({'lipb': {'lipbid': 'foo', 'nonId': 'foo', 'sharethrough': 'bar'}, 'sharethrough': {'id': 'bar', 'ext': {'provider': 'liveintent.com'}}});
});

it('should decode a sonobi id to a separate object when present', function() {
const result = liveIntentIdSubmodule.decode({ nonId: 'foo', sonobi: 'bar' }, { params: defaultConfigParams });
expect(result).to.eql({'lipb': {'lipbid': 'foo', 'nonId': 'foo', 'sonobi': 'bar'}, 'sonobi': {'id': 'bar', 'ext': {'provider': 'liveintent.com'}}});
});

it('should decode a vidazoo id to a separate object when present', function() {
const result = liveIntentIdSubmodule.decode({ nonId: 'foo', vidazoo: 'bar' }, { params: defaultConfigParams });
expect(result).to.eql({'lipb': {'lipbid': 'foo', 'nonId': 'foo', 'vidazoo': 'bar'}, 'vidazoo': {'id': 'bar', 'ext': {'provider': 'liveintent.com'}}});
});

describe('eid', () => {
before(() => {
attachIdSystem(liveIntentIdSubmodule);
Expand Down Expand Up @@ -785,5 +800,104 @@ describe('LiveIntentId', function() {
uids: [{id: 'some-random-id-value', atype: 3}]
});
});

it('sharethrough', function () {
const userId = {
sharethrough: { 'id': 'sample_id' }
};
const newEids = createEidsArray(userId);
expect(newEids.length).to.equal(1);
expect(newEids[0]).to.deep.equal({
source: 'sharethrough.com',
uids: [{
id: 'sample_id',
atype: 3
}]
});
});

it('sharethrough with ext', function () {
const userId = {
sharethrough: { '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: 'sharethrough.com',
uids: [{
id: 'sample_id',
atype: 3,
ext: {
provider: 'some.provider.com'
}
}]
});
});

it('sonobi', function () {
const userId = {
sonobi: { 'id': 'sample_id' }
};
const newEids = createEidsArray(userId);
expect(newEids.length).to.equal(1);
expect(newEids[0]).to.deep.equal({
source: 'liveintent.sonobi.com',
uids: [{
id: 'sample_id',
atype: 3
}]
});
});

it('sonobi with ext', function () {
const userId = {
sonobi: { '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.sonobi.com',
uids: [{
id: 'sample_id',
atype: 3,
ext: {
provider: 'some.provider.com'
}
}]
});
});

it('vidazoo', function () {
const userId = {
vidazoo: { 'id': 'sample_id' }
};
const newEids = createEidsArray(userId);
expect(newEids.length).to.equal(1);
expect(newEids[0]).to.deep.equal({
source: 'liveintent.vidazoo.com',
uids: [{
id: 'sample_id',
atype: 3
}]
});
});

it('vidazoo with ext', function () {
const userId = {
vidazoo: { '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.vidazoo.com',
uids: [{
id: 'sample_id',
atype: 3,
ext: {
provider: 'some.provider.com'
}
}]
});
});
})
})