prebid.js 7.51.0 → 7.53.0
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/dist/1plusXRtdProvider.js +1 -1
- package/dist/33acrossBidAdapter.js +1 -1
- package/dist/33acrossIdSystem.js +1 -1
- package/dist/adagioBidAdapter.js +1 -1
- package/dist/adbookpspBidAdapter.js +1 -1
- package/dist/adgenerationBidAdapter.js +1 -1
- package/dist/adkernelBidAdapter.js +1 -1
- package/dist/adqueryBidAdapter.js +1 -1
- package/dist/adrelevantisBidAdapter.js +1 -1
- package/dist/adriverIdSystem.js +1 -1
- package/dist/adtrgtmeBidAdapter.js +1 -1
- package/dist/adxcgBidAdapter.js +1 -1
- package/dist/adyoulikeBidAdapter.js +1 -1
- package/dist/airgridRtdProvider.js +1 -1
- package/dist/ajaBidAdapter.js +1 -1
- package/dist/allowActivities.js +1 -0
- package/dist/amxBidAdapter.js +1 -1
- package/dist/amxIdSystem.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/bridgewellBidAdapter.js +1 -1
- package/dist/brightMountainMediaBidAdapter.js +1 -1
- package/dist/carodaBidAdapter.js +1 -1
- package/dist/chtnwBidAdapter.js +1 -1
- package/dist/conceptxBidAdapter.js +1 -0
- package/dist/concertBidAdapter.js +1 -1
- package/dist/connectIdSystem.js +1 -1
- package/dist/connectadBidAdapter.js +1 -1
- package/dist/consumableBidAdapter.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/dependencies.json +6 -0
- package/dist/dspxBidAdapter.js +1 -1
- package/dist/eplanningBidAdapter.js +1 -1
- package/dist/eskimiBidAdapter.js +1 -1
- package/dist/euidIdSystem.js +1 -0
- package/dist/feedadBidAdapter.js +1 -1
- package/dist/finativeBidAdapter.js +1 -1
- package/dist/freepassIdSystem.js +1 -0
- package/dist/freewheel-sspBidAdapter.js +1 -1
- package/dist/gdprEnforcement.js +1 -1
- package/dist/glimpseBidAdapter.js +1 -1
- package/dist/gmosspBidAdapter.js +1 -1
- package/dist/goldbachBidAdapter.js +1 -1
- package/dist/greenbidsAnalyticsAdapter.js +1 -1
- package/dist/greenbidsRtdProvider.js +1 -1
- package/dist/gridBidAdapter.js +1 -1
- package/dist/growthCodeRtdProvider.js +1 -0
- package/dist/gumgumBidAdapter.js +1 -1
- package/dist/h12mediaBidAdapter.js +1 -1
- package/dist/id5IdSystem.js +1 -1
- package/dist/improvedigitalBidAdapter.js +1 -1
- package/dist/inmarBidAdapter.js +1 -1
- package/dist/insticatorBidAdapter.js +1 -1
- package/dist/ixBidAdapter.js +1 -1
- package/dist/justpremiumBidAdapter.js +1 -1
- package/dist/kargoBidAdapter.js +1 -1
- package/dist/konduitAnalyticsAdapter.js +1 -1
- package/dist/kueezBidAdapter.js +1 -1
- package/dist/kueezRtbBidAdapter.js +1 -1
- package/dist/kulturemediaBidAdapter.js +1 -1
- package/dist/lassoBidAdapter.js +1 -1
- package/dist/lifestreetBidAdapter.js +1 -1
- package/dist/limelightDigitalBidAdapter.js +1 -1
- package/dist/liveyieldAnalyticsAdapter.js +1 -1
- package/dist/logicadBidAdapter.js +1 -1
- package/dist/loglyliftBidAdapter.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/mediasquareBidAdapter.js +1 -1
- package/dist/mgidBidAdapter.js +1 -1
- package/dist/minutemediaBidAdapter.js +1 -1
- package/dist/minutemediaplusBidAdapter.js +1 -1
- package/dist/nexx360BidAdapter.js +1 -1
- package/dist/not-for-prod/prebid.js +154 -146
- package/dist/objectGuard.js +1 -0
- package/dist/oguryBidAdapter.js +1 -1
- package/dist/onetagBidAdapter.js +1 -1
- package/dist/ooloAnalyticsAdapter.js +1 -1
- package/dist/optidigitalBidAdapter.js +1 -1
- package/dist/outbrainBidAdapter.js +1 -1
- package/dist/oxxionAnalyticsAdapter.js +1 -0
- package/dist/pairIdSystem.js +1 -1
- package/dist/parrableIdSystem.js +1 -1
- package/dist/pixfutureBidAdapter.js +1 -1
- package/dist/prebid-core.js +1 -1
- package/dist/proxistoreBidAdapter.js +1 -1
- package/dist/publinkIdSystem.js +1 -1
- package/dist/pubmaticBidAdapter.js +1 -1
- package/dist/pubwiseAnalyticsAdapter.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/retailspotBidAdapter.js +1 -1
- package/dist/rhythmoneBidAdapter.js +1 -1
- package/dist/richaudienceBidAdapter.js +1 -1
- package/dist/riseBidAdapter.js +1 -1
- package/dist/rtdModule.js +1 -1
- package/dist/rubiconAnalyticsAdapter.js +1 -1
- package/dist/rubiconBidAdapter.js +1 -1
- package/dist/schain.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/shinezBidAdapter.js +1 -1
- package/dist/sirdataRtdProvider.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/sonobiBidAdapter.js +1 -1
- package/dist/sovrnAnalyticsAdapter.js +1 -1
- package/dist/sovrnBidAdapter.js +1 -1
- package/dist/sspBCBidAdapter.js +1 -1
- package/dist/stroeerCoreBidAdapter.js +1 -1
- package/dist/stvBidAdapter.js +1 -1
- package/dist/sublimeBidAdapter.js +1 -1
- package/dist/synacormediaBidAdapter.js +1 -1
- package/dist/targetVideoBidAdapter.js +1 -1
- package/dist/teadsBidAdapter.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/uid2IdSystem_shared.js +1 -0
- package/dist/underdogmediaBidAdapter.js +1 -1
- package/dist/undertoneBidAdapter.js +1 -1
- package/dist/userId.js +1 -1
- package/dist/vidazooBidAdapter.js +1 -1
- package/dist/videobyteBidAdapter.js +1 -1
- package/dist/viouslyBidAdapter.js +1 -1
- package/dist/visxBidAdapter.js +1 -1
- package/dist/vuukleBidAdapter.js +1 -1
- package/dist/weboramaRtdProvider.js +1 -1
- package/dist/widespaceBidAdapter.js +1 -1
- package/dist/winrBidAdapter.js +1 -1
- package/dist/yahoosspBidAdapter.js +1 -1
- package/dist/yieldlabBidAdapter.js +1 -1
- package/dist/yieldmoBidAdapter.js +1 -1
- package/dist/yieldoneAnalyticsAdapter.js +1 -1
- package/dist/zeta_global_sspBidAdapter.js +1 -1
- package/integrationExamples/gpt/growthcode.html +20 -9
- package/integrationExamples/gpt/userId_example.html +20 -6
- package/libraries/objectGuard/objectGuard.js +108 -0
- package/libraries/objectGuard/ortbGuard.js +88 -0
- package/modules/.submodules.json +3 -1
- package/modules/1plusXRtdProvider.js +31 -60
- package/modules/adagioBidAdapter.js +86 -24
- package/modules/adgenerationBidAdapter.js +14 -5
- package/modules/adkernelBidAdapter.js +2 -2
- package/modules/adriverIdSystem.js +1 -1
- package/modules/airgridRtdProvider.js +11 -12
- package/modules/allowActivities.js +74 -0
- package/modules/asoBidAdapter.js +2 -1
- package/modules/beopBidAdapter.js +6 -0
- package/modules/conceptxBidAdapter.js +70 -0
- package/modules/conceptxBidAdapter.md +36 -0
- package/modules/connectIdSystem.js +89 -13
- package/modules/connectIdSystem.md +4 -7
- package/modules/criteoBidAdapter.js +18 -2
- package/modules/eskimiBidAdapter.js +171 -41
- package/modules/eskimiBidAdapter.md +35 -16
- package/modules/euidIdSystem.js +121 -0
- package/modules/euidIdSystem.md +131 -0
- package/modules/freepassIdSystem.js +61 -0
- package/modules/freepassIdSystem.md +47 -0
- package/modules/gdprEnforcement.js +98 -169
- package/modules/greenbidsAnalyticsAdapter.js +1 -1
- package/modules/growthCodeRtdProvider.js +131 -0
- package/modules/growthCodeRtdProvider.md +55 -0
- package/modules/id5IdSystem.js +3 -5
- package/modules/ixBidAdapter.js +17 -3
- package/modules/limelightDigitalBidAdapter.js +1 -1
- package/modules/logicadBidAdapter.js +14 -1
- package/modules/mediasquareBidAdapter.js +13 -5
- package/modules/nexx360BidAdapter.js +1 -0
- package/modules/oxxionAnalyticsAdapter.js +212 -0
- package/modules/oxxionAnalyticsAdapter.md +33 -0
- package/modules/pairIdSystem.js +16 -11
- package/modules/proxistoreBidAdapter.js +11 -14
- package/modules/richaudienceBidAdapter.js +10 -1
- package/modules/riseBidAdapter.js +1 -1
- package/modules/rtdModule/index.js +12 -1
- package/modules/schain.js +2 -2
- package/modules/sharethroughBidAdapter.js +2 -2
- package/modules/sirdataRtdProvider.js +73 -146
- package/modules/smartadserverBidAdapter.js +5 -0
- package/modules/sovrnBidAdapter.js +4 -1
- package/modules/stroeerCoreBidAdapter.js +55 -6
- package/modules/stvBidAdapter.js +34 -1
- package/modules/uid2IdSystem.js +27 -210
- package/modules/uid2IdSystem.md +104 -23
- package/modules/uid2IdSystem_shared.js +232 -0
- package/modules/undertoneBidAdapter.js +9 -1
- package/modules/userId/eids.js +8 -0
- package/modules/userId/index.js +69 -41
- package/modules/userId/userId.md +2 -1
- package/modules/viouslyBidAdapter.js +2 -2
- package/modules/weboramaRtdProvider.js +25 -95
- package/modules/weboramaRtdProvider.md +4 -4
- package/modules/yahoosspBidAdapter.js +45 -3
- package/modules/yahoosspBidAdapter.md +1 -1
- package/modules/yieldlabBidAdapter.js +23 -14
- package/modules/zeta_global_sspBidAdapter.js +28 -22
- package/package.json +1 -1
- package/src/activities/activities.js +47 -0
- package/src/activities/activityParams.js +8 -0
- package/src/activities/modules.js +1 -1
- package/src/activities/params.js +59 -0
- package/src/activities/redactor.js +157 -0
- package/src/activities/rules.js +95 -0
- package/src/adapterManager.js +45 -8
- package/src/adloader.js +1 -0
- package/src/fpd/rootDomain.js +1 -1
- package/src/prebid.js +1 -1
- package/src/storageManager.js +57 -44
- package/src/userSync.js +35 -18
- package/test/spec/activities/allowActivites_spec.js +138 -0
- package/test/spec/activities/objectGuard_spec.js +144 -0
- package/test/spec/activities/ortbGuard_spec.js +140 -0
- package/test/spec/activities/params_spec.js +25 -0
- package/test/spec/activities/redactor_spec.js +296 -0
- package/test/spec/activities/rules_spec.js +135 -0
- package/test/spec/modules/1plusXRtdProvider_spec.js +98 -149
- package/test/spec/modules/adagioBidAdapter_spec.js +46 -17
- package/test/spec/modules/adgenerationBidAdapter_spec.js +52 -12
- package/test/spec/modules/airgridRtdProvider_spec.js +2 -0
- package/test/spec/modules/beopBidAdapter_spec.js +24 -0
- package/test/spec/modules/conceptxBidAdapter_spec.js +136 -0
- package/test/spec/modules/connectIdSystem_spec.js +291 -23
- package/test/spec/modules/criteoBidAdapter_spec.js +85 -1
- package/test/spec/modules/eids_spec.js +15 -0
- package/test/spec/modules/eskimiBidAdapter_spec.js +264 -112
- package/test/spec/modules/euidIdSystem_spec.js +130 -0
- package/test/spec/modules/freepassIdSystem_spec.js +186 -0
- package/test/spec/modules/gdprEnforcement_spec.js +127 -414
- package/test/spec/modules/growthCodeRtdProvider_spec.js +127 -0
- package/test/spec/modules/id5IdSystem_spec.js +10 -3
- package/test/spec/modules/ixBidAdapter_spec.js +32 -1
- package/test/spec/modules/logicadBidAdapter_spec.js +122 -2
- package/test/spec/modules/mediasquareBidAdapter_spec.js +4 -0
- package/test/spec/modules/oxxionAnalyticsAdapter_spec.js +324 -0
- package/test/spec/modules/pairIdSystem_spec.js +16 -3
- package/test/spec/modules/realTimeDataModule_spec.js +1 -1
- package/test/spec/modules/richaudienceBidAdapter_spec.js +44 -0
- package/test/spec/modules/schain_spec.js +9 -0
- package/test/spec/modules/sharethroughBidAdapter_spec.js +1 -1
- package/test/spec/modules/sirdataRtdProvider_spec.js +110 -17
- package/test/spec/modules/smartadserverBidAdapter_spec.js +42 -0
- package/test/spec/modules/sovrnBidAdapter_spec.js +13 -0
- package/test/spec/modules/stroeerCoreBidAdapter_spec.js +151 -6
- package/test/spec/modules/stvBidAdapter_spec.js +13 -1
- package/test/spec/modules/uid2IdSystem_helpers.js +70 -0
- package/test/spec/modules/uid2IdSystem_spec.js +131 -86
- package/test/spec/modules/undertoneBidAdapter_spec.js +57 -1
- package/test/spec/modules/userId_spec.js +96 -33
- package/test/spec/modules/weboramaRtdProvider_spec.js +331 -205
- package/test/spec/modules/yahoosspBidAdapter_spec.js +103 -51
- package/test/spec/modules/yieldlabBidAdapter_spec.js +42 -2
- package/test/spec/modules/zeta_global_sspBidAdapter_spec.js +204 -4
- package/test/spec/unit/core/adapterManager_spec.js +181 -1
- package/test/spec/unit/core/storageManager_spec.js +76 -68
- package/test/spec/unit/pbjs_api_spec.js +15 -25
- package/test/spec/userSync_spec.js +45 -16
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
// import or require modules necessary for the test, e.g.:
|
|
2
|
+
import { expect } from 'chai'; // may prefer 'assert' in place of 'expect'
|
|
3
|
+
import { spec } from 'modules/conceptxBidAdapter.js';
|
|
4
|
+
import { newBidder } from 'src/adapters/bidderFactory.js';
|
|
5
|
+
// import { config } from 'src/config.js';
|
|
6
|
+
|
|
7
|
+
describe('conceptxBidAdapter', function () {
|
|
8
|
+
const URL = 'https://conceptx.cncpt-central.com/openrtb';
|
|
9
|
+
|
|
10
|
+
// before(() => {
|
|
11
|
+
|
|
12
|
+
// });
|
|
13
|
+
|
|
14
|
+
// after(() => {
|
|
15
|
+
// // $$PREBID_GLOBAL$$.bidderSettings = {};
|
|
16
|
+
// });
|
|
17
|
+
|
|
18
|
+
// afterEach(function () {
|
|
19
|
+
// config.resetConfig();
|
|
20
|
+
// });
|
|
21
|
+
|
|
22
|
+
const ENDPOINT_URL = `${URL}`;
|
|
23
|
+
const ENDPOINT_URL_CONSENT = `${URL}?gdpr_applies=true&consentString=ihaveconsented`;
|
|
24
|
+
const adapter = newBidder(spec);
|
|
25
|
+
|
|
26
|
+
const bidderRequests = [
|
|
27
|
+
{
|
|
28
|
+
bidId: '123',
|
|
29
|
+
bidder: 'conceptx',
|
|
30
|
+
params: {
|
|
31
|
+
site: 'example',
|
|
32
|
+
adunit: 'some-id-3'
|
|
33
|
+
},
|
|
34
|
+
mediaTypes: {
|
|
35
|
+
banner: {
|
|
36
|
+
sizes: [[930, 180]],
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
}
|
|
40
|
+
]
|
|
41
|
+
|
|
42
|
+
const singleBidRequest = {
|
|
43
|
+
bid: [
|
|
44
|
+
{
|
|
45
|
+
bidId: '123',
|
|
46
|
+
}
|
|
47
|
+
]
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
const serverResponse = {
|
|
51
|
+
body: {
|
|
52
|
+
'bidResponses': [
|
|
53
|
+
{
|
|
54
|
+
'ads': [
|
|
55
|
+
{
|
|
56
|
+
'referrer': 'http://localhost/prebidpage_concept_bidder.html',
|
|
57
|
+
'ttl': 360,
|
|
58
|
+
'html': '<h1>DUMMY</h1>',
|
|
59
|
+
'requestId': '214dfadd1f8826',
|
|
60
|
+
'cpm': 46,
|
|
61
|
+
'currency': 'DKK',
|
|
62
|
+
'width': 930,
|
|
63
|
+
'height': 180,
|
|
64
|
+
'creativeId': 'FAKE-ID',
|
|
65
|
+
'meta': {
|
|
66
|
+
'mediaType': 'banner'
|
|
67
|
+
},
|
|
68
|
+
'netRevenue': true,
|
|
69
|
+
'destinationUrls': {
|
|
70
|
+
'destination': 'https://concept.dk'
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
],
|
|
74
|
+
'matchedAdCount': 1,
|
|
75
|
+
'targetId': '214dfadd1f8826'
|
|
76
|
+
}
|
|
77
|
+
]
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
describe('inherited functions', function () {
|
|
82
|
+
it('exists and is a function', function () {
|
|
83
|
+
expect(adapter.callBids).to.exist.and.to.be.a('function');
|
|
84
|
+
});
|
|
85
|
+
});
|
|
86
|
+
|
|
87
|
+
describe('isBidRequestValid', function () {
|
|
88
|
+
it('should return true when required params found', function () {
|
|
89
|
+
expect(spec.isBidRequestValid(bidderRequests[0])).to.equal(true);
|
|
90
|
+
});
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
describe('buildRequests', function () {
|
|
94
|
+
it('Test requests', function () {
|
|
95
|
+
const request = spec.buildRequests(bidderRequests, {});
|
|
96
|
+
expect(request.length).to.equal(1);
|
|
97
|
+
expect(request[0]).to.have.property('data');
|
|
98
|
+
const bid = JSON.parse(request[0].data).adUnits[0]
|
|
99
|
+
expect(bid.site).to.equal('example');
|
|
100
|
+
expect(bid.adunit).to.equal('some-id-3');
|
|
101
|
+
expect(JSON.stringify(bid.dimensions)).to.equal(JSON.stringify([
|
|
102
|
+
[930, 180]]));
|
|
103
|
+
});
|
|
104
|
+
});
|
|
105
|
+
|
|
106
|
+
describe('user privacy', function () {
|
|
107
|
+
it('should NOT send GDPR Consent data if gdprApplies equals undefined', function () {
|
|
108
|
+
let request = spec.buildRequests(bidderRequests, { gdprConsent: { gdprApplies: undefined, consentString: 'iDoNotConsent' } });
|
|
109
|
+
expect(request.length).to.equal(1);
|
|
110
|
+
expect(request[0]).to.have.property('url')
|
|
111
|
+
expect(request[0].url).to.equal(ENDPOINT_URL);
|
|
112
|
+
});
|
|
113
|
+
it('should send GDPR Consent data if gdprApplies', function () {
|
|
114
|
+
let request = spec.buildRequests(bidderRequests, { gdprConsent: { gdprApplies: true, consentString: 'ihaveconsented' } });
|
|
115
|
+
expect(request.length).to.equal(1);
|
|
116
|
+
expect(request[0]).to.have.property('url')
|
|
117
|
+
expect(request[0].url).to.equal(ENDPOINT_URL_CONSENT);
|
|
118
|
+
});
|
|
119
|
+
});
|
|
120
|
+
|
|
121
|
+
describe('interpretResponse', function () {
|
|
122
|
+
it('should return valid response when passed valid server response', function () {
|
|
123
|
+
const interpretedResponse = spec.interpretResponse(serverResponse, singleBidRequest);
|
|
124
|
+
const ad = serverResponse.body.bidResponses[0].ads[0]
|
|
125
|
+
expect(interpretedResponse).to.have.lengthOf(1);
|
|
126
|
+
expect(interpretedResponse[0].cpm).to.equal(ad.cpm);
|
|
127
|
+
expect(interpretedResponse[0].width).to.equal(Number(ad.width));
|
|
128
|
+
expect(interpretedResponse[0].height).to.equal(Number(ad.height));
|
|
129
|
+
expect(interpretedResponse[0].creativeId).to.equal(ad.creativeId);
|
|
130
|
+
expect(interpretedResponse[0].currency).to.equal(ad.currency);
|
|
131
|
+
expect(interpretedResponse[0].netRevenue).to.equal(true);
|
|
132
|
+
expect(interpretedResponse[0].ad).to.equal(ad.html);
|
|
133
|
+
expect(interpretedResponse[0].ttl).to.equal(360);
|
|
134
|
+
});
|
|
135
|
+
});
|
|
136
|
+
});
|
|
@@ -2,7 +2,7 @@ import {expect} from 'chai';
|
|
|
2
2
|
import {connectIdSubmodule, storage} from 'modules/connectIdSystem.js';
|
|
3
3
|
import {server} from '../../mocks/xhr';
|
|
4
4
|
import {parseQS, parseUrl} from 'src/utils.js';
|
|
5
|
-
import {uspDataHandler} from 'src/adapterManager.js';
|
|
5
|
+
import {uspDataHandler, gppDataHandler} from 'src/adapterManager.js';
|
|
6
6
|
|
|
7
7
|
const TEST_SERVER_URL = 'http://localhost:9876/';
|
|
8
8
|
|
|
@@ -14,6 +14,10 @@ describe('Yahoo ConnectID Submodule', () => {
|
|
|
14
14
|
const OVERRIDE_ENDPOINT = 'https://foo/bar';
|
|
15
15
|
const STORAGE_KEY = 'connectId';
|
|
16
16
|
const USP_DATA = '1YYY';
|
|
17
|
+
const GPP_DATA = {
|
|
18
|
+
gppString: 'gppconsent',
|
|
19
|
+
applicableSections: [6, 7]
|
|
20
|
+
};
|
|
17
21
|
|
|
18
22
|
it('should have the correct module name declared', () => {
|
|
19
23
|
expect(connectIdSubmodule.name).to.equal('connectId');
|
|
@@ -34,6 +38,7 @@ describe('Yahoo ConnectID Submodule', () => {
|
|
|
34
38
|
let localStorageEnabledStub;
|
|
35
39
|
let removeLocalStorageDataStub;
|
|
36
40
|
let uspConsentDataStub;
|
|
41
|
+
let gppConsentDataStub;
|
|
37
42
|
|
|
38
43
|
let consentData;
|
|
39
44
|
beforeEach(() => {
|
|
@@ -48,10 +53,12 @@ describe('Yahoo ConnectID Submodule', () => {
|
|
|
48
53
|
localStorageEnabledStub = sinon.stub(storage, 'localStorageIsEnabled');
|
|
49
54
|
removeLocalStorageDataStub = sinon.stub(storage, 'removeDataFromLocalStorage');
|
|
50
55
|
uspConsentDataStub = sinon.stub(uspDataHandler, 'getConsentData');
|
|
56
|
+
gppConsentDataStub = sinon.stub(gppDataHandler, 'getConsentData');
|
|
51
57
|
|
|
52
58
|
cookiesEnabledStub.returns(true);
|
|
53
59
|
localStorageEnabledStub.returns(true);
|
|
54
60
|
uspConsentDataStub.returns(USP_DATA);
|
|
61
|
+
gppConsentDataStub.returns(GPP_DATA);
|
|
55
62
|
|
|
56
63
|
consentData = {
|
|
57
64
|
gdprApplies: 1,
|
|
@@ -69,6 +76,7 @@ describe('Yahoo ConnectID Submodule', () => {
|
|
|
69
76
|
localStorageEnabledStub.restore();
|
|
70
77
|
removeLocalStorageDataStub.restore();
|
|
71
78
|
uspConsentDataStub.restore();
|
|
79
|
+
gppConsentDataStub.restore();
|
|
72
80
|
});
|
|
73
81
|
|
|
74
82
|
function invokeGetIdAPI(configParams, consentData) {
|
|
@@ -135,37 +143,254 @@ describe('Yahoo ConnectID Submodule', () => {
|
|
|
135
143
|
}, consentData)).to.be.undefined;
|
|
136
144
|
expect(ajaxStub.callCount).to.equal(0);
|
|
137
145
|
});
|
|
138
|
-
|
|
139
|
-
it('returns undefined if the pixelId param is passed, but the he and puid param are not passed', () => {
|
|
140
|
-
expect(invokeGetIdAPI({
|
|
141
|
-
pixelId: PIXEL_ID
|
|
142
|
-
}, consentData)).to.be.undefined;
|
|
143
|
-
expect(ajaxStub.callCount).to.equal(0);
|
|
144
|
-
});
|
|
145
146
|
});
|
|
146
147
|
|
|
147
148
|
describe('with valid module configuration', () => {
|
|
148
149
|
describe('when data is in client storage', () => {
|
|
149
|
-
it('returns an object with the stored ID from cookies for valid module configuration', () => {
|
|
150
|
+
it('returns an object with the stored ID from cookies for valid module configuration and sync is done', () => {
|
|
150
151
|
const cookieData = {connectId: 'foobar'};
|
|
151
152
|
getCookieStub.withArgs(STORAGE_KEY).returns(JSON.stringify(cookieData));
|
|
152
153
|
let result = invokeGetIdAPI({
|
|
153
154
|
he: HASHED_EMAIL,
|
|
154
155
|
pixelId: PIXEL_ID
|
|
155
156
|
}, consentData);
|
|
157
|
+
|
|
158
|
+
expect(result).to.be.an('object').that.has.all.keys('id', 'callback');
|
|
159
|
+
expect(result.id).to.deep.equal(cookieData);
|
|
160
|
+
expect(typeof result.callback).to.equal('function');
|
|
161
|
+
});
|
|
162
|
+
|
|
163
|
+
it('returns an object with the stored ID from cookies for valid module configuration with no user sync', () => {
|
|
164
|
+
const last13Days = Date.now() - (60 * 60 * 24 * 1000 * 13);
|
|
165
|
+
const cookieData = {connectId: 'foobar', he: HASHED_EMAIL, lastSynced: last13Days};
|
|
166
|
+
getCookieStub.withArgs(STORAGE_KEY).returns(JSON.stringify(cookieData));
|
|
167
|
+
let result = invokeGetIdAPI({
|
|
168
|
+
he: HASHED_EMAIL,
|
|
169
|
+
pixelId: PIXEL_ID
|
|
170
|
+
}, consentData);
|
|
171
|
+
|
|
172
|
+
expect(result).to.be.an('object').that.has.all.keys('id');
|
|
173
|
+
expect(result.id.lastUsed).to.be.a('number');
|
|
174
|
+
cookieData.lastUsed = result.id.lastUsed;
|
|
175
|
+
expect(result.id).to.deep.equal(cookieData);
|
|
176
|
+
});
|
|
177
|
+
|
|
178
|
+
it('returns an object with the stored ID and refreshes the storages with the new lastUsed', () => {
|
|
179
|
+
const last13Days = Date.now() - (60 * 60 * 24 * 1000 * 13);
|
|
180
|
+
const cookieData = {connectId: 'foobar', he: HASHED_EMAIL, lastSynced: last13Days, lastUsed: 1};
|
|
181
|
+
getCookieStub.withArgs(STORAGE_KEY).returns(JSON.stringify(cookieData));
|
|
182
|
+
const dateNowStub = sinon.stub(Date, 'now');
|
|
183
|
+
dateNowStub.returns(20);
|
|
184
|
+
const newCookieData = Object.assign({}, cookieData, {lastUsed: 20})
|
|
185
|
+
let result = invokeGetIdAPI({
|
|
186
|
+
he: HASHED_EMAIL,
|
|
187
|
+
pixelId: PIXEL_ID
|
|
188
|
+
}, consentData);
|
|
189
|
+
dateNowStub.restore();
|
|
190
|
+
|
|
191
|
+
const expiryDelta = new Date(60 * 60 * 24 * 365 * 1000);
|
|
192
|
+
expect(result).to.be.an('object').that.has.all.keys('id');
|
|
193
|
+
expect(setCookieStub.calledOnce).to.be.true;
|
|
194
|
+
expect(setCookieStub.firstCall.args[0]).to.equal(STORAGE_KEY);
|
|
195
|
+
expect(setCookieStub.firstCall.args[1]).to.equal(JSON.stringify(newCookieData));
|
|
196
|
+
expect(setCookieStub.firstCall.args[2]).to.equal(expiryDelta.toUTCString());
|
|
197
|
+
expect(setLocalStorageStub.calledOnce).to.be.true;
|
|
198
|
+
expect(setLocalStorageStub.firstCall.args[0]).to.equal(STORAGE_KEY);
|
|
199
|
+
expect(setLocalStorageStub.firstCall.args[1]).to.equal(JSON.stringify(newCookieData));
|
|
200
|
+
});
|
|
201
|
+
|
|
202
|
+
it('returns an object with the stored ID from cookies and no sync when puid stays the same', () => {
|
|
203
|
+
const last13Days = Date.now() - (60 * 60 * 24 * 1000 * 13);
|
|
204
|
+
const cookieData = {connectId: 'foobar', puid: '123', lastSynced: last13Days};
|
|
205
|
+
getCookieStub.withArgs(STORAGE_KEY).returns(JSON.stringify(cookieData));
|
|
206
|
+
const dateNowStub = sinon.stub(Date, 'now');
|
|
207
|
+
dateNowStub.returns(20);
|
|
208
|
+
let result = invokeGetIdAPI({
|
|
209
|
+
puid: '123',
|
|
210
|
+
pixelId: PIXEL_ID
|
|
211
|
+
}, consentData);
|
|
212
|
+
dateNowStub.restore();
|
|
213
|
+
|
|
156
214
|
expect(result).to.be.an('object').that.has.all.keys('id');
|
|
215
|
+
cookieData.lastUsed = 20;
|
|
157
216
|
expect(result.id).to.deep.equal(cookieData);
|
|
158
217
|
});
|
|
159
218
|
|
|
160
|
-
it('returns an object with the stored ID from
|
|
219
|
+
it('returns an object with the stored ID from cookies and syncs because of expired auto generated puid', () => {
|
|
220
|
+
const last13Days = Date.now() - (60 * 60 * 24 * 1000 * 13);
|
|
221
|
+
const last31Days = Date.now() - (60 * 60 * 24 * 1000 * 31);
|
|
222
|
+
const cookieData = {connectId: 'foo', he: 'email', lastSynced: last13Days, puid: '9', lastUsed: last31Days};
|
|
223
|
+
getCookieStub.withArgs(STORAGE_KEY).returns(JSON.stringify(cookieData));
|
|
224
|
+
let result = invokeGetIdAPI({
|
|
225
|
+
he: HASHED_EMAIL,
|
|
226
|
+
pixelId: PIXEL_ID
|
|
227
|
+
}, consentData);
|
|
228
|
+
|
|
229
|
+
delete cookieData.puid;
|
|
230
|
+
expect(result).to.be.an('object').that.has.all.keys('id', 'callback');
|
|
231
|
+
expect(result.id).to.deep.equal(cookieData);
|
|
232
|
+
expect(typeof result.callback).to.equal('function');
|
|
233
|
+
});
|
|
234
|
+
|
|
235
|
+
it('returns an object with the stored ID from cookies and does not sync for valid auto generated puid', () => {
|
|
236
|
+
const last13Days = Date.now() - (60 * 60 * 24 * 1000 * 13);
|
|
237
|
+
const last29Days = Date.now() - (60 * 60 * 24 * 1000 * 29);
|
|
238
|
+
const cookieData = {
|
|
239
|
+
connectId: 'foo',
|
|
240
|
+
he: HASHED_EMAIL,
|
|
241
|
+
lastSynced: last13Days,
|
|
242
|
+
puid: '9',
|
|
243
|
+
lastUsed: last29Days
|
|
244
|
+
};
|
|
245
|
+
getCookieStub.withArgs(STORAGE_KEY).returns(JSON.stringify(cookieData));
|
|
246
|
+
const dateNowStub = sinon.stub(Date, 'now');
|
|
247
|
+
dateNowStub.returns(20);
|
|
248
|
+
let result = invokeGetIdAPI({
|
|
249
|
+
he: HASHED_EMAIL,
|
|
250
|
+
pixelId: PIXEL_ID
|
|
251
|
+
}, consentData);
|
|
252
|
+
dateNowStub.restore();
|
|
253
|
+
|
|
254
|
+
expect(result).to.be.an('object').that.has.all.keys('id');
|
|
255
|
+
cookieData.lastUsed = 20;
|
|
256
|
+
expect(result.id).to.deep.equal(cookieData);
|
|
257
|
+
});
|
|
258
|
+
|
|
259
|
+
it('returns an object with the stored ID from localStorage for valid module configuration and sync is done', () => {
|
|
161
260
|
const localStorageData = {connectId: 'foobarbaz'};
|
|
162
261
|
getLocalStorageStub.withArgs(STORAGE_KEY).returns(localStorageData);
|
|
163
262
|
let result = invokeGetIdAPI({
|
|
164
263
|
he: HASHED_EMAIL,
|
|
165
264
|
pixelId: PIXEL_ID
|
|
166
265
|
}, consentData);
|
|
167
|
-
|
|
266
|
+
|
|
267
|
+
expect(result).to.be.an('object').that.has.all.keys('id', 'callback');
|
|
168
268
|
expect(result.id).to.deep.equal(localStorageData);
|
|
269
|
+
expect(typeof result.callback).to.equal('function');
|
|
270
|
+
});
|
|
271
|
+
|
|
272
|
+
it('returns an object with the stored ID from localStorage and refreshes the cookie storage', () => {
|
|
273
|
+
const localStorageData = {connectId: 'foobarbaz'};
|
|
274
|
+
getLocalStorageStub.withArgs(STORAGE_KEY).returns(localStorageData);
|
|
275
|
+
const dateNowStub = sinon.stub(Date, 'now');
|
|
276
|
+
dateNowStub.returns(1);
|
|
277
|
+
let result = invokeGetIdAPI({
|
|
278
|
+
he: HASHED_EMAIL,
|
|
279
|
+
pixelId: PIXEL_ID
|
|
280
|
+
}, consentData);
|
|
281
|
+
dateNowStub.restore();
|
|
282
|
+
|
|
283
|
+
const expiryDelta = new Date(1 + 60 * 60 * 24 * 365 * 1000);
|
|
284
|
+
expect(result).to.be.an('object').that.has.all.keys('id', 'callback');
|
|
285
|
+
expect(setCookieStub.calledOnce).to.be.true;
|
|
286
|
+
expect(setCookieStub.firstCall.args[0]).to.equal(STORAGE_KEY);
|
|
287
|
+
expect(setCookieStub.firstCall.args[1]).to.equal(JSON.stringify(localStorageData));
|
|
288
|
+
expect(setCookieStub.firstCall.args[2]).to.equal(expiryDelta.toUTCString());
|
|
289
|
+
});
|
|
290
|
+
|
|
291
|
+
it('Makes an ajax GET request to the production API endpoint with stored puid when id is stale', () => {
|
|
292
|
+
const last15Days = Date.now() - (60 * 60 * 24 * 1000 * 15);
|
|
293
|
+
const last29Days = Date.now() - (60 * 60 * 24 * 1000 * 29);
|
|
294
|
+
const cookieData = {
|
|
295
|
+
connectId: 'foobar',
|
|
296
|
+
he: HASHED_EMAIL,
|
|
297
|
+
lastSynced: last15Days,
|
|
298
|
+
puid: '981',
|
|
299
|
+
lastUsed: last29Days
|
|
300
|
+
};
|
|
301
|
+
getCookieStub.withArgs(STORAGE_KEY).returns(JSON.stringify(cookieData));
|
|
302
|
+
invokeGetIdAPI({
|
|
303
|
+
he: HASHED_EMAIL,
|
|
304
|
+
pixelId: PIXEL_ID
|
|
305
|
+
}, consentData);
|
|
306
|
+
|
|
307
|
+
const expectedParams = {
|
|
308
|
+
he: HASHED_EMAIL,
|
|
309
|
+
pixelId: PIXEL_ID,
|
|
310
|
+
'1p': '0',
|
|
311
|
+
gdpr: '1',
|
|
312
|
+
gdpr_consent: consentData.consentString,
|
|
313
|
+
v: '1',
|
|
314
|
+
url: TEST_SERVER_URL,
|
|
315
|
+
us_privacy: USP_DATA,
|
|
316
|
+
puid: '981',
|
|
317
|
+
gpp: GPP_DATA.gppString,
|
|
318
|
+
gpp_sid: GPP_DATA.applicableSections.join(',')
|
|
319
|
+
};
|
|
320
|
+
const requestQueryParams = parseQS(ajaxStub.firstCall.args[0].split('?')[1]);
|
|
321
|
+
|
|
322
|
+
expect(ajaxStub.firstCall.args[0].indexOf(`${PROD_ENDPOINT}?`)).to.equal(0);
|
|
323
|
+
expect(requestQueryParams).to.deep.equal(expectedParams);
|
|
324
|
+
expect(ajaxStub.firstCall.args[3]).to.deep.equal({method: 'GET', withCredentials: true});
|
|
325
|
+
});
|
|
326
|
+
|
|
327
|
+
it('Makes an ajax GET request to the production API endpoint without the stored puid after 30 days', () => {
|
|
328
|
+
const last31Days = Date.now() - (60 * 60 * 24 * 1000 * 31);
|
|
329
|
+
const cookieData = {
|
|
330
|
+
connectId: 'foobar',
|
|
331
|
+
he: HASHED_EMAIL,
|
|
332
|
+
lastSynced: last31Days,
|
|
333
|
+
puid: '981',
|
|
334
|
+
lastUsed: last31Days
|
|
335
|
+
};
|
|
336
|
+
getCookieStub.withArgs(STORAGE_KEY).returns(JSON.stringify(cookieData));
|
|
337
|
+
invokeGetIdAPI({
|
|
338
|
+
he: HASHED_EMAIL,
|
|
339
|
+
pixelId: PIXEL_ID
|
|
340
|
+
}, consentData);
|
|
341
|
+
|
|
342
|
+
const expectedParams = {
|
|
343
|
+
he: HASHED_EMAIL,
|
|
344
|
+
pixelId: PIXEL_ID,
|
|
345
|
+
'1p': '0',
|
|
346
|
+
gdpr: '1',
|
|
347
|
+
gdpr_consent: consentData.consentString,
|
|
348
|
+
v: '1',
|
|
349
|
+
url: TEST_SERVER_URL,
|
|
350
|
+
us_privacy: USP_DATA,
|
|
351
|
+
gpp: GPP_DATA.gppString,
|
|
352
|
+
gpp_sid: GPP_DATA.applicableSections.join(',')
|
|
353
|
+
};
|
|
354
|
+
const requestQueryParams = parseQS(ajaxStub.firstCall.args[0].split('?')[1]);
|
|
355
|
+
|
|
356
|
+
expect(ajaxStub.firstCall.args[0].indexOf(`${PROD_ENDPOINT}?`)).to.equal(0);
|
|
357
|
+
expect(requestQueryParams).to.deep.equal(expectedParams);
|
|
358
|
+
expect(ajaxStub.firstCall.args[3]).to.deep.equal({method: 'GET', withCredentials: true});
|
|
359
|
+
});
|
|
360
|
+
|
|
361
|
+
it('Makes an ajax GET request to the production API endpoint with provided puid', () => {
|
|
362
|
+
const last3Days = Date.now() - (60 * 60 * 24 * 1000 * 3);
|
|
363
|
+
const cookieData = {
|
|
364
|
+
connectId: 'foobar',
|
|
365
|
+
he: HASHED_EMAIL,
|
|
366
|
+
lastSynced: last3Days,
|
|
367
|
+
puid: '981',
|
|
368
|
+
lastUsed: last3Days
|
|
369
|
+
};
|
|
370
|
+
getCookieStub.withArgs(STORAGE_KEY).returns(JSON.stringify(cookieData));
|
|
371
|
+
invokeGetIdAPI({
|
|
372
|
+
pixelId: PIXEL_ID,
|
|
373
|
+
puid: PUBLISHER_USER_ID
|
|
374
|
+
}, consentData);
|
|
375
|
+
|
|
376
|
+
const expectedParams = {
|
|
377
|
+
pixelId: PIXEL_ID,
|
|
378
|
+
puid: PUBLISHER_USER_ID,
|
|
379
|
+
he: HASHED_EMAIL,
|
|
380
|
+
'1p': '0',
|
|
381
|
+
gdpr: '1',
|
|
382
|
+
gdpr_consent: consentData.consentString,
|
|
383
|
+
v: '1',
|
|
384
|
+
url: TEST_SERVER_URL,
|
|
385
|
+
us_privacy: USP_DATA,
|
|
386
|
+
gpp: GPP_DATA.gppString,
|
|
387
|
+
gpp_sid: GPP_DATA.applicableSections.join(',')
|
|
388
|
+
};
|
|
389
|
+
const requestQueryParams = parseQS(ajaxStub.firstCall.args[0].split('?')[1]);
|
|
390
|
+
|
|
391
|
+
expect(ajaxStub.firstCall.args[0].indexOf(`${PROD_ENDPOINT}?`)).to.equal(0);
|
|
392
|
+
expect(requestQueryParams).to.deep.equal(expectedParams);
|
|
393
|
+
expect(ajaxStub.firstCall.args[3]).to.deep.equal({method: 'GET', withCredentials: true});
|
|
169
394
|
});
|
|
170
395
|
|
|
171
396
|
it('deletes local storage data when expiry has passed', () => {
|
|
@@ -284,7 +509,9 @@ describe('Yahoo ConnectID Submodule', () => {
|
|
|
284
509
|
gdpr_consent: consentData.consentString,
|
|
285
510
|
v: '1',
|
|
286
511
|
url: TEST_SERVER_URL,
|
|
287
|
-
us_privacy: USP_DATA
|
|
512
|
+
us_privacy: USP_DATA,
|
|
513
|
+
gpp: GPP_DATA.gppString,
|
|
514
|
+
gpp_sid: GPP_DATA.applicableSections.join(',')
|
|
288
515
|
};
|
|
289
516
|
const requestQueryParams = parseQS(ajaxStub.firstCall.args[0].split('?')[1]);
|
|
290
517
|
|
|
@@ -307,7 +534,9 @@ describe('Yahoo ConnectID Submodule', () => {
|
|
|
307
534
|
pixelId: PIXEL_ID,
|
|
308
535
|
gdpr_consent: consentData.consentString,
|
|
309
536
|
url: TEST_SERVER_URL,
|
|
310
|
-
us_privacy: USP_DATA
|
|
537
|
+
us_privacy: USP_DATA,
|
|
538
|
+
gpp: GPP_DATA.gppString,
|
|
539
|
+
gpp_sid: GPP_DATA.applicableSections.join(',')
|
|
311
540
|
};
|
|
312
541
|
const requestQueryParams = parseQS(ajaxStub.firstCall.args[0].split('?')[1]);
|
|
313
542
|
|
|
@@ -332,7 +561,9 @@ describe('Yahoo ConnectID Submodule', () => {
|
|
|
332
561
|
gdpr_consent: consentData.consentString,
|
|
333
562
|
v: '1',
|
|
334
563
|
url: TEST_SERVER_URL,
|
|
335
|
-
us_privacy: USP_DATA
|
|
564
|
+
us_privacy: USP_DATA,
|
|
565
|
+
gpp: GPP_DATA.gppString,
|
|
566
|
+
gpp_sid: GPP_DATA.applicableSections.join(',')
|
|
336
567
|
};
|
|
337
568
|
const requestQueryParams = parseQS(ajaxStub.firstCall.args[0].split('?')[1]);
|
|
338
569
|
|
|
@@ -347,6 +578,31 @@ describe('Yahoo ConnectID Submodule', () => {
|
|
|
347
578
|
endpoint: OVERRIDE_ENDPOINT
|
|
348
579
|
}, consentData);
|
|
349
580
|
|
|
581
|
+
const expectedParams = {
|
|
582
|
+
he: HASHED_EMAIL,
|
|
583
|
+
'1p': '0',
|
|
584
|
+
gdpr: '1',
|
|
585
|
+
gdpr_consent: consentData.consentString,
|
|
586
|
+
v: '1',
|
|
587
|
+
url: TEST_SERVER_URL,
|
|
588
|
+
us_privacy: USP_DATA,
|
|
589
|
+
gpp: GPP_DATA.gppString,
|
|
590
|
+
gpp_sid: GPP_DATA.applicableSections.join(',')
|
|
591
|
+
};
|
|
592
|
+
const requestQueryParams = parseQS(ajaxStub.firstCall.args[0].split('?')[1]);
|
|
593
|
+
|
|
594
|
+
expect(ajaxStub.firstCall.args[0].indexOf(`${OVERRIDE_ENDPOINT}?`)).to.equal(0);
|
|
595
|
+
expect(requestQueryParams).to.deep.equal(expectedParams);
|
|
596
|
+
expect(ajaxStub.firstCall.args[3]).to.deep.equal({method: 'GET', withCredentials: true});
|
|
597
|
+
});
|
|
598
|
+
|
|
599
|
+
it('Makes an ajax GET request to the specified override API endpoint without GPP', () => {
|
|
600
|
+
gppConsentDataStub.returns(undefined);
|
|
601
|
+
invokeGetIdAPI({
|
|
602
|
+
he: HASHED_EMAIL,
|
|
603
|
+
endpoint: OVERRIDE_ENDPOINT
|
|
604
|
+
}, consentData);
|
|
605
|
+
|
|
350
606
|
const expectedParams = {
|
|
351
607
|
he: HASHED_EMAIL,
|
|
352
608
|
'1p': '0',
|
|
@@ -409,12 +665,12 @@ describe('Yahoo ConnectID Submodule', () => {
|
|
|
409
665
|
});
|
|
410
666
|
});
|
|
411
667
|
|
|
412
|
-
it('stores the result in client
|
|
668
|
+
it('stores the result in client both storages', () => {
|
|
413
669
|
const dateNowStub = sinon.stub(Date, 'now');
|
|
414
670
|
dateNowStub.returns(0);
|
|
415
671
|
getAjaxFnStub.restore();
|
|
416
672
|
const upsResponse = {connectid: 'foobarbaz'};
|
|
417
|
-
const expiryDelta = new Date(60 * 60 * 24 *
|
|
673
|
+
const expiryDelta = new Date(60 * 60 * 24 * 365 * 1000);
|
|
418
674
|
invokeGetIdAPI({
|
|
419
675
|
puid: PUBLISHER_USER_ID,
|
|
420
676
|
pixelId: PIXEL_ID
|
|
@@ -425,14 +681,23 @@ describe('Yahoo ConnectID Submodule', () => {
|
|
|
425
681
|
{'Content-Type': 'application/json'},
|
|
426
682
|
JSON.stringify(upsResponse)
|
|
427
683
|
);
|
|
684
|
+
const storage = Object.assign({}, upsResponse, {
|
|
685
|
+
puid: PUBLISHER_USER_ID,
|
|
686
|
+
lastSynced: 0,
|
|
687
|
+
lastUsed: 0
|
|
688
|
+
});
|
|
689
|
+
dateNowStub.restore();
|
|
690
|
+
|
|
428
691
|
expect(setCookieStub.calledOnce).to.be.true;
|
|
429
692
|
expect(setCookieStub.firstCall.args[0]).to.equal(STORAGE_KEY);
|
|
430
|
-
expect(setCookieStub.firstCall.args[1]).to.equal(JSON.stringify(
|
|
693
|
+
expect(setCookieStub.firstCall.args[1]).to.equal(JSON.stringify(storage));
|
|
431
694
|
expect(setCookieStub.firstCall.args[2]).to.equal(expiryDelta.toUTCString());
|
|
432
695
|
expect(setCookieStub.firstCall.args[3]).to.equal(null);
|
|
433
696
|
const cookieDomain = parseUrl(TEST_SERVER_URL).hostname;
|
|
434
697
|
expect(setCookieStub.firstCall.args[4]).to.equal(`.${cookieDomain}`);
|
|
435
|
-
|
|
698
|
+
expect(setLocalStorageStub.calledOnce).to.be.true;
|
|
699
|
+
expect(setLocalStorageStub.firstCall.args[0]).to.equal(STORAGE_KEY);
|
|
700
|
+
expect(setLocalStorageStub.firstCall.args[1]).to.deep.equal(JSON.stringify(storage));
|
|
436
701
|
});
|
|
437
702
|
|
|
438
703
|
it('stores the result in localStorage if cookies are not permitted', () => {
|
|
@@ -441,10 +706,12 @@ describe('Yahoo ConnectID Submodule', () => {
|
|
|
441
706
|
const dateNowStub = sinon.stub(Date, 'now');
|
|
442
707
|
dateNowStub.returns(0);
|
|
443
708
|
const upsResponse = {connectid: 'barfoo'};
|
|
444
|
-
const expectedStoredData =
|
|
709
|
+
const expectedStoredData = {
|
|
445
710
|
connectid: 'barfoo',
|
|
446
|
-
|
|
447
|
-
|
|
711
|
+
puid: PUBLISHER_USER_ID,
|
|
712
|
+
lastSynced: 0,
|
|
713
|
+
lastUsed: 0
|
|
714
|
+
};
|
|
448
715
|
invokeGetIdAPI({
|
|
449
716
|
puid: PUBLISHER_USER_ID,
|
|
450
717
|
pixelId: PIXEL_ID
|
|
@@ -455,10 +722,11 @@ describe('Yahoo ConnectID Submodule', () => {
|
|
|
455
722
|
{'Content-Type': 'application/json'},
|
|
456
723
|
JSON.stringify(upsResponse)
|
|
457
724
|
);
|
|
725
|
+
dateNowStub.restore();
|
|
726
|
+
|
|
458
727
|
expect(setLocalStorageStub.calledOnce).to.be.true;
|
|
459
728
|
expect(setLocalStorageStub.firstCall.args[0]).to.equal(STORAGE_KEY);
|
|
460
|
-
expect(setLocalStorageStub.firstCall.args[1]).to.deep.equal(expectedStoredData);
|
|
461
|
-
dateNowStub.restore();
|
|
729
|
+
expect(setLocalStorageStub.firstCall.args[1]).to.deep.equal(JSON.stringify(expectedStoredData));
|
|
462
730
|
});
|
|
463
731
|
});
|
|
464
732
|
});
|
|
@@ -1062,6 +1062,90 @@ describe('The Criteo bidding adapter', function () {
|
|
|
1062
1062
|
expect(request.data.source.ext.schain).to.equal(expectedSchain);
|
|
1063
1063
|
});
|
|
1064
1064
|
|
|
1065
|
+
it('should properly build a request with bcat field', function () {
|
|
1066
|
+
const bcat = [ 'IAB1', 'IAB2' ];
|
|
1067
|
+
const bidRequests = [
|
|
1068
|
+
{
|
|
1069
|
+
bidder: 'criteo',
|
|
1070
|
+
adUnitCode: 'bid-123',
|
|
1071
|
+
transactionId: 'transaction-123',
|
|
1072
|
+
mediaTypes: {
|
|
1073
|
+
banner: {
|
|
1074
|
+
sizes: [[728, 90]]
|
|
1075
|
+
}
|
|
1076
|
+
},
|
|
1077
|
+
params: {
|
|
1078
|
+
zoneId: 123,
|
|
1079
|
+
},
|
|
1080
|
+
},
|
|
1081
|
+
];
|
|
1082
|
+
const bidderRequest = {
|
|
1083
|
+
ortb2: {
|
|
1084
|
+
bcat
|
|
1085
|
+
}
|
|
1086
|
+
};
|
|
1087
|
+
|
|
1088
|
+
const request = spec.buildRequests(bidRequests, bidderRequest);
|
|
1089
|
+
expect(request.data.bcat).to.not.be.null;
|
|
1090
|
+
expect(request.data.bcat).to.equal(bcat);
|
|
1091
|
+
});
|
|
1092
|
+
|
|
1093
|
+
it('should properly build a request with badv field', function () {
|
|
1094
|
+
const badv = [ 'ford.com' ];
|
|
1095
|
+
const bidRequests = [
|
|
1096
|
+
{
|
|
1097
|
+
bidder: 'criteo',
|
|
1098
|
+
adUnitCode: 'bid-123',
|
|
1099
|
+
transactionId: 'transaction-123',
|
|
1100
|
+
mediaTypes: {
|
|
1101
|
+
banner: {
|
|
1102
|
+
sizes: [[728, 90]]
|
|
1103
|
+
}
|
|
1104
|
+
},
|
|
1105
|
+
params: {
|
|
1106
|
+
zoneId: 123,
|
|
1107
|
+
},
|
|
1108
|
+
},
|
|
1109
|
+
];
|
|
1110
|
+
const bidderRequest = {
|
|
1111
|
+
ortb2: {
|
|
1112
|
+
badv
|
|
1113
|
+
}
|
|
1114
|
+
};
|
|
1115
|
+
|
|
1116
|
+
const request = spec.buildRequests(bidRequests, bidderRequest);
|
|
1117
|
+
expect(request.data.badv).to.not.be.null;
|
|
1118
|
+
expect(request.data.badv).to.equal(badv);
|
|
1119
|
+
});
|
|
1120
|
+
|
|
1121
|
+
it('should properly build a request with bapp field', function () {
|
|
1122
|
+
const bapp = [ 'com.foo.mygame' ];
|
|
1123
|
+
const bidRequests = [
|
|
1124
|
+
{
|
|
1125
|
+
bidder: 'criteo',
|
|
1126
|
+
adUnitCode: 'bid-123',
|
|
1127
|
+
transactionId: 'transaction-123',
|
|
1128
|
+
mediaTypes: {
|
|
1129
|
+
banner: {
|
|
1130
|
+
sizes: [[728, 90]]
|
|
1131
|
+
}
|
|
1132
|
+
},
|
|
1133
|
+
params: {
|
|
1134
|
+
zoneId: 123,
|
|
1135
|
+
},
|
|
1136
|
+
},
|
|
1137
|
+
];
|
|
1138
|
+
const bidderRequest = {
|
|
1139
|
+
ortb2: {
|
|
1140
|
+
bapp
|
|
1141
|
+
}
|
|
1142
|
+
};
|
|
1143
|
+
|
|
1144
|
+
const request = spec.buildRequests(bidRequests, bidderRequest);
|
|
1145
|
+
expect(request.data.bapp).to.not.be.null;
|
|
1146
|
+
expect(request.data.bapp).to.equal(bapp);
|
|
1147
|
+
});
|
|
1148
|
+
|
|
1065
1149
|
it('should properly build a request with if ccpa consent field is not provided', function () {
|
|
1066
1150
|
const bidRequests = [
|
|
1067
1151
|
{
|
|
@@ -2373,7 +2457,7 @@ describe('The Criteo bidding adapter', function () {
|
|
|
2373
2457
|
|
|
2374
2458
|
const adapters = { Prebid: function () { } };
|
|
2375
2459
|
const adaptersMock = sinon.mock(adapters);
|
|
2376
|
-
adaptersMock.expects('Prebid').withExactArgs(PROFILE_ID_PUBLISHERTAG, ADAPTER_VERSION, bidRequests, bidderRequest, '$prebid.version$').once().returns(prebidAdapter);
|
|
2460
|
+
adaptersMock.expects('Prebid').withExactArgs(PROFILE_ID_PUBLISHERTAG, ADAPTER_VERSION, bidRequests, bidderRequest, '$prebid.version$', sinon.match.any).once().returns(prebidAdapter);
|
|
2377
2461
|
|
|
2378
2462
|
global.Criteo = {
|
|
2379
2463
|
PubTag: {
|