prebid.js 9.52.0 → 9.53.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.circleci/config.yml +27 -4
- package/creative/crossDomain.js +4 -2
- package/dist/33acrossAnalyticsAdapter.js +1 -1
- package/dist/33acrossBidAdapter.js +1 -1
- package/dist/33acrossIdSystem.js +1 -1
- package/dist/BTBidAdapter.js +1 -1
- package/dist/adagioAnalyticsAdapter.js +1 -1
- package/dist/adagioBidAdapter.js +1 -1
- package/dist/adagioUtils.js +1 -1
- package/dist/addefendBidAdapter.js +1 -1
- package/dist/adgenerationBidAdapter.js +1 -1
- package/dist/adlooxRtdProvider.js +1 -1
- package/dist/adqueryBidAdapter.js +1 -1
- package/dist/adrelevantisBidAdapter.js +1 -1
- package/dist/adstirBidAdapter.js +1 -1
- package/dist/adtrgtmeBidAdapter.js +1 -1
- package/dist/adxcgAnalyticsAdapter.js +1 -1
- package/dist/adxcgBidAdapter.js +1 -1
- package/dist/adyoulikeBidAdapter.js +1 -1
- package/dist/agmaAnalyticsAdapter.js +1 -1
- package/dist/ajaBidAdapter.js +1 -1
- package/dist/amxBidAdapter.js +1 -1
- package/dist/amxIdSystem.js +1 -1
- package/dist/aniviewBidAdapter.js +1 -1
- package/dist/appierAnalyticsAdapter.js +1 -1
- package/dist/appnexusBidAdapter.js +1 -1
- package/dist/asoBidAdapter.js +1 -1
- package/dist/axonixBidAdapter.js +1 -1
- package/dist/beopBidAdapter.js +1 -1
- package/dist/bidglassBidAdapter.js +1 -1
- package/dist/big-richmediaBidAdapter.js +1 -1
- package/dist/bitmediaBidAdapter.js +1 -1
- package/dist/bridBidAdapter.js +1 -1
- package/dist/bridgeuppBidAdapter.js +1 -1
- package/dist/bridgewellBidAdapter.js +1 -1
- package/dist/brightMountainMediaBidAdapter.js +1 -1
- package/dist/carodaBidAdapter.js +1 -1
- package/dist/chromeAiRtdProvider.js +1 -0
- package/dist/chtnwBidAdapter.js +1 -1
- package/dist/chunk-core.js +1 -1
- package/dist/concertBidAdapter.js +1 -1
- package/dist/connectadBidAdapter.js +1 -1
- package/dist/consumableBidAdapter.js +1 -1
- package/dist/contxtfulBidAdapter.js +1 -1
- package/dist/conversantAnalyticsAdapter.js +1 -1
- package/dist/conversantBidAdapter.js +1 -1
- package/dist/craftBidAdapter.js +1 -1
- package/dist/criteoBidAdapter.js +1 -1
- package/dist/cwireBidAdapter.js +1 -1
- package/dist/dailymotionBidAdapter.js +1 -1
- package/dist/debugging-standalone.js +1 -1
- package/dist/dependencies.json +10 -2
- package/dist/dspxBidAdapter.js +1 -1
- package/dist/dxkultureBidAdapter.js +1 -1
- package/dist/eplanningBidAdapter.js +1 -1
- package/dist/equativBidAdapter.js +1 -1
- package/dist/eskimiBidAdapter.js +1 -1
- package/dist/euidIdSystem.js +1 -1
- package/dist/exadsBidAdapter.js +1 -1
- package/dist/excoBidAdapter.js +1 -1
- package/dist/fanAdapter.js +1 -1
- package/dist/feedadBidAdapter.js +1 -1
- package/dist/finativeBidAdapter.js +1 -1
- package/dist/freewheel-sspBidAdapter.js +1 -1
- package/dist/gmosspBidAdapter.js +1 -1
- package/dist/greenbidsAnalyticsAdapter.js +1 -1
- package/dist/greenbidsBidAdapter.js +1 -1
- package/dist/greenbidsRtdProvider.js +1 -1
- package/dist/gridBidAdapter.js +1 -1
- package/dist/gumgumBidAdapter.js +1 -1
- package/dist/h12mediaBidAdapter.js +1 -1
- package/dist/hypelabBidAdapter.js +1 -1
- package/dist/id5AnalyticsAdapter.js +1 -1
- package/dist/id5IdSystem.js +1 -1
- package/dist/imdsBidAdapter.js +1 -1
- package/dist/improvedigitalBidAdapter.js +1 -1
- package/dist/inmobiBidAdapter.js +1 -1
- package/dist/insticatorBidAdapter.js +1 -1
- package/dist/intentIqAnalyticsAdapter.js +1 -1
- package/dist/ixBidAdapter.js +1 -1
- package/dist/jixieBidAdapter.js +1 -1
- package/dist/jixieIdSystem.js +1 -0
- package/dist/justpremiumBidAdapter.js +1 -1
- package/dist/kargoBidAdapter.js +1 -1
- package/dist/kimberliteBidAdapter.js +1 -1
- package/dist/konduitAnalyticsAdapter.js +1 -1
- package/dist/kueezBidAdapter.js +1 -1
- package/dist/lassoBidAdapter.js +1 -1
- package/dist/lifestreetBidAdapter.js +1 -1
- package/dist/liveIntentId.js +1 -1
- package/dist/logicadBidAdapter.js +1 -1
- package/dist/loglyliftBidAdapter.js +1 -1
- package/dist/luceadBidAdapter.js +1 -1
- package/dist/mabidderBidAdapter.js +1 -1
- package/dist/madsenseBidAdapter.js +1 -1
- package/dist/magniteAnalyticsAdapter.js +1 -1
- package/dist/malltvAnalyticsAdapter.js +1 -1
- package/dist/marsmediaBidAdapter.js +1 -1
- package/dist/mediafuseBidAdapter.js +1 -1
- package/dist/medianetBidAdapter.js +1 -1
- package/dist/medianetUtils.js +1 -1
- package/dist/mediasquareBidAdapter.js +1 -1
- package/dist/mgidBidAdapter.js +1 -1
- package/dist/missenaBidAdapter.js +1 -1
- package/dist/mobilefuseBidAdapter.js +1 -1
- package/dist/nextMillenniumBidAdapter.js +1 -1
- package/dist/nexx360Utils.js +1 -1
- package/dist/nobidAnalyticsAdapter.js +1 -1
- package/dist/nobidBidAdapter.js +1 -1
- package/dist/nodalsAiRtdProvider.js +1 -1
- package/dist/not-for-prod/prebid.js +175 -173
- package/dist/oguryBidAdapter.js +1 -1
- package/dist/onetagBidAdapter.js +1 -1
- package/dist/ooloAnalyticsAdapter.js +1 -1
- package/dist/openxBidAdapter.js +1 -1
- package/dist/optidigitalBidAdapter.js +1 -1
- package/dist/orbidderBidAdapter.js +1 -1
- package/dist/ortb2.5Translator.js +1 -1
- package/dist/outbrainBidAdapter.js +1 -1
- package/dist/ozoneBidAdapter.js +1 -1
- package/dist/pixfutureBidAdapter.js +1 -1
- package/dist/prebidServerBidAdapter.js +1 -1
- package/dist/publinkIdSystem.js +1 -1
- package/dist/pubmaticAnalyticsAdapter.js +1 -1
- package/dist/pubmaticBidAdapter.js +1 -1
- package/dist/pubmaticRtdProvider.js +1 -1
- package/dist/pubwiseAnalyticsAdapter.js +1 -1
- package/dist/pubxaiAnalyticsAdapter.js +1 -1
- package/dist/pxyzBidAdapter.js +1 -1
- package/dist/quantcastBidAdapter.js +1 -1
- package/dist/readpeakBidAdapter.js +1 -1
- package/dist/relaidoBidAdapter.js +1 -1
- package/dist/relevatehealthBidAdapter.js +1 -1
- package/dist/retailspotBidAdapter.js +1 -1
- package/dist/rhythmoneBidAdapter.js +1 -1
- package/dist/riseUtils.js +1 -1
- package/dist/rubiconBidAdapter.js +1 -1
- package/dist/seedingAllianceBidAdapter.js +1 -1
- package/dist/seedtagBidAdapter.js +1 -1
- package/dist/sharethroughAnalyticsAdapter.js +1 -1
- package/dist/sharethroughBidAdapter.js +1 -1
- package/dist/showheroes-bsBidAdapter.js +1 -1
- package/dist/smaatoBidAdapter.js +1 -1
- package/dist/smartadserverBidAdapter.js +1 -1
- package/dist/smartxBidAdapter.js +1 -1
- package/dist/smilewantedBidAdapter.js +1 -1
- package/dist/snigelBidAdapter.js +1 -1
- package/dist/sonobiBidAdapter.js +1 -1
- package/dist/sovrnBidAdapter.js +1 -1
- package/dist/sparteoBidAdapter.js +1 -1
- package/dist/sspBCBidAdapter.js +1 -1
- package/dist/stvBidAdapter.js +1 -1
- package/dist/sublimeBidAdapter.js +1 -1
- package/dist/taboolaBidAdapter.js +1 -1
- package/dist/tappxBidAdapter.js +1 -1
- package/dist/targetVideoBidAdapter.js +1 -1
- package/dist/teadsBidAdapter.js +1 -1
- package/dist/terceptAnalyticsAdapter.js +1 -1
- package/dist/themoneytizerBidAdapter.js +1 -1
- package/dist/trionBidAdapter.js +1 -1
- package/dist/tripleliftBidAdapter.js +1 -1
- package/dist/ttdBidAdapter.js +1 -1
- package/dist/ucfunnelAnalyticsAdapter.js +1 -1
- package/dist/uid2IdSystem.js +1 -1
- package/dist/underdogmediaBidAdapter.js +1 -1
- package/dist/undertoneBidAdapter.js +1 -1
- package/dist/unrulyBidAdapter.js +1 -1
- package/dist/userId.js +1 -1
- package/dist/vidazooUtils.js +1 -1
- package/dist/videobyteBidAdapter.js +1 -1
- package/dist/visxBidAdapter.js +1 -1
- package/dist/vuukleBidAdapter.js +1 -1
- package/dist/widespaceBidAdapter.js +1 -1
- package/dist/winrBidAdapter.js +1 -1
- package/dist/yahooAdsBidAdapter.js +1 -1
- package/dist/yandexBidAdapter.js +1 -1
- package/dist/yieldmoBidAdapter.js +1 -1
- package/dist/yieldoneAnalyticsAdapter.js +1 -1
- package/gulpfile.js +12 -6
- package/integrationExamples/chromeai/japanese.html +224 -0
- package/integrationExamples/gpt/x-domain/creative.html +1 -1
- package/karma.conf.maker.js +7 -7
- package/karmaRunner.js +3 -3
- package/libraries/liveIntentId/shared.js +16 -0
- package/modules/.submodules.json +1 -0
- package/modules/aniviewBidAdapter.js +32 -23
- package/modules/chromeAiRtdProvider.js +421 -0
- package/modules/chromeAiRtdProvider.md +230 -0
- package/modules/fanAdapter.js +318 -124
- package/modules/ixBidAdapter.js +5 -0
- package/modules/jixieIdSystem.js +186 -0
- package/modules/ozoneBidAdapter.js +214 -336
- package/modules/prebidServerBidAdapter/index.js +59 -35
- package/modules/pubmaticRtdProvider.js +418 -4
- package/modules/pubmaticRtdProvider.md +12 -2
- package/modules/relevatehealthBidAdapter.js +20 -130
- package/modules/relevatehealthBidAdapter.md +1 -2
- package/modules/sovrnBidAdapter.js +4 -4
- package/modules/teadsBidAdapter.js +5 -0
- package/modules/ttdBidAdapter.js +5 -4
- package/modules/userId/index.js +30 -31
- package/package.json +5 -4
- package/src/adapterManager.js +3 -0
- package/test/spec/libraries/cmUtils_spec.js +17 -12
- package/test/spec/modules/aniviewBidAdapter_spec.js +15 -2
- package/test/spec/modules/chromeAiRtdProvider_spec.js +393 -0
- package/test/spec/modules/dgkeywordRtdProvider_spec.js +5 -2
- package/test/spec/modules/euidIdSystem_spec.js +9 -3
- package/test/spec/modules/fanAdapter_spec.js +264 -268
- package/test/spec/modules/id5IdSystem_spec.js +57 -101
- package/test/spec/modules/identityLinkIdSystem_spec.js +1 -0
- package/test/spec/modules/idxIdSystem_spec.js +2 -75
- package/test/spec/modules/instreamTracking_spec.js +15 -18
- package/test/spec/modules/ixBidAdapter_spec.js +26 -0
- package/test/spec/modules/jixieIdSystem_spec.js +303 -0
- package/test/spec/modules/liveIntentExternalIdSystem_spec.js +5 -0
- package/test/spec/modules/liveIntentIdMinimalSystem_spec.js +5 -0
- package/test/spec/modules/liveIntentIdSystem_spec.js +38 -0
- package/test/spec/modules/lmpIdSystem_spec.js +2 -81
- package/test/spec/modules/ozoneBidAdapter_spec.js +511 -658
- package/test/spec/modules/prebidServerBidAdapter_spec.js +72 -2
- package/test/spec/modules/pubmaticBidAdapter_spec.js +411 -126
- package/test/spec/modules/pubmaticRtdProvider_spec.js +946 -2
- package/test/spec/modules/raynRtdProvider_spec.js +18 -22
- package/test/spec/modules/relevatehealthBidAdapter_spec.js +9 -39
- package/test/spec/modules/sharedIdSystem_spec.js +3 -3
- package/test/spec/modules/sovrnBidAdapter_spec.js +71 -3
- package/test/spec/modules/teadsBidAdapter_spec.js +9 -4
- package/test/spec/modules/ttdBidAdapter_spec.js +24 -2
- package/test/spec/modules/uid2IdSystem_helpers.js +5 -2
- package/test/spec/modules/userId_spec.js +142 -387
- package/test/spec/modules/yieldoneAnalyticsAdapter_spec.js +13 -12
- package/test/spec/modules/zeotapIdPlusIdSystem_spec.js +3 -69
- package/wdio.shared.conf.js +2 -2
- package/CLAUDE.md +0 -1
|
@@ -0,0 +1,303 @@
|
|
|
1
|
+
import { expect } from 'chai';
|
|
2
|
+
import { jixieIdSubmodule, storage } from 'modules/jixieIdSystem.js';
|
|
3
|
+
import { server } from '../../mocks/xhr';
|
|
4
|
+
import {parseUrl} from '../../../src/utils';
|
|
5
|
+
|
|
6
|
+
const COOKIE_EXPIRATION_FUTURE = (new Date(Date.now() + 60 * 60 * 24 * 1000)).toUTCString();
|
|
7
|
+
const COOKIE_EXPIRATION_PAST = (new Date(Date.now() - 60 * 60 * 24 * 1000)).toUTCString();
|
|
8
|
+
|
|
9
|
+
describe('JixieId Submodule', () => {
|
|
10
|
+
const SERVER_HOST = 'traid.jixie.io';
|
|
11
|
+
const SERVER_PATH = '/api/usersyncpbjs';
|
|
12
|
+
const CLIENTID1 = '822bc904-249b-11f0-9cd2-0242ac120002';
|
|
13
|
+
const CLIENTID2 = '822bc904-249b-11f0-9cd2-0242ac120003';
|
|
14
|
+
const IDLOG1 = '1745845981000_abc';
|
|
15
|
+
const IDLOG_VALID = `${Date.now() + 60 * 60 * 24 * 1000}_abc`;
|
|
16
|
+
const IDLOG_EXPIRED = `${Date.now() - 1000}_abc`;
|
|
17
|
+
const ACCOUNTID = 'abcdefg';
|
|
18
|
+
const STD_JXID_KEY = '_jxx';
|
|
19
|
+
const PBJS_JXID_KEY = 'pbjx_jxx';
|
|
20
|
+
const PBJS_IDLOGSTR_KEY = 'pbjx_idlog';
|
|
21
|
+
const MOCK_CONSENT_STRING = 'myconsentstring';
|
|
22
|
+
const EID_TYPE1_PARAMNAME = 'somesha1';
|
|
23
|
+
const EID_TYPE2_PARAMNAME = 'somesha2';
|
|
24
|
+
const EID_TYPE1_COOKIENAME = 'somesha1cookie';
|
|
25
|
+
const EID_TYPE2_LSNAME = 'somesha2ls';
|
|
26
|
+
const EID_TYPE1_SAMPLEVALUE = 'pppppppppp';
|
|
27
|
+
const EID_TYPE2_SAMPLEVALUE = 'eeeeeeeeee';
|
|
28
|
+
|
|
29
|
+
it('should have the correct module name declared', () => {
|
|
30
|
+
expect(jixieIdSubmodule.name).to.equal('jixieId');
|
|
31
|
+
});
|
|
32
|
+
describe('decode', () => {
|
|
33
|
+
it('should respond with an object with clientid key containing the value', () => {
|
|
34
|
+
expect(jixieIdSubmodule.decode(CLIENTID1)).to.deep.equal({
|
|
35
|
+
jixieId: CLIENTID1
|
|
36
|
+
});
|
|
37
|
+
});
|
|
38
|
+
it('should respond with undefined if the value is not a string', () => {
|
|
39
|
+
[1, null, undefined, NaN, [], {}].forEach((value) => {
|
|
40
|
+
expect(jixieIdSubmodule.decode(value)).to.equal(undefined);
|
|
41
|
+
});
|
|
42
|
+
});
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
describe('getId()', () => {
|
|
46
|
+
describe('getId', () => {
|
|
47
|
+
context('when there is jixie_o in the window object (jx script on site)', () => {
|
|
48
|
+
context('when there is _jxx in the cookie', () => {
|
|
49
|
+
it('should return callback with the clientid in that cookie', () => {
|
|
50
|
+
window.jixie_o = {};
|
|
51
|
+
storage.setCookie(STD_JXID_KEY, CLIENTID1, COOKIE_EXPIRATION_FUTURE);
|
|
52
|
+
const completeCallback = sinon.spy();
|
|
53
|
+
const { callback } = jixieIdSubmodule.getId({
|
|
54
|
+
params: {
|
|
55
|
+
stdjxidckname: STD_JXID_KEY,
|
|
56
|
+
pubExtIds: [
|
|
57
|
+
{pname: EID_TYPE1_PARAMNAME, ckname: EID_TYPE1_COOKIENAME},
|
|
58
|
+
{pname: EID_TYPE2_PARAMNAME, lsname: EID_TYPE2_LSNAME}
|
|
59
|
+
]
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
callback(completeCallback);
|
|
63
|
+
const [request] = server.requests;
|
|
64
|
+
|
|
65
|
+
expect(request).to.be.undefined;
|
|
66
|
+
expect(completeCallback.calledOnceWithExactly(CLIENTID1)).to.be.true;
|
|
67
|
+
storage.setCookie(STD_JXID_KEY, '', COOKIE_EXPIRATION_PAST);
|
|
68
|
+
window.jixie_o = undefined;
|
|
69
|
+
})
|
|
70
|
+
})
|
|
71
|
+
context('when there is no _jxx in the cookie', () => {
|
|
72
|
+
it('should return callback with null', () => {
|
|
73
|
+
window.jixie_o = {};
|
|
74
|
+
const completeCallback = sinon.spy();
|
|
75
|
+
const { callback } = jixieIdSubmodule.getId({
|
|
76
|
+
params: {
|
|
77
|
+
stdjxidckname: STD_JXID_KEY,
|
|
78
|
+
pubExtIds: [
|
|
79
|
+
{pname: EID_TYPE1_PARAMNAME, ckname: EID_TYPE1_COOKIENAME},
|
|
80
|
+
{pname: EID_TYPE2_PARAMNAME, lsname: EID_TYPE2_LSNAME}
|
|
81
|
+
]
|
|
82
|
+
}
|
|
83
|
+
});
|
|
84
|
+
callback(completeCallback);
|
|
85
|
+
const [request] = server.requests;
|
|
86
|
+
expect(request).to.be.undefined;
|
|
87
|
+
expect(completeCallback.calledOnceWithExactly(null)).to.be.true;
|
|
88
|
+
window.jixie_o = undefined;
|
|
89
|
+
})
|
|
90
|
+
})
|
|
91
|
+
})
|
|
92
|
+
|
|
93
|
+
context('when there is no jixie_o in the window object', () => {
|
|
94
|
+
context('when there is no pbjs jixie cookie', () => {
|
|
95
|
+
it('should call the server and set the id', () => {
|
|
96
|
+
const completeCallback = sinon.spy();
|
|
97
|
+
const { callback } = jixieIdSubmodule.getId({
|
|
98
|
+
params: {
|
|
99
|
+
stdjxidckname: STD_JXID_KEY,
|
|
100
|
+
pubExtIds: [
|
|
101
|
+
{pname: EID_TYPE1_PARAMNAME, ckname: EID_TYPE1_COOKIENAME},
|
|
102
|
+
{pname: EID_TYPE2_PARAMNAME, lsname: EID_TYPE2_LSNAME}
|
|
103
|
+
]
|
|
104
|
+
}
|
|
105
|
+
});
|
|
106
|
+
callback(completeCallback);
|
|
107
|
+
const [request] = server.requests;
|
|
108
|
+
request.respond(200, {
|
|
109
|
+
'Content-Type': 'application/json'
|
|
110
|
+
}, JSON.stringify({
|
|
111
|
+
data: {
|
|
112
|
+
success: true,
|
|
113
|
+
client_id: CLIENTID1,
|
|
114
|
+
idlog: IDLOG1
|
|
115
|
+
}
|
|
116
|
+
}));
|
|
117
|
+
expect(completeCallback.calledOnceWithExactly(CLIENTID1)).to.be.true;
|
|
118
|
+
});
|
|
119
|
+
|
|
120
|
+
it('should call the server and set the id. HERE we check all params to server in detail as more parameters since more was found in cookie', () => {
|
|
121
|
+
storage.setCookie(EID_TYPE1_COOKIENAME, EID_TYPE1_SAMPLEVALUE, COOKIE_EXPIRATION_FUTURE)
|
|
122
|
+
storage.setDataInLocalStorage(EID_TYPE2_LSNAME, EID_TYPE2_SAMPLEVALUE);
|
|
123
|
+
|
|
124
|
+
const completeCallback = sinon.spy();
|
|
125
|
+
const { callback } = jixieIdSubmodule.getId({
|
|
126
|
+
params: {
|
|
127
|
+
accountid: ACCOUNTID,
|
|
128
|
+
pubExtIds: [
|
|
129
|
+
{pname: EID_TYPE1_PARAMNAME, ckname: EID_TYPE1_COOKIENAME},
|
|
130
|
+
{pname: EID_TYPE2_PARAMNAME, lsname: EID_TYPE2_LSNAME}
|
|
131
|
+
]
|
|
132
|
+
}
|
|
133
|
+
});
|
|
134
|
+
callback(completeCallback);
|
|
135
|
+
const [request] = server.requests;
|
|
136
|
+
request.respond(200, {
|
|
137
|
+
'Content-Type': 'application/json'
|
|
138
|
+
}, JSON.stringify({
|
|
139
|
+
data: {
|
|
140
|
+
success: true,
|
|
141
|
+
client_id: CLIENTID1,
|
|
142
|
+
idlog: IDLOG1
|
|
143
|
+
}
|
|
144
|
+
}));
|
|
145
|
+
const parsed = parseUrl(request.url);
|
|
146
|
+
expect(parsed.hostname).to.equal(SERVER_HOST);
|
|
147
|
+
expect(parsed.pathname).to.equal(SERVER_PATH);
|
|
148
|
+
expect(parsed.search[EID_TYPE1_PARAMNAME]).to.equal(EID_TYPE1_SAMPLEVALUE);
|
|
149
|
+
expect(parsed.search[EID_TYPE2_PARAMNAME]).to.equal(EID_TYPE2_SAMPLEVALUE);
|
|
150
|
+
expect(request.method).to.equal('GET');
|
|
151
|
+
expect(request.withCredentials).to.be.true;
|
|
152
|
+
|
|
153
|
+
expect(completeCallback.calledOnceWithExactly(CLIENTID1)).to.be.true;
|
|
154
|
+
storage.setCookie(EID_TYPE1_COOKIENAME, EID_TYPE1_SAMPLEVALUE, COOKIE_EXPIRATION_PAST)
|
|
155
|
+
storage.setDataInLocalStorage(EID_TYPE2_LSNAME, '');
|
|
156
|
+
});
|
|
157
|
+
|
|
158
|
+
it('should call the server and set the id and when telcocp (fire-n-forget) is given then that should be called too', () => {
|
|
159
|
+
const completeCallback = sinon.spy();
|
|
160
|
+
const { callback } = jixieIdSubmodule.getId({
|
|
161
|
+
params: {
|
|
162
|
+
stdjxidckname: STD_JXID_KEY,
|
|
163
|
+
pubExtIds: [
|
|
164
|
+
{pname: EID_TYPE1_PARAMNAME, ckname: EID_TYPE1_COOKIENAME},
|
|
165
|
+
{pname: EID_TYPE2_PARAMNAME, lsname: EID_TYPE2_LSNAME}
|
|
166
|
+
]
|
|
167
|
+
}
|
|
168
|
+
});
|
|
169
|
+
callback(completeCallback);
|
|
170
|
+
const [request] = server.requests;
|
|
171
|
+
request.respond(200, {
|
|
172
|
+
'Content-Type': 'application/json'
|
|
173
|
+
}, JSON.stringify({
|
|
174
|
+
data: {
|
|
175
|
+
success: true,
|
|
176
|
+
client_id: CLIENTID1,
|
|
177
|
+
idlog: IDLOG1,
|
|
178
|
+
telcoep: 'https://www.telcoep.com/xxx'
|
|
179
|
+
}
|
|
180
|
+
}));
|
|
181
|
+
expect(server.requests.length).to.equal(2);
|
|
182
|
+
expect(server.requests[1].url).to.equal('https://www.telcoep.com/xxx');
|
|
183
|
+
server.requests[1].respond(200, {
|
|
184
|
+
'Content-Type': 'application/json'
|
|
185
|
+
}, JSON.stringify({
|
|
186
|
+
data: {
|
|
187
|
+
success: true
|
|
188
|
+
}
|
|
189
|
+
}));
|
|
190
|
+
});
|
|
191
|
+
});
|
|
192
|
+
context('when has rather fresh pbjs jixie cookie', () => {
|
|
193
|
+
it('should not call the server ; just return the id', () => {
|
|
194
|
+
storage.setCookie(PBJS_JXID_KEY, CLIENTID1, COOKIE_EXPIRATION_FUTURE)
|
|
195
|
+
storage.setCookie(PBJS_IDLOGSTR_KEY, IDLOG_VALID, COOKIE_EXPIRATION_FUTURE)
|
|
196
|
+
|
|
197
|
+
const setCookieStub = sinon.stub(storage, 'setCookie');
|
|
198
|
+
const completeCallback = sinon.spy();
|
|
199
|
+
const { callback } = jixieIdSubmodule.getId({
|
|
200
|
+
params: {
|
|
201
|
+
stdjxidckname: STD_JXID_KEY,
|
|
202
|
+
pubExtIds: [
|
|
203
|
+
{pname: EID_TYPE1_PARAMNAME, ckname: EID_TYPE1_COOKIENAME},
|
|
204
|
+
{pname: EID_TYPE2_PARAMNAME, lsname: EID_TYPE2_LSNAME}
|
|
205
|
+
]
|
|
206
|
+
}
|
|
207
|
+
});
|
|
208
|
+
callback(completeCallback);
|
|
209
|
+
const [request] = server.requests;
|
|
210
|
+
expect(setCookieStub.neverCalledWith(PBJS_JXID_KEY)).to.be.true;
|
|
211
|
+
expect(completeCallback.calledOnceWithExactly(CLIENTID1)).to.be.true;
|
|
212
|
+
expect(request).to.be.undefined;
|
|
213
|
+
setCookieStub.restore();
|
|
214
|
+
storage.setCookie(PBJS_JXID_KEY, CLIENTID1, COOKIE_EXPIRATION_PAST)
|
|
215
|
+
storage.setCookie(PBJS_IDLOGSTR_KEY, IDLOG_VALID, COOKIE_EXPIRATION_PAST)
|
|
216
|
+
})
|
|
217
|
+
});
|
|
218
|
+
context('when has rather stale pbjs jixie cookie', () => {
|
|
219
|
+
it('should call the server and set the id; send available extra info (e.g. esha,psha, consent if available)', () => {
|
|
220
|
+
const consentData = {gdpr: {gdprApplies: 1, consentString: MOCK_CONSENT_STRING}};
|
|
221
|
+
storage.setCookie(PBJS_JXID_KEY, CLIENTID1, COOKIE_EXPIRATION_FUTURE)
|
|
222
|
+
storage.setCookie(PBJS_IDLOGSTR_KEY, IDLOG_EXPIRED, COOKIE_EXPIRATION_FUTURE)
|
|
223
|
+
storage.setCookie(EID_TYPE1_COOKIENAME, EID_TYPE1_SAMPLEVALUE, COOKIE_EXPIRATION_FUTURE)
|
|
224
|
+
storage.setDataInLocalStorage(EID_TYPE2_LSNAME, EID_TYPE2_SAMPLEVALUE);
|
|
225
|
+
|
|
226
|
+
const setCookieStub = sinon.stub(storage, 'setCookie');
|
|
227
|
+
const completeCallback = sinon.spy();
|
|
228
|
+
const { callback } = jixieIdSubmodule.getId({
|
|
229
|
+
params: {
|
|
230
|
+
stdjxidckname: STD_JXID_KEY,
|
|
231
|
+
pubExtIds: [
|
|
232
|
+
{pname: EID_TYPE1_PARAMNAME, ckname: EID_TYPE1_COOKIENAME},
|
|
233
|
+
{pname: EID_TYPE2_PARAMNAME, lsname: EID_TYPE2_LSNAME}
|
|
234
|
+
]
|
|
235
|
+
}
|
|
236
|
+
}, consentData);
|
|
237
|
+
callback(completeCallback);
|
|
238
|
+
|
|
239
|
+
const [request] = server.requests;
|
|
240
|
+
request.respond(200, {
|
|
241
|
+
'Content-Type': 'application/json'
|
|
242
|
+
}, JSON.stringify({
|
|
243
|
+
data: {
|
|
244
|
+
success: true,
|
|
245
|
+
client_id: CLIENTID2,
|
|
246
|
+
idlog: IDLOG1
|
|
247
|
+
},
|
|
248
|
+
expires: Date.now()
|
|
249
|
+
}));
|
|
250
|
+
|
|
251
|
+
const parsed = parseUrl(request.url);
|
|
252
|
+
expect(parsed.hostname).to.equal(SERVER_HOST);
|
|
253
|
+
expect(parsed.pathname).to.equal(SERVER_PATH);
|
|
254
|
+
expect(parsed.search.client_id).to.equal(CLIENTID1);
|
|
255
|
+
expect(parsed.search.idlog).to.equal(IDLOG_EXPIRED);
|
|
256
|
+
expect(parsed.search[EID_TYPE1_PARAMNAME]).to.equal(EID_TYPE1_SAMPLEVALUE);
|
|
257
|
+
expect(parsed.search[EID_TYPE2_PARAMNAME]).to.equal(EID_TYPE2_SAMPLEVALUE);
|
|
258
|
+
expect(parsed.search.gdpr_consent).to.equal(MOCK_CONSENT_STRING);
|
|
259
|
+
expect(request.method).to.equal('GET');
|
|
260
|
+
expect(request.withCredentials).to.be.true;
|
|
261
|
+
expect(setCookieStub.calledWith(PBJS_JXID_KEY, CLIENTID2, sinon.match.string)).to.be.true;
|
|
262
|
+
expect(setCookieStub.calledWith(PBJS_IDLOGSTR_KEY, IDLOG1, sinon.match.string)).to.be.true;
|
|
263
|
+
expect(completeCallback.calledOnceWithExactly(CLIENTID2)).to.be.true;
|
|
264
|
+
|
|
265
|
+
setCookieStub.restore();
|
|
266
|
+
storage.setCookie(PBJS_JXID_KEY, CLIENTID1, COOKIE_EXPIRATION_PAST);
|
|
267
|
+
storage.setCookie(PBJS_IDLOGSTR_KEY, IDLOG_EXPIRED, COOKIE_EXPIRATION_PAST);
|
|
268
|
+
storage.setCookie(EID_TYPE1_COOKIENAME, EID_TYPE1_SAMPLEVALUE, COOKIE_EXPIRATION_PAST)
|
|
269
|
+
storage.setDataInLocalStorage(EID_TYPE2_LSNAME, '');
|
|
270
|
+
});
|
|
271
|
+
});
|
|
272
|
+
|
|
273
|
+
context('when has corrupted idlog cookie', () => {
|
|
274
|
+
it('should still call the server even though thre is a pbs jixie id', () => {
|
|
275
|
+
storage.setCookie(PBJS_JXID_KEY, CLIENTID1, COOKIE_EXPIRATION_FUTURE)
|
|
276
|
+
storage.setCookie(PBJS_IDLOGSTR_KEY, 'junk', COOKIE_EXPIRATION_FUTURE)
|
|
277
|
+
const completeCallback = sinon.spy();
|
|
278
|
+
const { callback } = jixieIdSubmodule.getId({
|
|
279
|
+
params: {
|
|
280
|
+
accountid: ACCOUNTID
|
|
281
|
+
}
|
|
282
|
+
});
|
|
283
|
+
callback(completeCallback);
|
|
284
|
+
|
|
285
|
+
const [request] = server.requests;
|
|
286
|
+
request.respond(200, {
|
|
287
|
+
'Content-Type': 'application/json'
|
|
288
|
+
}, JSON.stringify({
|
|
289
|
+
data: {
|
|
290
|
+
success: true,
|
|
291
|
+
client_id: CLIENTID1,
|
|
292
|
+
idlog: IDLOG1
|
|
293
|
+
},
|
|
294
|
+
expires: Date.now()
|
|
295
|
+
}));
|
|
296
|
+
const parsed = parseUrl(request.url);
|
|
297
|
+
expect(parsed.hostname).to.equal(SERVER_HOST);
|
|
298
|
+
});
|
|
299
|
+
});
|
|
300
|
+
});
|
|
301
|
+
});
|
|
302
|
+
});
|
|
303
|
+
});
|
|
@@ -430,6 +430,11 @@ describe('LiveIntentExternalId', function() {
|
|
|
430
430
|
expect(result).to.eql({'lipb': {'lipbid': 'foo', 'nonId': 'foo', 'vidazoo': 'bar'}, 'vidazoo': {'id': 'bar', 'ext': {'provider': 'liveintent.com'}}});
|
|
431
431
|
});
|
|
432
432
|
|
|
433
|
+
it('should decode a nexxen id to a sTeparate object when present', function() {
|
|
434
|
+
const result = liveIntentExternalIdSubmodule.decode({ nonId: 'foo', nexxen: 'bar' }, defaultConfigParams);
|
|
435
|
+
expect(result).to.eql({'lipb': {'lipbid': 'foo', 'nonId': 'foo', 'nexxen': 'bar'}, 'nexxen': {'id': 'bar', 'ext': {'provider': 'liveintent.com'}}});
|
|
436
|
+
});
|
|
437
|
+
|
|
433
438
|
it('should decode the segments as part of lipb', function() {
|
|
434
439
|
const result = liveIntentExternalIdSubmodule.decode({ nonId: 'foo', 'segments': ['bar'] }, defaultConfigParams);
|
|
435
440
|
expect(result).to.eql({'lipb': {'lipbid': 'foo', 'nonId': 'foo', 'segments': ['bar']}});
|
|
@@ -334,6 +334,11 @@ describe('LiveIntentMinimalId', function() {
|
|
|
334
334
|
expect(result).to.eql({'lipb': {'lipbid': 'foo', 'nonId': 'foo', 'vidazoo': 'bar'}, 'vidazoo': {'id': 'bar', 'ext': {'provider': 'liveintent.com'}}});
|
|
335
335
|
});
|
|
336
336
|
|
|
337
|
+
it('should decode a nexxen id to a separate object when present', function() {
|
|
338
|
+
const result = liveIntentIdSubmodule.decode({ nonId: 'foo', nexxen: 'bar' });
|
|
339
|
+
expect(result).to.eql({'lipb': {'lipbid': 'foo', 'nonId': 'foo', 'nexxen': 'bar'}, 'nexxen': {'id': 'bar', 'ext': {'provider': 'liveintent.com'}}});
|
|
340
|
+
});
|
|
341
|
+
|
|
337
342
|
it('should decode the segments as part of lipb', function() {
|
|
338
343
|
const result = liveIntentIdSubmodule.decode({ nonId: 'foo', 'segments': ['bar'] }, { params: defaultConfigParams });
|
|
339
344
|
expect(result).to.eql({'lipb': {'lipbid': 'foo', 'nonId': 'foo', 'segments': ['bar']}});
|
|
@@ -522,6 +522,11 @@ describe('LiveIntentId', function() {
|
|
|
522
522
|
expect(result).to.eql({'lipb': {'lipbid': 'foo', 'nonId': 'foo', 'vidazoo': 'bar'}, 'vidazoo': {'id': 'bar', 'ext': {'provider': 'liveintent.com'}}});
|
|
523
523
|
});
|
|
524
524
|
|
|
525
|
+
it('should decode a nexxen id to a separate object when present', function() {
|
|
526
|
+
const result = liveIntentIdSubmodule.decode({ nonId: 'foo', nexxen: 'bar' }, defaultConfigParams);
|
|
527
|
+
expect(result).to.eql({'lipb': {'lipbid': 'foo', 'nonId': 'foo', 'nexxen': 'bar'}, 'nexxen': {'id': 'bar', 'ext': {'provider': 'liveintent.com'}}});
|
|
528
|
+
});
|
|
529
|
+
|
|
525
530
|
it('getId does not set the global variables when liModuleEnabled, liTreatmentRate and activatePartialTreatment are undefined', function() {
|
|
526
531
|
window.liModuleEnabled = undefined;
|
|
527
532
|
window.liTreatmentRate = undefined;
|
|
@@ -1140,6 +1145,39 @@ describe('LiveIntentId', function() {
|
|
|
1140
1145
|
});
|
|
1141
1146
|
});
|
|
1142
1147
|
|
|
1148
|
+
it('nexxen', function () {
|
|
1149
|
+
const userId = {
|
|
1150
|
+
nexxen: { 'id': 'sample_id' }
|
|
1151
|
+
};
|
|
1152
|
+
const newEids = createEidsArray(userId);
|
|
1153
|
+
expect(newEids.length).to.equal(1);
|
|
1154
|
+
expect(newEids[0]).to.deep.equal({
|
|
1155
|
+
source: 'liveintent.unrulymedia.com',
|
|
1156
|
+
uids: [{
|
|
1157
|
+
id: 'sample_id',
|
|
1158
|
+
atype: 3
|
|
1159
|
+
}]
|
|
1160
|
+
});
|
|
1161
|
+
});
|
|
1162
|
+
|
|
1163
|
+
it('nexxen with ext', function () {
|
|
1164
|
+
const userId = {
|
|
1165
|
+
nexxen: { 'id': 'sample_id', 'ext': { 'provider': 'some.provider.com' } }
|
|
1166
|
+
};
|
|
1167
|
+
const newEids = createEidsArray(userId);
|
|
1168
|
+
expect(newEids.length).to.equal(1);
|
|
1169
|
+
expect(newEids[0]).to.deep.equal({
|
|
1170
|
+
source: 'liveintent.unrulymedia.com',
|
|
1171
|
+
uids: [{
|
|
1172
|
+
id: 'sample_id',
|
|
1173
|
+
atype: 3,
|
|
1174
|
+
ext: {
|
|
1175
|
+
provider: 'some.provider.com'
|
|
1176
|
+
}
|
|
1177
|
+
}]
|
|
1178
|
+
});
|
|
1179
|
+
});
|
|
1180
|
+
|
|
1143
1181
|
it('tdid sets matcher for liveintent', function() {
|
|
1144
1182
|
const userId = {
|
|
1145
1183
|
tdid: 'some-tdid'
|
|
@@ -1,35 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {init, startAuctionHook, setSubmoduleRegistry, resetUserIds} from 'modules/userId/index.js';
|
|
4
|
-
import { storage, lmpIdSubmodule } from 'modules/lmpIdSystem.js';
|
|
5
|
-
import { mockGdprConsent } from '../../helpers/consentData.js';
|
|
6
|
-
import 'src/prebid.js';
|
|
7
|
-
|
|
8
|
-
function getConfigMock() {
|
|
9
|
-
return {
|
|
10
|
-
userSync: {
|
|
11
|
-
syncDelay: 0,
|
|
12
|
-
userIds: [{
|
|
13
|
-
name: 'lmpid'
|
|
14
|
-
}]
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
function getAdUnitMock(code = 'adUnit-code') {
|
|
20
|
-
return {
|
|
21
|
-
code,
|
|
22
|
-
mediaTypes: { banner: {}, native: {} },
|
|
23
|
-
sizes: [
|
|
24
|
-
[300, 200],
|
|
25
|
-
[300, 600]
|
|
26
|
-
],
|
|
27
|
-
bids: [{
|
|
28
|
-
bidder: 'sampleBidder',
|
|
29
|
-
params: { placementId: 'banner-only-bidder' }
|
|
30
|
-
}]
|
|
31
|
-
};
|
|
32
|
-
}
|
|
1
|
+
import {expect} from 'chai';
|
|
2
|
+
import {lmpIdSubmodule, storage} from 'modules/lmpIdSystem.js';
|
|
33
3
|
|
|
34
4
|
describe('LMPID System', () => {
|
|
35
5
|
let getDataFromLocalStorageStub, localStorageIsEnabledStub;
|
|
@@ -81,53 +51,4 @@ describe('LMPID System', () => {
|
|
|
81
51
|
expect(lmpIdSubmodule.decode('lmpid')).to.deep.equal({ lmpid: 'lmpid' });
|
|
82
52
|
});
|
|
83
53
|
});
|
|
84
|
-
|
|
85
|
-
describe('LMPID: requestBids hook', () => {
|
|
86
|
-
let adUnits;
|
|
87
|
-
let sandbox;
|
|
88
|
-
|
|
89
|
-
beforeEach(() => {
|
|
90
|
-
sandbox = sinon.createSandbox();
|
|
91
|
-
mockGdprConsent(sandbox);
|
|
92
|
-
adUnits = [getAdUnitMock()];
|
|
93
|
-
init(config);
|
|
94
|
-
setSubmoduleRegistry([lmpIdSubmodule]);
|
|
95
|
-
getDataFromLocalStorageStub.withArgs('__lmpid').returns('stored-lmpid');
|
|
96
|
-
localStorageIsEnabledStub.returns(true);
|
|
97
|
-
config.setConfig(getConfigMock());
|
|
98
|
-
});
|
|
99
|
-
|
|
100
|
-
afterEach(() => {
|
|
101
|
-
sandbox.restore();
|
|
102
|
-
config.resetConfig();
|
|
103
|
-
});
|
|
104
|
-
|
|
105
|
-
after(() => {
|
|
106
|
-
init(config);
|
|
107
|
-
})
|
|
108
|
-
|
|
109
|
-
after(() => {
|
|
110
|
-
resetUserIds();
|
|
111
|
-
})
|
|
112
|
-
|
|
113
|
-
it('when a stored LMPID exists it is added to bids', (done) => {
|
|
114
|
-
startAuctionHook(() => {
|
|
115
|
-
adUnits.forEach(unit => {
|
|
116
|
-
unit.bids.forEach(bid => {
|
|
117
|
-
expect(bid).to.have.deep.nested.property('userId.lmpid');
|
|
118
|
-
expect(bid.userId.lmpid).to.equal('stored-lmpid');
|
|
119
|
-
const lmpidAsEid = bid.userIdAsEids.find(e => e.source == 'loblawmedia.ca');
|
|
120
|
-
expect(lmpidAsEid).to.deep.equal({
|
|
121
|
-
source: 'loblawmedia.ca',
|
|
122
|
-
uids: [{
|
|
123
|
-
id: 'stored-lmpid',
|
|
124
|
-
atype: 3,
|
|
125
|
-
}]
|
|
126
|
-
});
|
|
127
|
-
});
|
|
128
|
-
});
|
|
129
|
-
done();
|
|
130
|
-
}, { adUnits });
|
|
131
|
-
});
|
|
132
|
-
});
|
|
133
54
|
});
|