@segment/analytics.js-integration-appboy
Advanced tools
Comparing version 1.3.0 to 1.4.0
@@ -0,1 +1,6 @@ | ||
1.4.0 / 2017-07-19 | ||
================== | ||
* Add ability to add a custom API endpoint | ||
1.3.0 / 2017-07-05 | ||
@@ -2,0 +7,0 @@ ================== |
@@ -52,3 +52,11 @@ 'use strict'; | ||
if (options.enableHtmlInAppMessages) config.enableHtmlInAppMessages = true; | ||
if (options.datacenter === 'eu') config.baseUrl = 'https://sdk.api.appboy.eu/api/v3'; | ||
// Setup custom endpoints | ||
if (options.customEndpoint) { | ||
config.baseUrl = options.customEndpoint; | ||
} else if (options.datacenter === 'eu') { | ||
config.baseUrl = 'https://sdk.api.appboy.eu/api/v3'; | ||
} | ||
self.initializeTester(options.apiKey, config); | ||
window.appboy.initialize(options.apiKey, config); | ||
@@ -64,2 +72,5 @@ | ||
// This is used to test window.appboy.initialize | ||
Appboy.prototype.initializeTester = function() {}; | ||
/** | ||
@@ -66,0 +77,0 @@ * Loaded? |
{ | ||
"name": "@segment/analytics.js-integration-appboy", | ||
"description": "The Appboy analytics.js integration.", | ||
"version": "1.3.0", | ||
"version": "1.4.0", | ||
"keywords": [ | ||
@@ -55,4 +55,5 @@ "analytics.js", | ||
"phantomjs-prebuilt": "^2.1.7", | ||
"sinon": "^2.3.8", | ||
"watchify": "^3.7.0" | ||
} | ||
} |
@@ -9,2 +9,3 @@ 'use strict'; | ||
var assert = require('assert'); | ||
var sinon = require('sinon'); | ||
@@ -69,2 +70,30 @@ describe('Appboy', function() { | ||
it('should set the sdk endpoint to EU datacenter if options.datacenter === eu', function(done) { | ||
appboy.options.datacenter = 'eu'; | ||
var spy = sinon.spy(appboy, 'initializeTester'); | ||
analytics.once('ready', function() { | ||
try { | ||
assert.equal(spy.args[0][1].baseUrl, 'https://sdk.api.appboy.eu/api/v3'); | ||
done(); | ||
} catch (e) { | ||
done(e); | ||
} | ||
}); | ||
analytics.initialize(); | ||
}); | ||
it('should set the sdk endpoint to a custom URI if one is provided', function(done) { | ||
appboy.options.customEndpoint = 'https://my.custom.endpoint.com'; | ||
var spy = sinon.spy(appboy, 'initializeTester'); | ||
analytics.once('ready', function() { | ||
try { | ||
assert.equal(spy.args[0][1].baseUrl, 'https://my.custom.endpoint.com'); | ||
done(); | ||
} catch (e) { | ||
done(e); | ||
} | ||
}); | ||
analytics.initialize(); | ||
}); | ||
it('should call changeUser if userID is present', function(done) { | ||
@@ -71,0 +100,0 @@ analytics.user().id('user-id'); |
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
34561
667
24