Skip to content

Commit a6ab9ce

Browse files
committed
v4.5.1
1 parent bc418fd commit a6ab9ce

12 files changed

+45
-13
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
### 4.5.1 (November 7, 2018)
2+
3+
* Fix error that might occur if another party defines a global variable named `Buffer` that is not actually a `Buffer`.
4+
5+
* Fix bug where the log level was not initialized correctly
6+
17
### 4.5.0 (October 24, 2018)
28

39
* Add support for groupIdentify calls

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ Please see our [installation guide](https://amplitude.zendesk.com/hc/en-us/artic
1111
[![npm version](https://badge.fury.io/js/amplitude-js.svg)](https://badge.fury.io/js/amplitude-js)
1212
[![Bower version](https://badge.fury.io/bo/amplitude-js.svg)](https://badge.fury.io/bo/amplitude-js)
1313

14-
[4.5.0 - Released on October 24, 2018](https://github.com/amplitude/Amplitude-JavaScript/releases/latest)
14+
[4.5.1 - Released on November 7, 2018](https://github.com/amplitude/Amplitude-JavaScript/releases/latest)
1515

1616

1717
# JavaScript SDK Reference #

amplitude-snippet.min.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
(function(e,t){var n=e.amplitude||{_q:[],_iq:{}};var r=t.createElement("script")
22
;r.type="text/javascript";r.async=true
3-
;r.src="https://cdn.amplitude.com/libs/amplitude-4.5.0-min.gz.js"
3+
;r.src="https://cdn.amplitude.com/libs/amplitude-4.5.1-min.gz.js"
44
;r.onload=function(){if(e.amplitude.runQueuedFunctions){
55
e.amplitude.runQueuedFunctions()}else{
66
console.log("[Amplitude] Error: could not load SDK")}}

amplitude.js

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2035,23 +2035,23 @@ var type = function (val) {
20352035
return 'element';
20362036
}
20372037

2038-
if (typeof Buffer !== 'undefined' && Buffer.isBuffer(val)) {
2038+
if (typeof Buffer !== 'undefined' && typeof Buffer.isBuffer === 'function' && Buffer.isBuffer(val)) {
20392039
return 'buffer';
20402040
}
20412041

20422042
val = val.valueOf ? val.valueOf() : Object.prototype.valueOf.apply(val);
20432043
return typeof val === 'undefined' ? 'undefined' : _typeof(val);
20442044
};
20452045

2046-
var logLevel = 'WARN';
2047-
20482046
var logLevels = {
20492047
DISABLE: 0,
20502048
ERROR: 1,
20512049
WARN: 2,
20522050
INFO: 3
20532051
};
20542052

2053+
var logLevel = logLevels.WARN;
2054+
20552055
var setLogLevel = function setLogLevel(logLevelName) {
20562056
logLevel = logLevels[logLevelName] || logLevel;
20572057
};
@@ -6616,7 +6616,7 @@ var uuid$1 = function uuid(a) {
66166616
);
66176617
};
66186618

6619-
var version = '4.5.0';
6619+
var version = '4.5.1';
66206620

66216621
var getLanguage = function getLanguage() {
66226622
return navigator && (navigator.languages && navigator.languages[0] || navigator.language || navigator.userLanguage) || undefined;
@@ -6723,6 +6723,11 @@ AmplitudeClient.prototype.init = function init(apiKey, opt_userId, opt_config, o
67236723
this._storageSuffix = '_' + apiKey + this._legacyStorageSuffix;
67246724

67256725
_parseConfig(this.options, opt_config);
6726+
6727+
if (type(this.options.logLevel) === 'string') {
6728+
utils.setLogLevel(this.options.logLevel);
6729+
}
6730+
67266731
var trackingOptions = _generateApiPropertiesTrackingConfig(this);
67276732
this._apiPropertiesTrackingOptions = Object.keys(trackingOptions).length > 0 ? { tracking_options: trackingOptions } : {};
67286733

amplitude.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "amplitude-js",
33
"author": "Amplitude <[email protected]>",
4-
"version": "4.5.0",
4+
"version": "4.5.1",
55
"license": "MIT",
66
"description": "Javascript library for Amplitude Analytics",
77
"keywords": [

src/amplitude-client.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,11 @@ AmplitudeClient.prototype.init = function init(apiKey, opt_userId, opt_config, o
6969
this._storageSuffix = '_' + apiKey + this._legacyStorageSuffix;
7070

7171
_parseConfig(this.options, opt_config);
72+
73+
if (type(this.options.logLevel) === 'string') {
74+
utils.setLogLevel(this.options.logLevel);
75+
}
76+
7277
var trackingOptions = _generateApiPropertiesTrackingConfig(this);
7378
this._apiPropertiesTrackingOptions = Object.keys(trackingOptions).length > 0 ? {tracking_options: trackingOptions} : {};
7479

src/amplitude-snippet.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
var as = document.createElement('script');
44
as.type = 'text/javascript';
55
as.async = true;
6-
as.src = 'https://cdn.amplitude.com/libs/amplitude-4.5.0-min.gz.js';
6+
as.src = 'https://cdn.amplitude.com/libs/amplitude-4.5.1-min.gz.js';
77
as.onload = function() {if(window.amplitude.runQueuedFunctions) {window.amplitude.runQueuedFunctions();} else {console.log('[Amplitude] Error: could not load SDK');}};
88
var s = document.getElementsByTagName('script')[0];
99
s.parentNode.insertBefore(as, s);

src/utils.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
import constants from './constants';
22
import type from './type';
33

4-
let logLevel = 'WARN';
5-
64
var logLevels = {
75
DISABLE: 0,
86
ERROR: 1,
97
WARN: 2,
108
INFO: 3,
119
};
1210

11+
let logLevel = logLevels.WARN;
12+
1313
const setLogLevel = function setLogLevel(logLevelName) {
1414
logLevel = logLevels[logLevelName] || logLevel;
1515
};

src/version.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
export default '4.5.0';
1+
export default '4.5.1';

0 commit comments

Comments
 (0)