prebid.js 7.44.0 → 7.45.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/33acrossBidAdapter.js +1 -1
- package/dist/33acrossIdSystem.js +1 -1
- package/dist/acuityAdsBidAdapter.js +1 -1
- package/dist/adagioBidAdapter.js +1 -1
- package/dist/adbookpspBidAdapter.js +1 -1
- package/dist/adgenerationBidAdapter.js +1 -1
- package/dist/adrelevantisBidAdapter.js +1 -1
- package/dist/adtrgtmeBidAdapter.js +1 -1
- package/dist/adxcgBidAdapter.js +1 -1
- package/dist/adyoulikeBidAdapter.js +1 -1
- package/dist/ajaBidAdapter.js +1 -1
- 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/appushBidAdapter.js +1 -1
- package/dist/asoBidAdapter.js +1 -1
- package/dist/axonixBidAdapter.js +1 -1
- package/dist/beyondmediaBidAdapter.js +1 -1
- package/dist/bidglassBidAdapter.js +1 -1
- package/dist/big-richmediaBidAdapter.js +1 -1
- package/dist/braveBidAdapter.js +1 -1
- package/dist/bridgewellBidAdapter.js +1 -1
- package/dist/brightMountainMediaBidAdapter.js +1 -1
- package/dist/brightcomBidAdapter.js +1 -1
- package/dist/brightcomSSPBidAdapter.js +1 -1
- package/dist/carodaBidAdapter.js +1 -1
- package/dist/chtnwBidAdapter.js +1 -1
- package/dist/coinzillaBidAdapter.js +1 -1
- package/dist/compassBidAdapter.js +1 -1
- 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/contentexchangeBidAdapter.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 +12 -0
- package/dist/domainOverrideToRootDomain.js +1 -0
- package/dist/dspxBidAdapter.js +1 -1
- package/dist/eplanningBidAdapter.js +1 -1
- package/dist/feedadBidAdapter.js +1 -1
- package/dist/finativeBidAdapter.js +1 -1
- package/dist/freewheel-sspBidAdapter.js +1 -1
- package/dist/glimpseBidAdapter.js +1 -1
- package/dist/globalsunBidAdapter.js +1 -1
- package/dist/gmosspBidAdapter.js +1 -1
- package/dist/goldbachBidAdapter.js +1 -1
- package/dist/greenbidsAnalyticsAdapter.js +1 -1
- package/dist/gridBidAdapter.js +1 -1
- package/dist/gridNMBidAdapter.js +1 -1
- package/dist/growthCodeIdSystem.js +1 -1
- 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/iqzoneBidAdapter.js +1 -1
- package/dist/ivsBidAdapter.js +1 -0
- package/dist/ixBidAdapter.js +1 -1
- package/dist/justpremiumBidAdapter.js +1 -1
- package/dist/jwplayerVideoProvider.js +1 -1
- package/dist/kargoBidAdapter.js +1 -1
- package/dist/koblerBidAdapter.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/liveIntentIdSystem.js +1 -1
- package/dist/liveyieldAnalyticsAdapter.js +1 -1
- package/dist/logicadBidAdapter.js +1 -1
- package/dist/loglyliftBidAdapter.js +1 -1
- package/dist/luponmediaBidAdapter.js +1 -1
- package/dist/magniteAnalyticsAdapter.js +1 -1
- package/dist/malltvAnalyticsAdapter.js +1 -1
- package/dist/marsmediaBidAdapter.js +1 -1
- package/dist/mathildeadsBidAdapter.js +1 -1
- package/dist/mediafuseBidAdapter.js +1 -1
- package/dist/medianetBidAdapter.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 +158 -156
- package/dist/oguryBidAdapter.js +1 -1
- package/dist/onetagBidAdapter.js +1 -1
- package/dist/onomagicBidAdapter.js +1 -1
- package/dist/ooloAnalyticsAdapter.js +1 -1
- package/dist/openxBidAdapter.js +1 -1
- package/dist/openxOrtbBidAdapter.js +1 -1
- package/dist/operaadsBidAdapter.js +1 -1
- package/dist/optidigitalBidAdapter.js +1 -1
- package/dist/outbrainBidAdapter.js +1 -1
- package/dist/parrableIdSystem.js +1 -1
- package/dist/pixfutureBidAdapter.js +1 -1
- package/dist/prebid-core.js +1 -1
- package/dist/publinkIdSystem.js +1 -1
- package/dist/pubmaticBidAdapter.js +1 -1
- package/dist/pubwiseAnalyticsAdapter.js +1 -1
- package/dist/pubxBidAdapter.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/rhythmoneBidAdapter.js +1 -1
- package/dist/riseBidAdapter.js +1 -1
- package/dist/rubiconAnalyticsAdapter.js +1 -1
- package/dist/rubiconBidAdapter.js +1 -1
- package/dist/seedingAllianceBidAdapter.js +1 -1
- package/dist/seedtagBidAdapter.js +1 -1
- package/dist/sharedIdSystem.js +1 -1
- package/dist/sharethroughAnalyticsAdapter.js +1 -1
- package/dist/sharethroughBidAdapter.js +1 -1
- package/dist/shinezBidAdapter.js +1 -1
- package/dist/smaatoBidAdapter.js +1 -1
- package/dist/smartadserverBidAdapter.js +1 -1
- package/dist/smarthubBidAdapter.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/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/truereachBidAdapter.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/userId.js +1 -1
- package/dist/vidazooBidAdapter.js +1 -1
- package/dist/videobyteBidAdapter.js +1 -1
- package/dist/videoheroesBidAdapter.js +1 -1
- package/dist/vidoomyBidAdapter.js +1 -1
- package/dist/visiblemeasuresBidAdapter.js +1 -1
- package/dist/visxBidAdapter.js +1 -1
- package/dist/vrtcalBidAdapter.js +1 -1
- package/dist/vuukleBidAdapter.js +1 -1
- package/dist/widespaceBidAdapter.js +1 -1
- package/dist/winrBidAdapter.js +1 -1
- package/dist/yahoosspBidAdapter.js +1 -1
- package/dist/yieldmoBidAdapter.js +1 -1
- package/dist/yieldoneAnalyticsAdapter.js +1 -1
- package/dist/yieldoneBidAdapter.js +1 -1
- package/libraries/domainOverrideToRootDomain/index.js +39 -0
- package/modules/acuityAdsBidAdapter.js +1 -1
- package/modules/amxBidAdapter.js +1 -1
- package/modules/amxIdSystem.js +23 -20
- package/modules/amxIdSystem.md +7 -7
- package/modules/appushBidAdapter.js +1 -1
- package/modules/beyondmediaBidAdapter.js +1 -1
- package/modules/braveBidAdapter.js +1 -1
- package/modules/brightcomBidAdapter.js +1 -1
- package/modules/brightcomSSPBidAdapter.js +1 -1
- package/modules/coinzillaBidAdapter.js +1 -2
- package/modules/compassBidAdapter.js +1 -1
- package/modules/connectIdSystem.js +96 -21
- package/modules/connectIdSystem.md +6 -5
- package/modules/contentexchangeBidAdapter.js +1 -1
- package/modules/freewheel-sspBidAdapter.js +8 -0
- package/modules/glimpseBidAdapter.js +1 -2
- package/modules/globalsunBidAdapter.js +1 -1
- package/modules/gridBidAdapter.js +1 -1
- package/modules/gridNMBidAdapter.js +1 -1
- package/modules/growthCodeIdSystem.js +18 -15
- package/modules/gumgumBidAdapter.js +1 -1
- package/modules/iqzoneBidAdapter.js +1 -1
- package/modules/ivsBidAdapter.js +85 -0
- package/modules/ivsBidAdapter.md +34 -0
- package/modules/ixBidAdapter.js +42 -105
- package/modules/jwplayerVideoProvider.js +25 -32
- package/modules/koblerBidAdapter.js +1 -2
- package/modules/kueezBidAdapter.js +1 -1
- package/modules/liveIntentIdSystem.js +8 -0
- package/modules/luponmediaBidAdapter.js +1 -1
- package/modules/magniteAnalyticsAdapter.js +76 -3
- package/modules/mathildeadsBidAdapter.js +1 -1
- package/modules/medianetBidAdapter.js +1 -1
- package/modules/mgidBidAdapter.js +178 -26
- package/modules/minutemediaBidAdapter.js +1 -1
- package/modules/oguryBidAdapter.js +3 -2
- package/modules/onomagicBidAdapter.js +1 -2
- package/modules/openxBidAdapter.js +192 -563
- package/modules/openxBidAdapter.md +22 -20
- package/modules/openxOrtbBidAdapter.js +13 -11
- package/modules/openxOrtbBidAdapter.md +5 -3
- package/modules/operaadsBidAdapter.js +1 -1
- package/modules/pubmaticBidAdapter.js +1 -1
- package/modules/pubxBidAdapter.js +5 -2
- package/modules/riseBidAdapter.js +1 -1
- package/modules/sharedIdSystem.js +4 -27
- package/modules/sharethroughBidAdapter.js +1 -1
- package/modules/shinezBidAdapter.js +1 -1
- package/modules/smarthubBidAdapter.js +1 -1
- package/modules/synacormediaBidAdapter.js +1 -3
- package/modules/truereachBidAdapter.js +1 -2
- package/modules/userId/eids.js +18 -0
- package/modules/userId/eids.md +16 -0
- package/modules/videoheroesBidAdapter.js +1 -1
- package/modules/vidoomyBidAdapter.js +22 -1
- package/modules/visiblemeasuresBidAdapter.js +1 -1
- package/modules/vrtcalBidAdapter.js +1 -1
- package/modules/yieldoneBidAdapter.js +1 -1
- package/package.json +1 -1
- package/src/Renderer.js +2 -1
- package/src/native.js +5 -1
- package/test/spec/auctionmanager_spec.js +2 -2
- package/test/spec/libraries/domainOverrideToRootDomain/index_spec.js +77 -0
- package/test/spec/modules/acuityAdsBidAdapter_spec.js +2 -1
- package/test/spec/modules/amxIdSystem_spec.js +13 -26
- package/test/spec/modules/appushBidAdapter_spec.js +2 -1
- package/test/spec/modules/beyondmediaBidAdapter_spec.js +2 -1
- package/test/spec/modules/compassBidAdapter_spec.js +2 -1
- package/test/spec/modules/connectIdSystem_spec.js +420 -242
- package/test/spec/modules/contentexchangeBidAdapter_spec.js +2 -1
- package/test/spec/modules/eids_spec.js +30 -0
- package/test/spec/modules/freewheel-sspBidAdapter_spec.js +37 -0
- package/test/spec/modules/globalsunBidAdapter_spec.js +2 -1
- package/test/spec/modules/iqzoneBidAdapter_spec.js +2 -1
- package/test/spec/modules/ivsBidAdapter_spec.js +197 -0
- package/test/spec/modules/ixBidAdapter_spec.js +84 -71
- package/test/spec/modules/koblerBidAdapter_spec.js +0 -20
- package/test/spec/modules/liveIntentIdSystem_spec.js +10 -0
- package/test/spec/modules/luponmediaBidAdapter_spec.js +1 -1
- package/test/spec/modules/magniteAnalyticsAdapter_spec.js +129 -1
- package/test/spec/modules/mathildeadsBidAdapter_spec.js +2 -1
- package/test/spec/modules/mgidBidAdapter_spec.js +184 -36
- package/test/spec/modules/oguryBidAdapter_spec.js +19 -4
- package/test/spec/modules/openxBidAdapter_spec.js +1157 -1936
- package/test/spec/modules/openxOrtbBidAdapter_spec.js +12 -39
- package/test/spec/modules/pubxBidAdapter_spec.js +10 -2
- package/test/spec/modules/sharedIdSystem_spec.js +0 -46
- package/test/spec/modules/sharethroughBidAdapter_spec.js +2 -1
- package/test/spec/modules/smarthubBidAdapter_spec.js +2 -1
- package/test/spec/modules/synacormediaBidAdapter_spec.js +0 -26
- package/test/spec/modules/videoModule/submodules/jwplayerVideoProvider_spec.js +17 -4
- package/test/spec/modules/vidoomyBidAdapter_spec.js +35 -0
- package/test/spec/modules/visiblemeasuresBidAdapter_spec.js +2 -1
- package/test/spec/modules/vrtcalBidAdapter_spec.js +3 -2
- package/test/spec/renderer_spec.js +1 -2
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import {expect} from 'chai';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import {connectIdSubmodule, storage} from 'modules/connectIdSystem.js';
|
|
3
|
+
import {server} from '../../mocks/xhr';
|
|
4
|
+
import {parseQS, parseUrl} from 'src/utils.js';
|
|
5
|
+
import {uspDataHandler} from 'src/adapterManager.js';
|
|
6
|
+
|
|
7
|
+
const TEST_SERVER_URL = 'http://localhost:9876/';
|
|
4
8
|
|
|
5
9
|
describe('Yahoo ConnectID Submodule', () => {
|
|
6
10
|
const HASHED_EMAIL = '6bda6f2fa268bf0438b5423a9861a2cedaa5dec163c03f743cfe05c08a8397b2';
|
|
@@ -8,6 +12,8 @@ describe('Yahoo ConnectID Submodule', () => {
|
|
|
8
12
|
const PIXEL_ID = '1234';
|
|
9
13
|
const PROD_ENDPOINT = `https://ups.analytics.yahoo.com/ups/${PIXEL_ID}/fed`;
|
|
10
14
|
const OVERRIDE_ENDPOINT = 'https://foo/bar';
|
|
15
|
+
const STORAGE_KEY = 'connectId';
|
|
16
|
+
const USP_DATA = '1YYY';
|
|
11
17
|
|
|
12
18
|
it('should have the correct module name declared', () => {
|
|
13
19
|
expect(connectIdSubmodule.name).to.equal('connectId');
|
|
@@ -20,271 +26,440 @@ describe('Yahoo ConnectID Submodule', () => {
|
|
|
20
26
|
describe('getId()', () => {
|
|
21
27
|
let ajaxStub;
|
|
22
28
|
let getAjaxFnStub;
|
|
29
|
+
let getCookieStub;
|
|
30
|
+
let setCookieStub;
|
|
31
|
+
let getLocalStorageStub;
|
|
32
|
+
let setLocalStorageStub;
|
|
33
|
+
let cookiesEnabledStub;
|
|
34
|
+
let localStorageEnabledStub;
|
|
35
|
+
let removeLocalStorageDataStub;
|
|
36
|
+
let uspConsentDataStub;
|
|
37
|
+
|
|
23
38
|
let consentData;
|
|
24
39
|
beforeEach(() => {
|
|
25
40
|
ajaxStub = sinon.stub();
|
|
26
41
|
getAjaxFnStub = sinon.stub(connectIdSubmodule, 'getAjaxFn');
|
|
27
42
|
getAjaxFnStub.returns(ajaxStub);
|
|
43
|
+
getCookieStub = sinon.stub(storage, 'getCookie');
|
|
44
|
+
setCookieStub = sinon.stub(storage, 'setCookie');
|
|
45
|
+
cookiesEnabledStub = sinon.stub(storage, 'cookiesAreEnabled');
|
|
46
|
+
getLocalStorageStub = sinon.stub(storage, 'getDataFromLocalStorage');
|
|
47
|
+
setLocalStorageStub = sinon.stub(storage, 'setDataInLocalStorage');
|
|
48
|
+
localStorageEnabledStub = sinon.stub(storage, 'localStorageIsEnabled');
|
|
49
|
+
removeLocalStorageDataStub = sinon.stub(storage, 'removeDataFromLocalStorage');
|
|
50
|
+
uspConsentDataStub = sinon.stub(uspDataHandler, 'getConsentData');
|
|
51
|
+
|
|
52
|
+
cookiesEnabledStub.returns(true);
|
|
53
|
+
localStorageEnabledStub.returns(true);
|
|
54
|
+
uspConsentDataStub.returns(USP_DATA);
|
|
28
55
|
|
|
29
56
|
consentData = {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
consentString: 'GDPR_CONSENT_STRING'
|
|
33
|
-
},
|
|
34
|
-
uspConsent: 'USP_CONSENT_STRING',
|
|
35
|
-
gppConsent: {
|
|
36
|
-
gppString: 'header~section6~section7',
|
|
37
|
-
applicableSections: [6, 7]
|
|
38
|
-
}
|
|
57
|
+
gdprApplies: 1,
|
|
58
|
+
consentString: 'GDPR_CONSENT_STRING'
|
|
39
59
|
};
|
|
40
60
|
});
|
|
41
61
|
|
|
42
62
|
afterEach(() => {
|
|
43
63
|
getAjaxFnStub.restore();
|
|
64
|
+
getCookieStub.restore();
|
|
65
|
+
setCookieStub.restore();
|
|
66
|
+
getLocalStorageStub.restore();
|
|
67
|
+
setLocalStorageStub.restore();
|
|
68
|
+
cookiesEnabledStub.restore();
|
|
69
|
+
localStorageEnabledStub.restore();
|
|
70
|
+
removeLocalStorageDataStub.restore();
|
|
71
|
+
uspConsentDataStub.restore();
|
|
44
72
|
});
|
|
45
73
|
|
|
46
74
|
function invokeGetIdAPI(configParams, consentData) {
|
|
47
75
|
let result = connectIdSubmodule.getId({
|
|
48
76
|
params: configParams
|
|
49
77
|
}, consentData);
|
|
50
|
-
if (typeof result === 'object') {
|
|
78
|
+
if (typeof result === 'object' && result.callback) {
|
|
51
79
|
result.callback(sinon.stub());
|
|
52
80
|
}
|
|
53
81
|
return result;
|
|
54
82
|
}
|
|
55
83
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
});
|
|
84
|
-
|
|
85
|
-
it('returns an object with the callback function if the endpoint override param and the puid params are passed', () => {
|
|
86
|
-
let result = invokeGetIdAPI({
|
|
87
|
-
puid: PUBLISHER_USER_ID,
|
|
88
|
-
endpoint: OVERRIDE_ENDPOINT
|
|
89
|
-
}, consentData);
|
|
90
|
-
expect(result).to.be.an('object').that.has.all.keys('callback');
|
|
91
|
-
expect(result.callback).to.be.a('function');
|
|
92
|
-
});
|
|
93
|
-
|
|
94
|
-
it('returns an object with the callback function if the endpoint override param and the puid and he params are passed', () => {
|
|
95
|
-
let result = invokeGetIdAPI({
|
|
96
|
-
he: HASHED_EMAIL,
|
|
97
|
-
puid: PUBLISHER_USER_ID,
|
|
98
|
-
endpoint: OVERRIDE_ENDPOINT
|
|
99
|
-
}, consentData);
|
|
100
|
-
expect(result).to.be.an('object').that.has.all.keys('callback');
|
|
101
|
-
expect(result.callback).to.be.a('function');
|
|
102
|
-
});
|
|
103
|
-
|
|
104
|
-
it('returns an object with the callback function if the pixelId and he params are passed', () => {
|
|
105
|
-
let result = invokeGetIdAPI({
|
|
106
|
-
he: HASHED_EMAIL,
|
|
107
|
-
pixelId: PIXEL_ID
|
|
108
|
-
}, consentData);
|
|
109
|
-
expect(result).to.be.an('object').that.has.all.keys('callback');
|
|
110
|
-
expect(result.callback).to.be.a('function');
|
|
111
|
-
});
|
|
112
|
-
|
|
113
|
-
it('returns an object with the callback function if the pixelId and puid params are passed', () => {
|
|
114
|
-
let result = invokeGetIdAPI({
|
|
115
|
-
puid: PUBLISHER_USER_ID,
|
|
116
|
-
pixelId: PIXEL_ID
|
|
117
|
-
}, consentData);
|
|
118
|
-
expect(result).to.be.an('object').that.has.all.keys('callback');
|
|
119
|
-
expect(result.callback).to.be.a('function');
|
|
120
|
-
});
|
|
121
|
-
|
|
122
|
-
it('returns an object with the callback function if the pixelId, he and puid params are passed', () => {
|
|
123
|
-
let result = invokeGetIdAPI({
|
|
124
|
-
he: HASHED_EMAIL,
|
|
125
|
-
puid: PUBLISHER_USER_ID,
|
|
126
|
-
pixelId: PIXEL_ID
|
|
127
|
-
}, consentData);
|
|
128
|
-
expect(result).to.be.an('object').that.has.all.keys('callback');
|
|
129
|
-
expect(result.callback).to.be.a('function');
|
|
130
|
-
});
|
|
131
|
-
|
|
132
|
-
it('returns an undefined if the Yahoo specific opt-out key is present in local storage', () => {
|
|
133
|
-
localStorage.setItem('connectIdOptOut', '1');
|
|
134
|
-
expect(invokeGetIdAPI({
|
|
135
|
-
he: HASHED_EMAIL,
|
|
136
|
-
pixelId: PIXEL_ID
|
|
137
|
-
}, consentData)).to.be.undefined;
|
|
138
|
-
localStorage.removeItem('connectIdOptOut');
|
|
139
|
-
});
|
|
140
|
-
|
|
141
|
-
it('returns an object with the callback function if the correct params are passed and Yahoo opt-out value is not "1"', () => {
|
|
142
|
-
localStorage.setItem('connectIdOptOut', 'true');
|
|
143
|
-
let result = invokeGetIdAPI({
|
|
144
|
-
he: HASHED_EMAIL,
|
|
145
|
-
pixelId: PIXEL_ID
|
|
146
|
-
}, consentData);
|
|
147
|
-
expect(result).to.be.an('object').that.has.all.keys('callback');
|
|
148
|
-
expect(result.callback).to.be.a('function');
|
|
149
|
-
localStorage.removeItem('connectIdOptOut');
|
|
150
|
-
});
|
|
151
|
-
|
|
152
|
-
it('Makes an ajax GET request to the production API endpoint with pixelId and he query params', () => {
|
|
153
|
-
invokeGetIdAPI({
|
|
154
|
-
he: HASHED_EMAIL,
|
|
155
|
-
pixelId: PIXEL_ID
|
|
156
|
-
}, consentData);
|
|
157
|
-
|
|
158
|
-
const expectedParams = {
|
|
159
|
-
he: HASHED_EMAIL,
|
|
160
|
-
pixelId: PIXEL_ID,
|
|
161
|
-
'1p': '0',
|
|
162
|
-
gdpr: '1',
|
|
163
|
-
gdpr_consent: consentData.gdpr.consentString,
|
|
164
|
-
us_privacy: consentData.uspConsent,
|
|
165
|
-
gpp: consentData.gppConsent.gppString,
|
|
166
|
-
gpp_sid: '6%2C7'
|
|
167
|
-
};
|
|
168
|
-
const requestQueryParams = parseQS(ajaxStub.firstCall.args[0].split('?')[1]);
|
|
169
|
-
|
|
170
|
-
expect(ajaxStub.firstCall.args[0].indexOf(`${PROD_ENDPOINT}?`)).to.equal(0);
|
|
171
|
-
expect(requestQueryParams).to.deep.equal(expectedParams);
|
|
172
|
-
expect(ajaxStub.firstCall.args[3]).to.deep.equal({method: 'GET', withCredentials: true});
|
|
173
|
-
});
|
|
174
|
-
|
|
175
|
-
it('Makes an ajax GET request to the production API endpoint with pixelId and puid query params', () => {
|
|
176
|
-
invokeGetIdAPI({
|
|
177
|
-
puid: PUBLISHER_USER_ID,
|
|
178
|
-
pixelId: PIXEL_ID
|
|
179
|
-
}, consentData);
|
|
180
|
-
|
|
181
|
-
const expectedParams = {
|
|
182
|
-
puid: PUBLISHER_USER_ID,
|
|
183
|
-
pixelId: PIXEL_ID,
|
|
184
|
-
'1p': '0',
|
|
185
|
-
gdpr: '1',
|
|
186
|
-
gdpr_consent: consentData.gdpr.consentString,
|
|
187
|
-
us_privacy: consentData.uspConsent,
|
|
188
|
-
gpp: consentData.gppConsent.gppString,
|
|
189
|
-
gpp_sid: '6%2C7'
|
|
190
|
-
};
|
|
191
|
-
const requestQueryParams = parseQS(ajaxStub.firstCall.args[0].split('?')[1]);
|
|
192
|
-
|
|
193
|
-
expect(ajaxStub.firstCall.args[0].indexOf(`${PROD_ENDPOINT}?`)).to.equal(0);
|
|
194
|
-
expect(requestQueryParams).to.deep.equal(expectedParams);
|
|
195
|
-
expect(ajaxStub.firstCall.args[3]).to.deep.equal({method: 'GET', withCredentials: true});
|
|
196
|
-
});
|
|
197
|
-
|
|
198
|
-
it('Makes an ajax GET request to the production API endpoint with pixelId, puid and he query params', () => {
|
|
199
|
-
invokeGetIdAPI({
|
|
200
|
-
puid: PUBLISHER_USER_ID,
|
|
201
|
-
he: HASHED_EMAIL,
|
|
202
|
-
pixelId: PIXEL_ID
|
|
203
|
-
}, consentData);
|
|
204
|
-
|
|
205
|
-
const expectedParams = {
|
|
206
|
-
puid: PUBLISHER_USER_ID,
|
|
207
|
-
he: HASHED_EMAIL,
|
|
208
|
-
pixelId: PIXEL_ID,
|
|
209
|
-
'1p': '0',
|
|
210
|
-
gdpr: '1',
|
|
211
|
-
gdpr_consent: consentData.gdpr.consentString,
|
|
212
|
-
us_privacy: consentData.uspConsent,
|
|
213
|
-
gpp: consentData.gppConsent.gppString,
|
|
214
|
-
gpp_sid: '6%2C7'
|
|
215
|
-
};
|
|
216
|
-
const requestQueryParams = parseQS(ajaxStub.firstCall.args[0].split('?')[1]);
|
|
217
|
-
|
|
218
|
-
expect(ajaxStub.firstCall.args[0].indexOf(`${PROD_ENDPOINT}?`)).to.equal(0);
|
|
219
|
-
expect(requestQueryParams).to.deep.equal(expectedParams);
|
|
220
|
-
expect(ajaxStub.firstCall.args[3]).to.deep.equal({method: 'GET', withCredentials: true});
|
|
221
|
-
});
|
|
222
|
-
|
|
223
|
-
it('Makes an ajax GET request to the specified override API endpoint with query params', () => {
|
|
224
|
-
invokeGetIdAPI({
|
|
225
|
-
he: HASHED_EMAIL,
|
|
226
|
-
endpoint: OVERRIDE_ENDPOINT
|
|
227
|
-
}, consentData);
|
|
228
|
-
|
|
229
|
-
const expectedParams = {
|
|
230
|
-
he: HASHED_EMAIL,
|
|
231
|
-
'1p': '0',
|
|
232
|
-
gdpr: '1',
|
|
233
|
-
gdpr_consent: consentData.gdpr.consentString,
|
|
234
|
-
us_privacy: consentData.uspConsent,
|
|
235
|
-
gpp: consentData.gppConsent.gppString,
|
|
236
|
-
gpp_sid: '6%2C7'
|
|
237
|
-
};
|
|
238
|
-
const requestQueryParams = parseQS(ajaxStub.firstCall.args[0].split('?')[1]);
|
|
239
|
-
|
|
240
|
-
expect(ajaxStub.firstCall.args[0].indexOf(`${OVERRIDE_ENDPOINT}?`)).to.equal(0);
|
|
241
|
-
expect(requestQueryParams).to.deep.equal(expectedParams);
|
|
242
|
-
expect(ajaxStub.firstCall.args[3]).to.deep.equal({method: 'GET', withCredentials: true});
|
|
243
|
-
});
|
|
244
|
-
|
|
245
|
-
it('sets the callbacks param of the ajax function call correctly', () => {
|
|
246
|
-
invokeGetIdAPI({
|
|
247
|
-
he: HASHED_EMAIL,
|
|
248
|
-
pixelId: PIXEL_ID,
|
|
249
|
-
}, consentData);
|
|
84
|
+
describe('Low level storage functionality', () => {
|
|
85
|
+
const storageTestCases = [
|
|
86
|
+
{
|
|
87
|
+
detail: 'cookie data over local storage data',
|
|
88
|
+
cookie: '{"connectId":"foo"}',
|
|
89
|
+
localStorage: {connectId: 'bar'},
|
|
90
|
+
expected: {connectId: 'foo'}
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
detail: 'cookie data if only cookie data exists',
|
|
94
|
+
cookie: '{"connectId":"foo"}',
|
|
95
|
+
localStorage: undefined,
|
|
96
|
+
expected: {connectId: 'foo'}
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
detail: 'local storage data if only it local storage data exists',
|
|
100
|
+
cookie: undefined,
|
|
101
|
+
localStorage: {connectId: 'bar'},
|
|
102
|
+
expected: {connectId: 'bar'}
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
detail: 'undefined when both cookie and local storage are empty',
|
|
106
|
+
cookie: undefined,
|
|
107
|
+
localStorage: undefined,
|
|
108
|
+
expected: undefined
|
|
109
|
+
}
|
|
110
|
+
]
|
|
250
111
|
|
|
251
|
-
|
|
252
|
-
|
|
112
|
+
storageTestCases.forEach(testCase => it(`getId() should return ${testCase.detail}`, function () {
|
|
113
|
+
getCookieStub.withArgs(STORAGE_KEY).returns(testCase.cookie);
|
|
114
|
+
getLocalStorageStub.withArgs(STORAGE_KEY).returns(testCase.localStorage);
|
|
253
115
|
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
}, consentData);
|
|
116
|
+
const result = invokeGetIdAPI({
|
|
117
|
+
he: HASHED_EMAIL,
|
|
118
|
+
endpoint: OVERRIDE_ENDPOINT
|
|
119
|
+
}, consentData);
|
|
259
120
|
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
});
|
|
121
|
+
expect(result.id).to.be.deep.equal(testCase.expected ? testCase.expected : undefined);
|
|
122
|
+
}));
|
|
123
|
+
})
|
|
264
124
|
|
|
265
|
-
|
|
266
|
-
|
|
125
|
+
describe('with invalid module configuration', () => {
|
|
126
|
+
it('returns undefined if he, pixelId and puid params are not passed', () => {
|
|
127
|
+
expect(invokeGetIdAPI({}, consentData)).to.be.undefined;
|
|
128
|
+
expect(ajaxStub.callCount).to.equal(0);
|
|
129
|
+
});
|
|
267
130
|
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
131
|
+
it('returns undefined if the pixelId param is not passed', () => {
|
|
132
|
+
expect(invokeGetIdAPI({
|
|
133
|
+
he: HASHED_EMAIL,
|
|
134
|
+
puid: PUBLISHER_USER_ID
|
|
135
|
+
}, consentData)).to.be.undefined;
|
|
136
|
+
expect(ajaxStub.callCount).to.equal(0);
|
|
137
|
+
});
|
|
272
138
|
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
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
|
+
});
|
|
276
145
|
});
|
|
277
146
|
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
'
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
147
|
+
describe('with valid module configuration', () => {
|
|
148
|
+
describe('when data is in client storage', () => {
|
|
149
|
+
it('returns an object with the stored ID from cookies for valid module configuration', () => {
|
|
150
|
+
const cookieData = {connectId: 'foobar'};
|
|
151
|
+
getCookieStub.withArgs(STORAGE_KEY).returns(JSON.stringify(cookieData));
|
|
152
|
+
let result = invokeGetIdAPI({
|
|
153
|
+
he: HASHED_EMAIL,
|
|
154
|
+
pixelId: PIXEL_ID
|
|
155
|
+
}, consentData);
|
|
156
|
+
expect(result).to.be.an('object').that.has.all.keys('id');
|
|
157
|
+
expect(result.id).to.deep.equal(cookieData);
|
|
158
|
+
});
|
|
159
|
+
|
|
160
|
+
it('returns an object with the stored ID from localStorage for valid module configuration', () => {
|
|
161
|
+
const localStorageData = {connectId: 'foobarbaz'};
|
|
162
|
+
getLocalStorageStub.withArgs(STORAGE_KEY).returns(localStorageData);
|
|
163
|
+
let result = invokeGetIdAPI({
|
|
164
|
+
he: HASHED_EMAIL,
|
|
165
|
+
pixelId: PIXEL_ID
|
|
166
|
+
}, consentData);
|
|
167
|
+
expect(result).to.be.an('object').that.has.all.keys('id');
|
|
168
|
+
expect(result.id).to.deep.equal(localStorageData);
|
|
169
|
+
});
|
|
170
|
+
|
|
171
|
+
it('deletes local storage data when expiry has passed', () => {
|
|
172
|
+
const localStorageData = {connectId: 'foobarbaz', __expires: Date.now() - 10000};
|
|
173
|
+
getLocalStorageStub.withArgs(STORAGE_KEY).returns(localStorageData);
|
|
174
|
+
let result = invokeGetIdAPI({
|
|
175
|
+
he: HASHED_EMAIL,
|
|
176
|
+
pixelId: PIXEL_ID
|
|
177
|
+
}, consentData);
|
|
178
|
+
expect(removeLocalStorageDataStub.calledOnce).to.be.true;
|
|
179
|
+
expect(removeLocalStorageDataStub.firstCall.args[0]).to.equal(STORAGE_KEY);
|
|
180
|
+
expect(result.id).to.equal(undefined);
|
|
181
|
+
expect(result.callback).to.be.a('function');
|
|
182
|
+
});
|
|
183
|
+
|
|
184
|
+
it('will not delete local storage data when expiry has not passed', () => {
|
|
185
|
+
const localStorageData = {connectId: 'foobarbaz', __expires: Date.now() + 10000};
|
|
186
|
+
getLocalStorageStub.withArgs(STORAGE_KEY).returns(localStorageData);
|
|
187
|
+
let result = invokeGetIdAPI({
|
|
188
|
+
he: HASHED_EMAIL,
|
|
189
|
+
pixelId: PIXEL_ID
|
|
190
|
+
}, consentData);
|
|
191
|
+
expect(removeLocalStorageDataStub.calledOnce).to.be.false;
|
|
192
|
+
expect(result.id).to.deep.equal(localStorageData);
|
|
193
|
+
});
|
|
194
|
+
});
|
|
285
195
|
|
|
286
|
-
|
|
287
|
-
|
|
196
|
+
describe('when no data in client storage', () => {
|
|
197
|
+
it('returns an object with the callback function if the endpoint override param and the he params are passed', () => {
|
|
198
|
+
let result = invokeGetIdAPI({
|
|
199
|
+
he: HASHED_EMAIL,
|
|
200
|
+
endpoint: OVERRIDE_ENDPOINT
|
|
201
|
+
}, consentData);
|
|
202
|
+
expect(result).to.be.an('object').that.has.all.keys('callback');
|
|
203
|
+
expect(result.callback).to.be.a('function');
|
|
204
|
+
});
|
|
205
|
+
|
|
206
|
+
it('returns an object with the callback function if the endpoint override param and the puid params are passed', () => {
|
|
207
|
+
let result = invokeGetIdAPI({
|
|
208
|
+
puid: PUBLISHER_USER_ID,
|
|
209
|
+
endpoint: OVERRIDE_ENDPOINT
|
|
210
|
+
}, consentData);
|
|
211
|
+
expect(result).to.be.an('object').that.has.all.keys('callback');
|
|
212
|
+
expect(result.callback).to.be.a('function');
|
|
213
|
+
});
|
|
214
|
+
|
|
215
|
+
it('returns an object with the callback function if the endpoint override param and the puid and he params are passed', () => {
|
|
216
|
+
let result = invokeGetIdAPI({
|
|
217
|
+
he: HASHED_EMAIL,
|
|
218
|
+
puid: PUBLISHER_USER_ID,
|
|
219
|
+
endpoint: OVERRIDE_ENDPOINT
|
|
220
|
+
}, consentData);
|
|
221
|
+
expect(result).to.be.an('object').that.has.all.keys('callback');
|
|
222
|
+
expect(result.callback).to.be.a('function');
|
|
223
|
+
});
|
|
224
|
+
|
|
225
|
+
it('returns an object with the callback function if the pixelId and he params are passed', () => {
|
|
226
|
+
let result = invokeGetIdAPI({
|
|
227
|
+
he: HASHED_EMAIL,
|
|
228
|
+
pixelId: PIXEL_ID
|
|
229
|
+
}, consentData);
|
|
230
|
+
expect(result).to.be.an('object').that.has.all.keys('callback');
|
|
231
|
+
expect(result.callback).to.be.a('function');
|
|
232
|
+
});
|
|
233
|
+
|
|
234
|
+
it('returns an object with the callback function if the pixelId and puid params are passed', () => {
|
|
235
|
+
let result = invokeGetIdAPI({
|
|
236
|
+
puid: PUBLISHER_USER_ID,
|
|
237
|
+
pixelId: PIXEL_ID
|
|
238
|
+
}, consentData);
|
|
239
|
+
expect(result).to.be.an('object').that.has.all.keys('callback');
|
|
240
|
+
expect(result.callback).to.be.a('function');
|
|
241
|
+
});
|
|
242
|
+
|
|
243
|
+
it('returns an object with the callback function if the pixelId, he and puid params are passed', () => {
|
|
244
|
+
let result = invokeGetIdAPI({
|
|
245
|
+
he: HASHED_EMAIL,
|
|
246
|
+
puid: PUBLISHER_USER_ID,
|
|
247
|
+
pixelId: PIXEL_ID
|
|
248
|
+
}, consentData);
|
|
249
|
+
expect(result).to.be.an('object').that.has.all.keys('callback');
|
|
250
|
+
expect(result.callback).to.be.a('function');
|
|
251
|
+
});
|
|
252
|
+
|
|
253
|
+
it('returns an undefined if the Yahoo specific opt-out key is present in local storage', () => {
|
|
254
|
+
localStorage.setItem('connectIdOptOut', '1');
|
|
255
|
+
expect(invokeGetIdAPI({
|
|
256
|
+
he: HASHED_EMAIL,
|
|
257
|
+
pixelId: PIXEL_ID
|
|
258
|
+
}, consentData)).to.be.undefined;
|
|
259
|
+
localStorage.removeItem('connectIdOptOut');
|
|
260
|
+
});
|
|
261
|
+
|
|
262
|
+
it('returns an object with the callback function if the correct params are passed and Yahoo opt-out value is not "1"', () => {
|
|
263
|
+
localStorage.setItem('connectIdOptOut', 'true');
|
|
264
|
+
let result = invokeGetIdAPI({
|
|
265
|
+
he: HASHED_EMAIL,
|
|
266
|
+
pixelId: PIXEL_ID
|
|
267
|
+
}, consentData);
|
|
268
|
+
expect(result).to.be.an('object').that.has.all.keys('callback');
|
|
269
|
+
expect(result.callback).to.be.a('function');
|
|
270
|
+
localStorage.removeItem('connectIdOptOut');
|
|
271
|
+
});
|
|
272
|
+
|
|
273
|
+
it('Makes an ajax GET request to the production API endpoint with pixelId and he query params', () => {
|
|
274
|
+
invokeGetIdAPI({
|
|
275
|
+
he: HASHED_EMAIL,
|
|
276
|
+
pixelId: PIXEL_ID
|
|
277
|
+
}, consentData);
|
|
278
|
+
|
|
279
|
+
const expectedParams = {
|
|
280
|
+
he: HASHED_EMAIL,
|
|
281
|
+
pixelId: PIXEL_ID,
|
|
282
|
+
'1p': '0',
|
|
283
|
+
gdpr: '1',
|
|
284
|
+
gdpr_consent: consentData.consentString,
|
|
285
|
+
v: '1',
|
|
286
|
+
url: TEST_SERVER_URL,
|
|
287
|
+
us_privacy: USP_DATA
|
|
288
|
+
};
|
|
289
|
+
const requestQueryParams = parseQS(ajaxStub.firstCall.args[0].split('?')[1]);
|
|
290
|
+
|
|
291
|
+
expect(ajaxStub.firstCall.args[0].indexOf(`${PROD_ENDPOINT}?`)).to.equal(0);
|
|
292
|
+
expect(requestQueryParams).to.deep.equal(expectedParams);
|
|
293
|
+
expect(ajaxStub.firstCall.args[3]).to.deep.equal({method: 'GET', withCredentials: true});
|
|
294
|
+
});
|
|
295
|
+
|
|
296
|
+
it('Makes an ajax GET request to the production API endpoint with pixelId and puid query params', () => {
|
|
297
|
+
invokeGetIdAPI({
|
|
298
|
+
puid: PUBLISHER_USER_ID,
|
|
299
|
+
pixelId: PIXEL_ID
|
|
300
|
+
}, consentData);
|
|
301
|
+
|
|
302
|
+
const expectedParams = {
|
|
303
|
+
v: '1',
|
|
304
|
+
'1p': '0',
|
|
305
|
+
gdpr: '1',
|
|
306
|
+
puid: PUBLISHER_USER_ID,
|
|
307
|
+
pixelId: PIXEL_ID,
|
|
308
|
+
gdpr_consent: consentData.consentString,
|
|
309
|
+
url: TEST_SERVER_URL,
|
|
310
|
+
us_privacy: USP_DATA
|
|
311
|
+
};
|
|
312
|
+
const requestQueryParams = parseQS(ajaxStub.firstCall.args[0].split('?')[1]);
|
|
313
|
+
|
|
314
|
+
expect(ajaxStub.firstCall.args[0].indexOf(`${PROD_ENDPOINT}?`)).to.equal(0);
|
|
315
|
+
expect(requestQueryParams).to.deep.equal(expectedParams);
|
|
316
|
+
expect(ajaxStub.firstCall.args[3]).to.deep.equal({method: 'GET', withCredentials: true});
|
|
317
|
+
});
|
|
318
|
+
|
|
319
|
+
it('Makes an ajax GET request to the production API endpoint with pixelId, puid and he query params', () => {
|
|
320
|
+
invokeGetIdAPI({
|
|
321
|
+
puid: PUBLISHER_USER_ID,
|
|
322
|
+
he: HASHED_EMAIL,
|
|
323
|
+
pixelId: PIXEL_ID
|
|
324
|
+
}, consentData);
|
|
325
|
+
|
|
326
|
+
const expectedParams = {
|
|
327
|
+
puid: PUBLISHER_USER_ID,
|
|
328
|
+
he: HASHED_EMAIL,
|
|
329
|
+
pixelId: PIXEL_ID,
|
|
330
|
+
'1p': '0',
|
|
331
|
+
gdpr: '1',
|
|
332
|
+
gdpr_consent: consentData.consentString,
|
|
333
|
+
v: '1',
|
|
334
|
+
url: TEST_SERVER_URL,
|
|
335
|
+
us_privacy: USP_DATA
|
|
336
|
+
};
|
|
337
|
+
const requestQueryParams = parseQS(ajaxStub.firstCall.args[0].split('?')[1]);
|
|
338
|
+
|
|
339
|
+
expect(ajaxStub.firstCall.args[0].indexOf(`${PROD_ENDPOINT}?`)).to.equal(0);
|
|
340
|
+
expect(requestQueryParams).to.deep.equal(expectedParams);
|
|
341
|
+
expect(ajaxStub.firstCall.args[3]).to.deep.equal({method: 'GET', withCredentials: true});
|
|
342
|
+
});
|
|
343
|
+
|
|
344
|
+
it('Makes an ajax GET request to the specified override API endpoint with query params', () => {
|
|
345
|
+
invokeGetIdAPI({
|
|
346
|
+
he: HASHED_EMAIL,
|
|
347
|
+
endpoint: OVERRIDE_ENDPOINT
|
|
348
|
+
}, consentData);
|
|
349
|
+
|
|
350
|
+
const expectedParams = {
|
|
351
|
+
he: HASHED_EMAIL,
|
|
352
|
+
'1p': '0',
|
|
353
|
+
gdpr: '1',
|
|
354
|
+
gdpr_consent: consentData.consentString,
|
|
355
|
+
v: '1',
|
|
356
|
+
url: TEST_SERVER_URL,
|
|
357
|
+
us_privacy: USP_DATA
|
|
358
|
+
};
|
|
359
|
+
const requestQueryParams = parseQS(ajaxStub.firstCall.args[0].split('?')[1]);
|
|
360
|
+
|
|
361
|
+
expect(ajaxStub.firstCall.args[0].indexOf(`${OVERRIDE_ENDPOINT}?`)).to.equal(0);
|
|
362
|
+
expect(requestQueryParams).to.deep.equal(expectedParams);
|
|
363
|
+
expect(ajaxStub.firstCall.args[3]).to.deep.equal({method: 'GET', withCredentials: true});
|
|
364
|
+
});
|
|
365
|
+
|
|
366
|
+
it('sets the callbacks param of the ajax function call correctly', () => {
|
|
367
|
+
invokeGetIdAPI({
|
|
368
|
+
he: HASHED_EMAIL,
|
|
369
|
+
pixelId: PIXEL_ID,
|
|
370
|
+
}, consentData);
|
|
371
|
+
|
|
372
|
+
expect(ajaxStub.firstCall.args[1]).to.be.an('object').that.has.all.keys(['success', 'error']);
|
|
373
|
+
});
|
|
374
|
+
|
|
375
|
+
it('sets GDPR consent data flag correctly when call is under GDPR jurisdiction.', () => {
|
|
376
|
+
invokeGetIdAPI({
|
|
377
|
+
he: HASHED_EMAIL,
|
|
378
|
+
pixelId: PIXEL_ID,
|
|
379
|
+
}, consentData);
|
|
380
|
+
|
|
381
|
+
const requestQueryParams = parseQS(ajaxStub.firstCall.args[0].split('?')[1]);
|
|
382
|
+
expect(requestQueryParams.gdpr).to.equal('1');
|
|
383
|
+
expect(requestQueryParams.gdpr_consent).to.equal(consentData.consentString);
|
|
384
|
+
});
|
|
385
|
+
|
|
386
|
+
it('sets GDPR consent data flag correctly when call is NOT under GDPR jurisdiction.', () => {
|
|
387
|
+
consentData.gdprApplies = false;
|
|
388
|
+
|
|
389
|
+
invokeGetIdAPI({
|
|
390
|
+
he: HASHED_EMAIL,
|
|
391
|
+
pixelId: PIXEL_ID,
|
|
392
|
+
}, consentData);
|
|
393
|
+
|
|
394
|
+
const requestQueryParams = parseQS(ajaxStub.firstCall.args[0].split('?')[1]);
|
|
395
|
+
expect(requestQueryParams.gdpr).to.equal('0');
|
|
396
|
+
expect(requestQueryParams.gdpr_consent).to.equal('');
|
|
397
|
+
});
|
|
398
|
+
|
|
399
|
+
[1, '1', true].forEach(firstPartyParamValue => {
|
|
400
|
+
it(`sets 1p payload property to '1' for a config value of ${firstPartyParamValue}`, () => {
|
|
401
|
+
invokeGetIdAPI({
|
|
402
|
+
'1p': firstPartyParamValue,
|
|
403
|
+
he: HASHED_EMAIL,
|
|
404
|
+
pixelId: PIXEL_ID,
|
|
405
|
+
}, consentData);
|
|
406
|
+
|
|
407
|
+
const requestQueryParams = parseQS(ajaxStub.firstCall.args[0].split('?')[1]);
|
|
408
|
+
expect(requestQueryParams['1p']).to.equal('1');
|
|
409
|
+
});
|
|
410
|
+
});
|
|
411
|
+
|
|
412
|
+
it('stores the result in client cookie storage', () => {
|
|
413
|
+
const dateNowStub = sinon.stub(Date, 'now');
|
|
414
|
+
dateNowStub.returns(0);
|
|
415
|
+
getAjaxFnStub.restore();
|
|
416
|
+
const upsResponse = {connectid: 'foobarbaz'};
|
|
417
|
+
const expiryDelta = new Date(60 * 60 * 24 * 14 * 1000);
|
|
418
|
+
invokeGetIdAPI({
|
|
419
|
+
puid: PUBLISHER_USER_ID,
|
|
420
|
+
pixelId: PIXEL_ID
|
|
421
|
+
}, consentData);
|
|
422
|
+
let request = server.requests[0];
|
|
423
|
+
request.respond(
|
|
424
|
+
200,
|
|
425
|
+
{'Content-Type': 'application/json'},
|
|
426
|
+
JSON.stringify(upsResponse)
|
|
427
|
+
);
|
|
428
|
+
expect(setCookieStub.calledOnce).to.be.true;
|
|
429
|
+
expect(setCookieStub.firstCall.args[0]).to.equal(STORAGE_KEY);
|
|
430
|
+
expect(setCookieStub.firstCall.args[1]).to.equal(JSON.stringify(upsResponse));
|
|
431
|
+
expect(setCookieStub.firstCall.args[2]).to.equal(expiryDelta.toUTCString());
|
|
432
|
+
expect(setCookieStub.firstCall.args[3]).to.equal(null);
|
|
433
|
+
const cookieDomain = parseUrl(TEST_SERVER_URL).hostname;
|
|
434
|
+
expect(setCookieStub.firstCall.args[4]).to.equal(`.${cookieDomain}`);
|
|
435
|
+
dateNowStub.restore();
|
|
436
|
+
});
|
|
437
|
+
|
|
438
|
+
it('stores the result in localStorage if cookies are not permitted', () => {
|
|
439
|
+
getAjaxFnStub.restore();
|
|
440
|
+
cookiesEnabledStub.returns(false);
|
|
441
|
+
const dateNowStub = sinon.stub(Date, 'now');
|
|
442
|
+
dateNowStub.returns(0);
|
|
443
|
+
const upsResponse = {connectid: 'barfoo'};
|
|
444
|
+
const expectedStoredData = {
|
|
445
|
+
connectid: 'barfoo',
|
|
446
|
+
__expires: 60 * 60 * 24 * 14 * 1000
|
|
447
|
+
};
|
|
448
|
+
invokeGetIdAPI({
|
|
449
|
+
puid: PUBLISHER_USER_ID,
|
|
450
|
+
pixelId: PIXEL_ID
|
|
451
|
+
}, consentData);
|
|
452
|
+
let request = server.requests[0];
|
|
453
|
+
request.respond(
|
|
454
|
+
200,
|
|
455
|
+
{'Content-Type': 'application/json'},
|
|
456
|
+
JSON.stringify(upsResponse)
|
|
457
|
+
);
|
|
458
|
+
expect(setLocalStorageStub.calledOnce).to.be.true;
|
|
459
|
+
expect(setLocalStorageStub.firstCall.args[0]).to.equal(STORAGE_KEY);
|
|
460
|
+
expect(setLocalStorageStub.firstCall.args[1]).to.deep.equal(expectedStoredData);
|
|
461
|
+
dateNowStub.restore();
|
|
462
|
+
});
|
|
288
463
|
});
|
|
289
464
|
});
|
|
290
465
|
});
|
|
@@ -306,6 +481,13 @@ describe('Yahoo ConnectID Submodule', () => {
|
|
|
306
481
|
payload: {
|
|
307
482
|
connectid: '4567'
|
|
308
483
|
}
|
|
484
|
+
},
|
|
485
|
+
{
|
|
486
|
+
key: 'connectId',
|
|
487
|
+
expected: '9924',
|
|
488
|
+
payload: {
|
|
489
|
+
connectId: '9924'
|
|
490
|
+
}
|
|
309
491
|
}];
|
|
310
492
|
VALID_API_RESPONSES.forEach(responseData => {
|
|
311
493
|
it('should return a newly constructed object with the connect ID for a payload with ${responseData.key} key(s)', () => {
|
|
@@ -348,19 +530,15 @@ describe('Yahoo ConnectID Submodule', () => {
|
|
|
348
530
|
})).to.be.false;
|
|
349
531
|
});
|
|
350
532
|
|
|
351
|
-
it('should return false if consent
|
|
533
|
+
it('should return false if consent consentData.applies is false', () => {
|
|
352
534
|
expect(connectIdSubmodule.isEUConsentRequired({
|
|
353
|
-
|
|
354
|
-
gdprApplies: false
|
|
355
|
-
}
|
|
535
|
+
gdprApplies: false
|
|
356
536
|
})).to.be.false;
|
|
357
537
|
});
|
|
358
538
|
|
|
359
539
|
it('should return true if consent data.gdpr.applies is true', () => {
|
|
360
540
|
expect(connectIdSubmodule.isEUConsentRequired({
|
|
361
|
-
|
|
362
|
-
gdprApplies: true
|
|
363
|
-
}
|
|
541
|
+
gdprApplies: true
|
|
364
542
|
})).to.be.true;
|
|
365
543
|
});
|
|
366
544
|
});
|