@segment/analytics.js-core
Advanced tools
Comparing version 3.2.2 to 3.2.3
3.2.3 / 2017-11-09 | ||
================== | ||
* Add support for schema defaults (#50). | ||
3.2.2 / 2017-11-05 | ||
@@ -8,3 +13,2 @@ ================== | ||
3.2.1 / 2017-11-03 | ||
@@ -11,0 +15,0 @@ ================== |
@@ -314,2 +314,8 @@ 'use strict'; | ||
} | ||
} else { | ||
var defaultPlan = events.__default || { enabled: true }; | ||
if (!defaultPlan.enabled) { | ||
// Disabled events should always be sent to Segment. | ||
defaults(msg.integrations, { All: false, 'Segment.io': true }); | ||
} | ||
} | ||
@@ -316,0 +322,0 @@ |
{ | ||
"name": "@segment/analytics.js-core", | ||
"author": "Segment <friends@segment.com>", | ||
"version": "3.2.2", | ||
"version": "3.2.3", | ||
"description": "The hassle-free way to integrate analytics into any web application.", | ||
@@ -6,0 +6,0 @@ "keywords": [ |
@@ -1176,2 +1176,52 @@ 'use strict'; | ||
it('should call #_invoke if new events are enabled', function() { | ||
analytics.options.plan = { | ||
track: { | ||
__default: { enabled: true } | ||
} | ||
}; | ||
analytics.track('event'); | ||
assert(analytics._invoke.called); | ||
var track = analytics._invoke.args[0][1]; | ||
assert.deepEqual({}, track.obj.integrations); | ||
}); | ||
it('should call #_invoke for Segment if new events are disabled', function() { | ||
analytics.options.plan = { | ||
track: { | ||
__default: { enabled: false } | ||
} | ||
}; | ||
analytics.track('even'); | ||
assert(analytics._invoke.called); | ||
var track = analytics._invoke.args[0][1]; | ||
assert.deepEqual({ All: false, 'Segment.io': true }, track.obj.integrations); | ||
}); | ||
it('should use the event plan if it exists and ignore defaults', function() { | ||
analytics.options.plan = { | ||
track: { | ||
event: { enabled: true }, | ||
__default: { enabled: false } | ||
} | ||
}; | ||
analytics.track('event'); | ||
assert(analytics._invoke.called); | ||
var track = analytics._invoke.args[0][1]; | ||
assert.deepEqual({}, track.obj.integrations); | ||
}); | ||
it('should merge the event plan if it exists and ignore defaults', function() { | ||
analytics.options.plan = { | ||
track: { | ||
event: { enabled: true, integrations: { Mixpanel: false } }, | ||
__default: { enabled: false } | ||
} | ||
}; | ||
analytics.track('event'); | ||
assert(analytics._invoke.called); | ||
var track = analytics._invoke.args[0][1]; | ||
assert.deepEqual({ Mixpanel: false }, track.obj.integrations); | ||
}); | ||
it('should not set ctx.integrations if plan.integrations is empty', function() { | ||
@@ -1178,0 +1228,0 @@ analytics.options.plan = { track: { event: {} } }; |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
175180
3969