prebid.js 6.1.0 → 6.5.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/.circleci/config.yml +1 -1
- package/README.md +1 -1
- package/browsers.json +13 -29
- package/gulpfile.js +87 -82
- package/integrationExamples/gpt/weboramaRtdProvider_example.html +23 -14
- package/karma.conf.maker.js +2 -2
- package/modules/33acrossBidAdapter.js +189 -102
- package/modules/adagioBidAdapter.js +1 -1
- package/modules/addefendBidAdapter.js +1 -0
- package/modules/adkernelBidAdapter.js +146 -61
- package/modules/adlooxAdServerVideo.js +2 -2
- package/modules/adlooxAnalyticsAdapter.js +4 -4
- package/modules/admanBidAdapter.js +1 -0
- package/modules/admixerBidAdapter.js +3 -2
- package/modules/adnuntiusBidAdapter.js +5 -2
- package/modules/adomikAnalyticsAdapter.js +6 -0
- package/modules/adplusBidAdapter.js +203 -0
- package/modules/adplusBidAdapter.md +39 -0
- package/modules/adxcgBidAdapter.js +311 -359
- package/modules/adxcgBidAdapter.md +22 -21
- package/modules/adyoulikeBidAdapter.js +20 -11
- package/modules/aniviewBidAdapter.js +1 -1
- package/modules/appnexusBidAdapter.js +19 -3
- package/modules/beachfrontBidAdapter.js +14 -17
- package/modules/beopBidAdapter.js +6 -4
- package/modules/bidViewability.js +3 -3
- package/modules/bidViewabilityIO.js +3 -3
- package/modules/bliinkBidAdapter.js +1 -1
- package/modules/colossussspBidAdapter.js +7 -0
- package/modules/compassBidAdapter.js +201 -0
- package/modules/compassBidAdapter.md +79 -0
- package/modules/consentManagement.js +7 -1
- package/modules/craftBidAdapter.js +5 -3
- package/modules/criteoBidAdapter.js +1 -1
- package/modules/currency.js +2 -2
- package/modules/cwireBidAdapter.js +3 -0
- package/modules/dailyhuntBidAdapter.js +435 -0
- package/modules/dailyhuntBidAdapter.md +4 -0
- package/modules/dchain.js +149 -0
- package/modules/dchain.md +45 -0
- package/modules/docereeBidAdapter.js +10 -1
- package/modules/docereeBidAdapter.md +2 -0
- package/modules/dspxBidAdapter.js +1 -1
- package/modules/emx_digitalBidAdapter.js +9 -1
- package/modules/engageyaBidAdapter.js +1 -1
- package/modules/feedadBidAdapter.js +2 -2
- package/modules/feedadBidAdapter.md +4 -2
- package/modules/freewheel-sspBidAdapter.js +6 -0
- package/modules/futureads.md +48 -0
- package/modules/glimpseBidAdapter.js +16 -3
- package/modules/goldbachBidAdapter.js +1176 -0
- package/modules/goldbachBidAdapter.md +151 -0
- package/modules/gptPreAuction.js +55 -7
- package/modules/gridBidAdapter.js +4 -3
- package/modules/gumgumBidAdapter.js +7 -3
- package/modules/improvedigitalBidAdapter.js +19 -3
- package/modules/instreamTracking.js +4 -4
- package/modules/intersectionRtdProvider.js +114 -0
- package/modules/invibesBidAdapter.js +64 -14
- package/modules/invibesBidAdapter.md +2 -1
- package/modules/ipromBidAdapter.js +79 -0
- package/modules/ixBidAdapter.js +53 -18
- package/modules/kinessoIdSystem.js +1 -1
- package/modules/limelightDigitalBidAdapter.js +3 -1
- package/modules/livewrappedAnalyticsAdapter.js +3 -1
- package/modules/livewrappedBidAdapter.js +8 -2
- package/modules/loglyliftBidAdapter.js +79 -0
- package/modules/loglyliftBidAdapter.md +55 -0
- package/modules/lotamePanoramaIdSystem.js +80 -8
- package/modules/luponmediaBidAdapter.js +570 -0
- package/modules/mediasquareBidAdapter.js +1 -9
- package/modules/missenaBidAdapter.js +89 -0
- package/modules/nextMillenniumBidAdapter.js +37 -7
- package/modules/optimeraRtdProvider.js +8 -1
- package/modules/ozoneBidAdapter.js +21 -64
- package/modules/prebidServerBidAdapter/index.js +16 -12
- package/modules/pubgeniusBidAdapter.js +1 -1
- package/modules/pubmaticBidAdapter.js +3 -3
- package/modules/pubxaiAnalyticsAdapter.js +17 -0
- package/modules/relaidoBidAdapter.js +86 -65
- package/modules/richaudienceBidAdapter.js +2 -3
- package/modules/rtdModule/index.js +48 -18
- package/modules/rubiconBidAdapter.js +31 -19
- package/modules/sharedIdSystem.js +27 -1
- package/modules/smaatoBidAdapter.js +4 -1
- package/modules/smartxBidAdapter.js +17 -1
- package/modules/tappxBidAdapter.js +3 -1
- package/modules/targetVideoBidAdapter.js +187 -0
- package/modules/targetVideoBidAdapter.md +34 -0
- package/modules/telariaBidAdapter.js +2 -2
- package/modules/trustxBidAdapter.js +8 -16
- package/modules/undertoneBidAdapter.js +8 -1
- package/modules/userId/index.js +27 -2
- package/modules/ventes.md +71 -0
- package/modules/ventesBidAdapter.js +104 -64
- package/modules/ventesBidAdapter.md +0 -1
- package/modules/vidoomyBidAdapter.js +16 -10
- package/modules/visxBidAdapter.js +19 -2
- package/modules/visxBidAdapter.md +4 -6
- package/modules/weboramaRtdProvider.js +288 -73
- package/modules/weboramaRtdProvider.md +27 -10
- package/modules/yahoosspBidAdapter.js +5 -1
- package/modules/yahoosspBidAdapter.md +1 -1
- package/modules/yieldmoBidAdapter.js +23 -5
- package/modules/yieldoneBidAdapter.js +115 -11
- package/modules/zetaSspBidAdapter.md +33 -1
- package/modules/zeta_global_sspAnalyticsAdapter.js +97 -0
- package/modules/zeta_global_sspAnalyticsAdapter.md +24 -0
- package/modules/zeta_global_sspBidAdapter.js +22 -1
- package/package.json +1 -1
- package/plugins/pbjsGlobals.js +28 -1
- package/src/auction.js +5 -4
- package/src/config.js +27 -3
- package/src/prebid.js +3 -2
- package/src/targeting.js +24 -3
- package/src/utils.js +53 -8
- package/test/helpers/prebidGlobal.js +1 -0
- package/test/spec/config_spec.js +279 -0
- package/test/spec/integration/faker/googletag.js +6 -0
- package/test/spec/modules/33acrossBidAdapter_spec.js +300 -78
- package/test/spec/modules/adlooxAnalyticsAdapter_spec.js +6 -6
- package/test/spec/modules/adnuntiusBidAdapter_spec.js +35 -0
- package/test/spec/modules/adomikAnalyticsAdapter_spec.js +6 -0
- package/test/spec/modules/adplusBidAdapter_spec.js +213 -0
- package/test/spec/modules/adxcgBidAdapter_spec.js +820 -571
- package/test/spec/modules/adyoulikeBidAdapter_spec.js +75 -0
- package/test/spec/modules/appnexusBidAdapter_spec.js +49 -1
- package/test/spec/modules/beachfrontBidAdapter_spec.js +65 -1
- package/test/spec/modules/beopBidAdapter_spec.js +1 -1
- package/test/spec/modules/bidViewabilityIO_spec.js +2 -2
- package/test/spec/modules/bidViewability_spec.js +4 -4
- package/test/spec/modules/colossussspBidAdapter_spec.js +9 -0
- package/test/spec/modules/compassBidAdapter_spec.js +397 -0
- package/test/spec/modules/consentManagement_spec.js +20 -0
- package/test/spec/modules/cwireBidAdapter_spec.js +10 -8
- package/test/spec/modules/dailyhuntBidAdapter_spec.js +404 -0
- package/test/spec/modules/dchain_spec.js +329 -0
- package/test/spec/modules/docereeBidAdapter_spec.js +9 -1
- package/test/spec/modules/emx_digitalBidAdapter_spec.js +10 -0
- package/test/spec/modules/feedadBidAdapter_spec.js +15 -0
- package/test/spec/modules/freewheel-sspBidAdapter_spec.js +19 -0
- package/test/spec/modules/goldbachBidAdapter_spec.js +1359 -0
- package/test/spec/modules/gptPreAuction_spec.js +177 -2
- package/test/spec/modules/gumgumBidAdapter_spec.js +6 -0
- package/test/spec/modules/improvedigitalBidAdapter_spec.js +3 -1
- package/test/spec/modules/intersectionRtdProvider_spec.js +141 -0
- package/test/spec/modules/invibesBidAdapter_spec.js +148 -4
- package/test/spec/modules/ipromBidAdapter_spec.js +195 -0
- package/test/spec/modules/ixBidAdapter_spec.js +112 -62
- package/test/spec/modules/limelightDigitalBidAdapter_spec.js +84 -23
- package/test/spec/modules/livewrappedAnalyticsAdapter_spec.js +22 -0
- package/test/spec/modules/livewrappedBidAdapter_spec.js +31 -0
- package/test/spec/modules/loglyliftBidAdapter_spec.js +172 -0
- package/test/spec/modules/lotamePanoramaIdSystem_spec.js +227 -0
- package/test/spec/modules/luponmediaBidAdapter_spec.js +412 -0
- package/test/spec/modules/mediasquareBidAdapter_spec.js +4 -4
- package/test/spec/modules/missenaBidAdapter_spec.js +134 -0
- package/test/spec/modules/nextMillenniumBidAdapter_spec.js +26 -1
- package/test/spec/modules/optimeraRtdProvider_spec.js +14 -1
- package/test/spec/modules/ozoneBidAdapter_spec.js +43 -31
- package/test/spec/modules/prebidServerBidAdapter_spec.js +43 -0
- package/test/spec/modules/pubgeniusBidAdapter_spec.js +3 -3
- package/test/spec/modules/pubmaticBidAdapter_spec.js +1 -1
- package/test/spec/modules/pubxaiAnalyticsAdapter_spec.js +11 -0
- package/test/spec/modules/realTimeDataModule_spec.js +135 -49
- package/test/spec/modules/relaidoBidAdapter_spec.js +71 -63
- package/test/spec/modules/richaudienceBidAdapter_spec.js +2 -2
- package/test/spec/modules/rubiconBidAdapter_spec.js +65 -9
- package/test/spec/modules/sharedIdSystem_spec.js +52 -6
- package/test/spec/modules/smaatoBidAdapter_spec.js +31 -0
- package/test/spec/modules/smartxBidAdapter_spec.js +9 -0
- package/test/spec/modules/tappxBidAdapter_spec.js +4 -0
- package/test/spec/modules/targetVideoBidAdapter_spec.js +96 -0
- package/test/spec/modules/userId_spec.js +51 -0
- package/test/spec/modules/visxBidAdapter_spec.js +120 -4
- package/test/spec/modules/weboramaRtdProvider_spec.js +408 -214
- package/test/spec/modules/yahoosspBidAdapter_spec.js +28 -1
- package/test/spec/modules/yieldoneBidAdapter_spec.js +299 -53
- package/test/spec/modules/zeta_global_sspAnalyticsAdapter_spec.js +427 -0
- package/test/spec/modules/zeta_global_sspBidAdapter_spec.js +33 -1
- package/test/spec/unit/core/targeting_spec.js +116 -0
- package/test/spec/utils_spec.js +38 -0
- package/test/test_deps.js +3 -0
- package/test/test_index.js +1 -3
|
@@ -552,6 +552,28 @@ describe('Livewrapped analytics adapter', function () {
|
|
|
552
552
|
expect(message.wins[0].floor).to.equal(1.1);
|
|
553
553
|
expect(message.wins[1].floor).to.equal(2.2);
|
|
554
554
|
});
|
|
555
|
+
|
|
556
|
+
it('should forward runner-up data as given by Livewrapped wrapper', function () {
|
|
557
|
+
events.emit(AUCTION_INIT, MOCK.AUCTION_INIT);
|
|
558
|
+
events.emit(BID_REQUESTED, MOCK.BID_REQUESTED);
|
|
559
|
+
|
|
560
|
+
events.emit(BID_RESPONSE, MOCK.BID_RESPONSE[0]);
|
|
561
|
+
events.emit(BID_WON, Object.assign({},
|
|
562
|
+
MOCK.BID_WON[0],
|
|
563
|
+
{
|
|
564
|
+
'rUp': 'rUpObject'
|
|
565
|
+
}));
|
|
566
|
+
events.emit(AUCTION_END, MOCK.AUCTION_END);
|
|
567
|
+
|
|
568
|
+
clock.tick(BID_WON_TIMEOUT + 1000);
|
|
569
|
+
|
|
570
|
+
expect(server.requests.length).to.equal(1);
|
|
571
|
+
let request = server.requests[0];
|
|
572
|
+
let message = JSON.parse(request.requestBody);
|
|
573
|
+
|
|
574
|
+
expect(message.wins.length).to.equal(1);
|
|
575
|
+
expect(message.wins[0].rUp).to.equal('rUpObject');
|
|
576
|
+
});
|
|
555
577
|
});
|
|
556
578
|
|
|
557
579
|
describe('when given other endpoint', function () {
|
|
@@ -885,6 +885,37 @@ describe('Livewrapped adapter tests', function () {
|
|
|
885
885
|
expect(data.rtbData.user.ext.eids).to.deep.equal(testbidRequest.bids[0].userIdAsEids);
|
|
886
886
|
});
|
|
887
887
|
|
|
888
|
+
it('should merge user ids with existing ortb2', function() {
|
|
889
|
+
sandbox.stub(utils, 'isSafariBrowser').callsFake(() => false);
|
|
890
|
+
sandbox.stub(storage, 'cookiesAreEnabled').callsFake(() => true);
|
|
891
|
+
|
|
892
|
+
let origGetConfig = config.getConfig;
|
|
893
|
+
sandbox.stub(config, 'getConfig').callsFake(function (key) {
|
|
894
|
+
if (key === 'ortb2') {
|
|
895
|
+
return {user: {ext: {prop: 'value'}}};
|
|
896
|
+
}
|
|
897
|
+
return origGetConfig.apply(config, arguments);
|
|
898
|
+
});
|
|
899
|
+
|
|
900
|
+
let testbidRequest = clone(bidderRequest);
|
|
901
|
+
delete testbidRequest.bids[0].params.userId;
|
|
902
|
+
testbidRequest.bids[0].userIdAsEids = [
|
|
903
|
+
{
|
|
904
|
+
'source': 'pubcid.org',
|
|
905
|
+
'uids': [{
|
|
906
|
+
'id': 'publisher-common-id',
|
|
907
|
+
'atype': 1
|
|
908
|
+
}]
|
|
909
|
+
}
|
|
910
|
+
];
|
|
911
|
+
|
|
912
|
+
let result = spec.buildRequests(testbidRequest.bids, testbidRequest);
|
|
913
|
+
let data = JSON.parse(result.data);
|
|
914
|
+
var expected = {user: {ext: {prop: 'value', eids: testbidRequest.bids[0].userIdAsEids}}}
|
|
915
|
+
|
|
916
|
+
expect(data.rtbData).to.deep.equal(expected);
|
|
917
|
+
});
|
|
918
|
+
|
|
888
919
|
it('should send schain object if available', function() {
|
|
889
920
|
sandbox.stub(utils, 'isSafariBrowser').callsFake(() => false);
|
|
890
921
|
sandbox.stub(storage, 'cookiesAreEnabled').callsFake(() => true);
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
import { expect } from 'chai';
|
|
2
|
+
import { spec } from '../../../modules/loglyliftBidAdapter';
|
|
3
|
+
import * as utils from 'src/utils.js';
|
|
4
|
+
|
|
5
|
+
describe('loglyliftBidAdapter', function () {
|
|
6
|
+
const nativeBidRequests = [{
|
|
7
|
+
bidder: 'loglylift',
|
|
8
|
+
bidId: '254304ac29e265',
|
|
9
|
+
params: {
|
|
10
|
+
adspotId: 16
|
|
11
|
+
},
|
|
12
|
+
adUnitCode: '/19968336/prebid_native_example_1',
|
|
13
|
+
transactionId: '10aee457-617c-4572-ab5b-99df1d73ccb4',
|
|
14
|
+
sizes: [
|
|
15
|
+
[]
|
|
16
|
+
],
|
|
17
|
+
bidderRequestId: '15da3afd9632d7',
|
|
18
|
+
auctionId: 'f890b7d9-e787-4237-ac21-6d8554abac9f',
|
|
19
|
+
mediaTypes: {
|
|
20
|
+
native: {
|
|
21
|
+
body: {
|
|
22
|
+
required: true
|
|
23
|
+
},
|
|
24
|
+
icon: {
|
|
25
|
+
required: false
|
|
26
|
+
},
|
|
27
|
+
title: {
|
|
28
|
+
required: true
|
|
29
|
+
},
|
|
30
|
+
image: {
|
|
31
|
+
required: true
|
|
32
|
+
},
|
|
33
|
+
sponsoredBy: {
|
|
34
|
+
required: true
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}];
|
|
39
|
+
|
|
40
|
+
const bidderRequest = {
|
|
41
|
+
refererInfo: {
|
|
42
|
+
referer: 'fakeReferer',
|
|
43
|
+
reachedTop: true,
|
|
44
|
+
numIframes: 1,
|
|
45
|
+
stack: []
|
|
46
|
+
},
|
|
47
|
+
auctionStart: 1632194172781,
|
|
48
|
+
bidderCode: 'loglylift',
|
|
49
|
+
bidderRequestId: '15da3afd9632d7',
|
|
50
|
+
auctionId: 'f890b7d9-e787-4237-ac21-6d8554abac9f',
|
|
51
|
+
timeout: 3000
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
const nativeServerResponse = {
|
|
55
|
+
body: {
|
|
56
|
+
bids: [{
|
|
57
|
+
requestId: '254304ac29e265',
|
|
58
|
+
cpm: 10.123,
|
|
59
|
+
width: 360,
|
|
60
|
+
height: 360,
|
|
61
|
+
creativeId: '123456789',
|
|
62
|
+
currency: 'JPY',
|
|
63
|
+
netRevenue: true,
|
|
64
|
+
ttl: 30,
|
|
65
|
+
meta: {
|
|
66
|
+
advertiserDomains: ['advertiserexample.com']
|
|
67
|
+
},
|
|
68
|
+
native: {
|
|
69
|
+
clickUrl: 'https://dsp.logly.co.jp/click?ad=EXAMPECLICKURL',
|
|
70
|
+
image: {
|
|
71
|
+
url: 'https://cdn.logly.co.jp/images/000/194/300/normal.jpg',
|
|
72
|
+
width: '360',
|
|
73
|
+
height: '360'
|
|
74
|
+
},
|
|
75
|
+
impressionTrackers: [
|
|
76
|
+
'https://b.logly.co.jp/sorry.html'
|
|
77
|
+
],
|
|
78
|
+
sponsoredBy: 'logly',
|
|
79
|
+
title: 'Native Title',
|
|
80
|
+
}
|
|
81
|
+
}],
|
|
82
|
+
}
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
describe('isBidRequestValid', function () {
|
|
86
|
+
it('should return true if the adspotId parameter is present', function () {
|
|
87
|
+
expect(spec.isBidRequestValid(nativeBidRequests[0])).to.be.true;
|
|
88
|
+
});
|
|
89
|
+
|
|
90
|
+
it('should return false if the adspotId parameter is not present', function () {
|
|
91
|
+
let bidRequest = utils.deepClone(nativeBidRequests[0]);
|
|
92
|
+
delete bidRequest.params.adspotId;
|
|
93
|
+
expect(spec.isBidRequestValid(bidRequest)).to.be.false;
|
|
94
|
+
});
|
|
95
|
+
});
|
|
96
|
+
|
|
97
|
+
describe('buildRequests', function () {
|
|
98
|
+
it('should generate a valid single POST request for multiple bid requests', function () {
|
|
99
|
+
const request = spec.buildRequests(nativeBidRequests, bidderRequest)[0];
|
|
100
|
+
expect(request.method).to.equal('POST');
|
|
101
|
+
expect(request.url).to.equal('https://bid.logly.co.jp/prebid/client/v1?adspot_id=16');
|
|
102
|
+
expect(request.data).to.exist;
|
|
103
|
+
|
|
104
|
+
const data = JSON.parse(request.data);
|
|
105
|
+
expect(data.auctionId).to.equal(nativeBidRequests[0].auctionId);
|
|
106
|
+
expect(data.bidderRequestId).to.equal(nativeBidRequests[0].bidderRequestId);
|
|
107
|
+
expect(data.transactionId).to.equal(nativeBidRequests[0].transactionId);
|
|
108
|
+
expect(data.adUnitCode).to.equal(nativeBidRequests[0].adUnitCode);
|
|
109
|
+
expect(data.bidId).to.equal(nativeBidRequests[0].bidId);
|
|
110
|
+
expect(data.mediaTypes).to.deep.equal(nativeBidRequests[0].mediaTypes);
|
|
111
|
+
expect(data.params).to.deep.equal(nativeBidRequests[0].params);
|
|
112
|
+
expect(data.prebidJsVersion).to.equal('6.5.0-pre');
|
|
113
|
+
expect(data.url).to.exist;
|
|
114
|
+
expect(data.domain).to.exist;
|
|
115
|
+
expect(data.referer).to.equal(bidderRequest.refererInfo.referer);
|
|
116
|
+
expect(data.auctionStartTime).to.equal(bidderRequest.auctionStart);
|
|
117
|
+
expect(data.currency).to.exist;
|
|
118
|
+
expect(data.timeout).to.equal(bidderRequest.timeout);
|
|
119
|
+
});
|
|
120
|
+
});
|
|
121
|
+
|
|
122
|
+
describe('interpretResponse', function () {
|
|
123
|
+
it('should return an empty array if an invalid response is passed', function () {
|
|
124
|
+
const interpretedResponse = spec.interpretResponse({}, {});
|
|
125
|
+
expect(interpretedResponse).to.be.an('array').that.is.empty;
|
|
126
|
+
});
|
|
127
|
+
|
|
128
|
+
it('should return valid response when passed valid server response', function () {
|
|
129
|
+
const request = spec.buildRequests(nativeBidRequests, bidderRequest)[0];
|
|
130
|
+
const interpretedResponse = spec.interpretResponse(nativeServerResponse, request);
|
|
131
|
+
|
|
132
|
+
expect(interpretedResponse).to.have.lengthOf(1);
|
|
133
|
+
expect(interpretedResponse[0].cpm).to.equal(nativeServerResponse.body.bids[0].cpm);
|
|
134
|
+
expect(interpretedResponse[0].width).to.equal(nativeServerResponse.body.bids[0].width);
|
|
135
|
+
expect(interpretedResponse[0].height).to.equal(nativeServerResponse.body.bids[0].height);
|
|
136
|
+
expect(interpretedResponse[0].creativeId).to.equal(nativeServerResponse.body.bids[0].creativeId);
|
|
137
|
+
expect(interpretedResponse[0].currency).to.equal(nativeServerResponse.body.bids[0].currency);
|
|
138
|
+
expect(interpretedResponse[0].netRevenue).to.equal(nativeServerResponse.body.bids[0].netRevenue);
|
|
139
|
+
expect(interpretedResponse[0].ttl).to.equal(nativeServerResponse.body.bids[0].ttl);
|
|
140
|
+
expect(interpretedResponse[0].native).to.deep.equal(nativeServerResponse.body.bids[0].native);
|
|
141
|
+
expect(interpretedResponse[0].meta.advertiserDomains[0]).to.equal(nativeServerResponse.body.bids[0].meta.advertiserDomains[0]);
|
|
142
|
+
});
|
|
143
|
+
});
|
|
144
|
+
|
|
145
|
+
describe('getUserSync tests', function () {
|
|
146
|
+
it('UserSync test : check type = iframe, check usermatch URL', function () {
|
|
147
|
+
const syncOptions = {
|
|
148
|
+
'iframeEnabled': true
|
|
149
|
+
}
|
|
150
|
+
let userSync = spec.getUserSyncs(syncOptions, [nativeServerResponse]);
|
|
151
|
+
expect(userSync[0].type).to.equal('iframe');
|
|
152
|
+
const USER_SYNC_URL = 'https://sync.logly.co.jp/sync/sync.html';
|
|
153
|
+
expect(userSync[0].url).to.equal(USER_SYNC_URL);
|
|
154
|
+
});
|
|
155
|
+
|
|
156
|
+
it('When iframeEnabled is false, no userSync should be returned', function () {
|
|
157
|
+
const syncOptions = {
|
|
158
|
+
'iframeEnabled': false
|
|
159
|
+
}
|
|
160
|
+
let userSync = spec.getUserSyncs(syncOptions, [nativeServerResponse]);
|
|
161
|
+
expect(userSync).to.be.an('array').that.is.empty;
|
|
162
|
+
});
|
|
163
|
+
|
|
164
|
+
it('When nativeServerResponses empty, no userSync should be returned', function () {
|
|
165
|
+
const syncOptions = {
|
|
166
|
+
'iframeEnabled': false
|
|
167
|
+
}
|
|
168
|
+
let userSync = spec.getUserSyncs(syncOptions, []);
|
|
169
|
+
expect(userSync).to.be.an('array').that.is.empty;
|
|
170
|
+
});
|
|
171
|
+
});
|
|
172
|
+
});
|
|
@@ -2,6 +2,7 @@ import {
|
|
|
2
2
|
lotamePanoramaIdSubmodule,
|
|
3
3
|
storage,
|
|
4
4
|
} from 'modules/lotamePanoramaIdSystem.js';
|
|
5
|
+
import { uspDataHandler } from 'src/adapterManager.js';
|
|
5
6
|
import * as utils from 'src/utils.js';
|
|
6
7
|
import { server } from 'test/mocks/xhr.js';
|
|
7
8
|
import sinon from 'sinon';
|
|
@@ -16,6 +17,7 @@ describe('LotameId', function() {
|
|
|
16
17
|
let setLocalStorageStub;
|
|
17
18
|
let removeFromLocalStorageStub;
|
|
18
19
|
let timeStampStub;
|
|
20
|
+
let uspConsentDataStub;
|
|
19
21
|
|
|
20
22
|
const nowTimestamp = new Date().getTime();
|
|
21
23
|
|
|
@@ -30,6 +32,7 @@ describe('LotameId', function() {
|
|
|
30
32
|
'removeDataFromLocalStorage'
|
|
31
33
|
);
|
|
32
34
|
timeStampStub = sinon.stub(utils, 'timestamp').returns(nowTimestamp);
|
|
35
|
+
uspConsentDataStub = sinon.stub(uspDataHandler, 'getConsentData');
|
|
33
36
|
});
|
|
34
37
|
|
|
35
38
|
afterEach(function () {
|
|
@@ -40,6 +43,7 @@ describe('LotameId', function() {
|
|
|
40
43
|
setLocalStorageStub.restore();
|
|
41
44
|
removeFromLocalStorageStub.restore();
|
|
42
45
|
timeStampStub.restore();
|
|
46
|
+
uspConsentDataStub.restore();
|
|
43
47
|
});
|
|
44
48
|
|
|
45
49
|
describe('caching initial data received from the remote server', function () {
|
|
@@ -726,4 +730,227 @@ describe('LotameId', function() {
|
|
|
726
730
|
);
|
|
727
731
|
});
|
|
728
732
|
});
|
|
733
|
+
|
|
734
|
+
describe('with a custom client id', function () {
|
|
735
|
+
describe('with a client expiry set', function () {
|
|
736
|
+
beforeEach(function () {
|
|
737
|
+
getCookieStub
|
|
738
|
+
.withArgs('panoramaId_expiry_1234')
|
|
739
|
+
.returns(String(Date.now() + 500 * 1000));
|
|
740
|
+
});
|
|
741
|
+
|
|
742
|
+
describe('and an existing pano id', function() {
|
|
743
|
+
let submoduleCallback;
|
|
744
|
+
beforeEach(function () {
|
|
745
|
+
getCookieStub
|
|
746
|
+
.withArgs('panoramaId_expiry')
|
|
747
|
+
.returns(String(Date.now() + 100000));
|
|
748
|
+
getCookieStub
|
|
749
|
+
.withArgs('panoramaId')
|
|
750
|
+
.returns(
|
|
751
|
+
'ca22992567e3cd4d116a5899b88a55d0d857a23610db939ae6ac13ba2335d87c'
|
|
752
|
+
);
|
|
753
|
+
submoduleCallback = lotamePanoramaIdSubmodule.getId(
|
|
754
|
+
{
|
|
755
|
+
params: {
|
|
756
|
+
clientId: '1234',
|
|
757
|
+
},
|
|
758
|
+
},
|
|
759
|
+
{
|
|
760
|
+
gdprApplies: false,
|
|
761
|
+
}
|
|
762
|
+
);
|
|
763
|
+
});
|
|
764
|
+
|
|
765
|
+
it('should not call the remote server when getId is called nor get an id', function () {
|
|
766
|
+
expect(submoduleCallback).to.be.eql({
|
|
767
|
+
id: undefined,
|
|
768
|
+
reason: 'NO_CLIENT_CONSENT',
|
|
769
|
+
});
|
|
770
|
+
});
|
|
771
|
+
});
|
|
772
|
+
|
|
773
|
+
describe('and no existing pano id', function () {
|
|
774
|
+
let submoduleCallback;
|
|
775
|
+
|
|
776
|
+
beforeEach(function () {
|
|
777
|
+
// Let the panoramaId_expiry be empty
|
|
778
|
+
|
|
779
|
+
submoduleCallback = lotamePanoramaIdSubmodule.getId(
|
|
780
|
+
{
|
|
781
|
+
params: {
|
|
782
|
+
clientId: '1234',
|
|
783
|
+
},
|
|
784
|
+
},
|
|
785
|
+
{
|
|
786
|
+
gdprApplies: false,
|
|
787
|
+
}
|
|
788
|
+
);
|
|
789
|
+
});
|
|
790
|
+
|
|
791
|
+
it('should not call the remote server nor return an id', function () {
|
|
792
|
+
expect(submoduleCallback).to.be.eql({
|
|
793
|
+
id: undefined,
|
|
794
|
+
reason: 'NO_CLIENT_CONSENT',
|
|
795
|
+
});
|
|
796
|
+
});
|
|
797
|
+
});
|
|
798
|
+
});
|
|
799
|
+
|
|
800
|
+
describe('with no client expiry set', function () {
|
|
801
|
+
describe('and no existing pano id', function () {
|
|
802
|
+
let request;
|
|
803
|
+
let callBackSpy = sinon.spy();
|
|
804
|
+
|
|
805
|
+
beforeEach(function () {
|
|
806
|
+
uspConsentDataStub.returns('1NNN');
|
|
807
|
+
let submoduleCallback = lotamePanoramaIdSubmodule.getId(
|
|
808
|
+
{
|
|
809
|
+
params: {
|
|
810
|
+
clientId: '1234',
|
|
811
|
+
},
|
|
812
|
+
},
|
|
813
|
+
{
|
|
814
|
+
gdprApplies: false,
|
|
815
|
+
}
|
|
816
|
+
).callback;
|
|
817
|
+
submoduleCallback(callBackSpy);
|
|
818
|
+
|
|
819
|
+
request = server.requests[0];
|
|
820
|
+
|
|
821
|
+
request.respond(
|
|
822
|
+
200,
|
|
823
|
+
responseHeader,
|
|
824
|
+
JSON.stringify({
|
|
825
|
+
profile_id: '4ec137245858469eb94a4e248f238694',
|
|
826
|
+
core_id:
|
|
827
|
+
'ca22992567e3cd4d116a5899b88a55d0d857a23610db939ae6ac13ba2335d87f',
|
|
828
|
+
expiry_ts: 3600000,
|
|
829
|
+
})
|
|
830
|
+
);
|
|
831
|
+
});
|
|
832
|
+
|
|
833
|
+
it('should call the remote server when getId is called', function () {
|
|
834
|
+
expect(callBackSpy.calledOnce).to.be.true;
|
|
835
|
+
});
|
|
836
|
+
|
|
837
|
+
it('should pass the usp consent string and client id back', function () {
|
|
838
|
+
expect(request.url).to.be.eq(
|
|
839
|
+
'https://id.crwdcntrl.net/id?gdpr_applies=false&us_privacy=1NNN&c=1234'
|
|
840
|
+
);
|
|
841
|
+
});
|
|
842
|
+
|
|
843
|
+
it('should NOT set an expiry for the client', function () {
|
|
844
|
+
sinon.assert.neverCalledWith(
|
|
845
|
+
setCookieStub,
|
|
846
|
+
'panoramaId_expiry_1234',
|
|
847
|
+
sinon.match.number
|
|
848
|
+
);
|
|
849
|
+
});
|
|
850
|
+
});
|
|
851
|
+
|
|
852
|
+
describe('and an existing pano id', function () {
|
|
853
|
+
let submoduleCallback;
|
|
854
|
+
|
|
855
|
+
beforeEach(function () {
|
|
856
|
+
getCookieStub
|
|
857
|
+
.withArgs('panoramaId_expiry')
|
|
858
|
+
.returns(String(Date.now() + 100000));
|
|
859
|
+
getCookieStub
|
|
860
|
+
.withArgs('panoramaId')
|
|
861
|
+
.returns(
|
|
862
|
+
'ca22992567e3cd4d116a5899b88a55d0d857a23610db939ae6ac13ba2335d87c'
|
|
863
|
+
);
|
|
864
|
+
submoduleCallback = lotamePanoramaIdSubmodule.getId(
|
|
865
|
+
{
|
|
866
|
+
params: {
|
|
867
|
+
clientId: '1234',
|
|
868
|
+
},
|
|
869
|
+
},
|
|
870
|
+
{
|
|
871
|
+
gdprApplies: false,
|
|
872
|
+
}
|
|
873
|
+
);
|
|
874
|
+
});
|
|
875
|
+
|
|
876
|
+
it('should not call the remote server but use the cached value', function () {
|
|
877
|
+
expect(submoduleCallback).to.be.eql({
|
|
878
|
+
id: 'ca22992567e3cd4d116a5899b88a55d0d857a23610db939ae6ac13ba2335d87c',
|
|
879
|
+
});
|
|
880
|
+
});
|
|
881
|
+
|
|
882
|
+
it('should NOT set an expiry for the client', function () {
|
|
883
|
+
sinon.assert.neverCalledWith(
|
|
884
|
+
setCookieStub,
|
|
885
|
+
'panoramaId_expiry_1234',
|
|
886
|
+
sinon.match.number
|
|
887
|
+
);
|
|
888
|
+
});
|
|
889
|
+
});
|
|
890
|
+
});
|
|
891
|
+
describe('when client consent has errors', function () {
|
|
892
|
+
let request;
|
|
893
|
+
let callBackSpy = sinon.spy();
|
|
894
|
+
|
|
895
|
+
beforeEach(function () {
|
|
896
|
+
let submoduleCallback = lotamePanoramaIdSubmodule.getId(
|
|
897
|
+
{
|
|
898
|
+
params: {
|
|
899
|
+
clientId: '1234',
|
|
900
|
+
},
|
|
901
|
+
},
|
|
902
|
+
{
|
|
903
|
+
gdprApplies: false,
|
|
904
|
+
}
|
|
905
|
+
).callback;
|
|
906
|
+
submoduleCallback(callBackSpy);
|
|
907
|
+
|
|
908
|
+
request = server.requests[0];
|
|
909
|
+
|
|
910
|
+
request.respond(
|
|
911
|
+
200,
|
|
912
|
+
responseHeader,
|
|
913
|
+
JSON.stringify({
|
|
914
|
+
expiry_ts: 3600000,
|
|
915
|
+
errors: [111],
|
|
916
|
+
no_consent: 'CLIENT',
|
|
917
|
+
})
|
|
918
|
+
);
|
|
919
|
+
});
|
|
920
|
+
|
|
921
|
+
it('should call the remote server when getId is called', function () {
|
|
922
|
+
expect(callBackSpy.calledOnce).to.be.true;
|
|
923
|
+
});
|
|
924
|
+
|
|
925
|
+
it('should pass client id back', function () {
|
|
926
|
+
expect(request.url).to.be.eq(
|
|
927
|
+
'https://id.crwdcntrl.net/id?gdpr_applies=false&c=1234'
|
|
928
|
+
);
|
|
929
|
+
});
|
|
930
|
+
|
|
931
|
+
it('should set the received expiry for the client', function() {
|
|
932
|
+
sinon.assert.calledWith(
|
|
933
|
+
setCookieStub,
|
|
934
|
+
'panoramaId_expiry_1234',
|
|
935
|
+
3600000
|
|
936
|
+
);
|
|
937
|
+
});
|
|
938
|
+
|
|
939
|
+
it('should not clear the cache for the panorama id', function() {
|
|
940
|
+
sinon.assert.neverCalledWith(
|
|
941
|
+
setCookieStub,
|
|
942
|
+
'panoramaId',
|
|
943
|
+
sinon.match.any
|
|
944
|
+
);
|
|
945
|
+
});
|
|
946
|
+
|
|
947
|
+
it('should not clear the cache for the panorama id expiry', function () {
|
|
948
|
+
sinon.assert.neverCalledWith(
|
|
949
|
+
setCookieStub,
|
|
950
|
+
'panoramaId_expiry',
|
|
951
|
+
sinon.match.any
|
|
952
|
+
);
|
|
953
|
+
});
|
|
954
|
+
});
|
|
955
|
+
});
|
|
729
956
|
});
|