@segment/analytics.js-integration-segmentio
Advanced tools
Comparing version 0.0.0-beta.5 to 0.0.0-beta.6
@@ -320,2 +320,4 @@ 'use strict'; | ||
msg._metadata.unbundled = this.options.unbundledIntegrations; | ||
msg._metadata.bundledConfigs = this.options.bundledConfigs; | ||
msg._metadata.unbundledConfigs = this.options.unbundledConfigs; | ||
} | ||
@@ -474,10 +476,6 @@ this.debug('normalized %o', msg); | ||
// Exclude the current domain from the list of servers we're querying | ||
var currentTld = getTld(window.location.hostname); | ||
var domains = []; | ||
for (var i = 0; i < this.options.crossDomainIdServers.length; i++) { | ||
var domain = this.options.crossDomainIdServers[i]; | ||
if (getTld(domain) !== currentTld) { | ||
domains.push(domain); | ||
} | ||
domains.push(domain); | ||
} | ||
@@ -530,7 +528,3 @@ | ||
if (this.options.saveCrossDomainIdInLocalStorage) { | ||
var id = localstorage('seg_xid'); | ||
if (id === null || id === undefined) { | ||
return this.cookie('seg_xid'); | ||
} | ||
return id; | ||
return localstorage('seg_xid'); | ||
} | ||
@@ -537,0 +531,0 @@ return this.cookie('seg_xid'); |
{ | ||
"name": "@segment/analytics.js-integration-segmentio", | ||
"description": "The Segmentio analytics.js integration.", | ||
"version": "0.0.0-beta.5", | ||
"version": "0.0.0-beta.6", | ||
"keywords": [ | ||
@@ -6,0 +6,0 @@ "analytics.js", |
@@ -1120,22 +1120,2 @@ 'use strict'; | ||
describe('with ' + scenario, function() { | ||
it('should generate xid locally if there is only one (current hostname) server', function() { | ||
segment.options.crossDomainIdServers = ['localhost']; | ||
segment.options.saveCrossDomainIdInLocalStorage = | ||
cases[scenario]; | ||
var res = null; | ||
segment.retrieveCrossDomainId(function(err, response) { | ||
res = response; | ||
}); | ||
var identify = segment.onidentify.args[0]; | ||
var crossDomainId = identify[0].traits().crossDomainId; | ||
analytics.assert(crossDomainId); | ||
analytics.assert(res.crossDomainId === crossDomainId); | ||
analytics.assert(res.fromDomain === 'localhost'); | ||
assert.equal(segment.getCachedCrossDomainId(), crossDomainId); | ||
}); | ||
it('should obtain crossDomainId', function() { | ||
@@ -1198,2 +1178,11 @@ server.respondWith( | ||
); | ||
server.respondWith( | ||
'GET', | ||
'https://localhost/v1/id/' + segment.options.apiKey, | ||
[ | ||
200, | ||
{ 'Content-Type': 'application/json' }, | ||
'{ "id": null }' | ||
] | ||
); | ||
if (segment.options.saveCrossDomainIdInLocalStorage) { | ||
@@ -1242,2 +1231,7 @@ server.respondWith('GET', /https:\/\/localhost\/v1\/saveId/, [ | ||
); | ||
server.respondWith( | ||
'GET', | ||
'https://localhost/v1/id/' + segment.options.apiKey, | ||
[500, { 'Content-Type': 'application/json' }, ''] | ||
); | ||
server.respond(); | ||
@@ -1248,3 +1242,3 @@ | ||
analytics.assert(!res); | ||
analytics.assert(err === 'Internal Server Error'); | ||
analytics.assert.equal(err, 'Internal Server Error'); | ||
@@ -1277,2 +1271,11 @@ assert.equal(segment.getCachedCrossDomainId(), null); | ||
); | ||
server.respondWith( | ||
'GET', | ||
'https://localhost/v1/id/' + segment.options.apiKey, | ||
[ | ||
200, | ||
{ 'Content-Type': 'application/json' }, | ||
'{ "id": null }' | ||
] | ||
); | ||
server.respond(); | ||
@@ -1279,0 +1282,0 @@ |
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
2009
81247
1