New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

amplitude-js

Package Overview
Dependencies
Maintainers
2
Versions
113
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

amplitude-js - npm Package Compare versions

Comparing version 3.7.0 to 3.8.0

2

amplitude-snippet.min.js
(function(e,t){var n=e.amplitude||{_q:[],_iq:{}};var r=t.createElement("script")
;r.type="text/javascript";r.async=true
;r.src="https://d24n15hnbwhuhn.cloudfront.net/libs/amplitude-3.7.0-min.gz.js"
;r.src="https://d24n15hnbwhuhn.cloudfront.net/libs/amplitude-3.8.0-min.gz.js"
;r.onload=function(){if(e.amplitude.runQueuedFunctions){

@@ -5,0 +5,0 @@ e.amplitude.runQueuedFunctions()}else{

## Unreleased
### 3.8.0 (October 27, 2017)
* Add `logLevel` config option
### 3.7.0 (September 14, 2017)

@@ -4,0 +8,0 @@

{
"name": "amplitude-js",
"author": "Amplitude <support@amplitude.com>",
"version": "3.7.0",
"version": "3.8.0",
"license": "MIT",

@@ -6,0 +6,0 @@ "description": "Javascript library for Amplitude Analytics",

@@ -10,5 +10,9 @@ Amplitude-JavaScript

# Latest Version #
[3.7.0 - Released on September 14, 2017](https://github.com/amplitude/Amplitude-JavaScript/releases/latest)
[![Circle CI](https://circleci.com/gh/amplitude/Amplitude-JavaScript.svg?style=badge&circle-token=80de0dbb7632b2db13f76ccb20a79bbdfc50c215)](https://circleci.com/gh/amplitude/Amplitude-JavaScript)
[![Circle CI](https://circleci.com/gh/amplitude/Amplitude-JavaScript.svg?style=shield&circle-token=80de0dbb7632b2db13f76ccb20a79bbdfc50c215)](https://circleci.com/gh/amplitude/Amplitude-JavaScript)
[![npm version](https://badge.fury.io/js/amplitude-js.svg)](https://badge.fury.io/js/amplitude-js)
[![Bower version](https://badge.fury.io/bo/amplitude-js.svg)](https://badge.fury.io/bo/amplitude-js)
[3.8.0 - Released on October 27, 2017](https://github.com/amplitude/Amplitude-JavaScript/releases/latest)
# JavaScript SDK Reference #

@@ -15,0 +19,0 @@ See our [JavaScript SDK Reference](https://amplitude.zendesk.com/hc/en-us/articles/115002889587-JavaScript-SDK-Reference) for a list and description of all available SDK methods.

@@ -63,3 +63,3 @@ import Constants from './constants';

if (type(apiKey) !== 'string' || utils.isEmptyString(apiKey)) {
utils.log('Invalid apiKey. Please re-initialize with a valid apiKey');
utils.log.error('Invalid apiKey. Please re-initialize with a valid apiKey');
return;

@@ -132,3 +132,3 @@ }

} catch (e) {
utils.log(e);
utils.log.error(e);
} finally {

@@ -212,3 +212,3 @@ if (type(opt_callback) === 'function') {

if (utils.isEmptyString(this.options.apiKey)) {
utils.log('Invalid apiKey. Please set a valid apiKey with init() before calling ' + methodName);
utils.log.error('Invalid apiKey. Please set a valid apiKey with init() before calling ' + methodName);
return false;

@@ -237,3 +237,3 @@ }

}
utils.log('Unable to load ' + unsentKey + ' events. Restart with a new empty queue.');
utils.log.error('Unable to load ' + unsentKey + ' events. Restart with a new empty queue.');
return [];

@@ -586,3 +586,3 @@ };

} catch (e) {
utils.log(e);
utils.log.error(e);
}

@@ -602,3 +602,3 @@ };

} catch (e) {
utils.log(e);
utils.log.error(e);
}

@@ -647,3 +647,3 @@ };

} catch (e) {
utils.log(e);
utils.log.error(e);
}

@@ -661,3 +661,3 @@ };

} catch (e) {
utils.log(e);
utils.log.error(e);
}

@@ -696,3 +696,3 @@ };

} catch (e) {
utils.log(e);
utils.log.error(e);
}

@@ -791,3 +791,3 @@ };

} else {
utils.log('Invalid identify input type. Expected Identify object but saw ' + type(identify_obj));
utils.log.error('Invalid identify input type. Expected Identify object but saw ' + type(identify_obj));
}

@@ -890,3 +890,3 @@

} catch (e) {
utils.log(e);
utils.log.error(e);
}

@@ -1007,3 +1007,3 @@ };

} else {
utils.log('Invalid revenue input type. Expected Revenue object but saw ' + type(revenue_obj));
utils.log.error('Invalid revenue input type. Expected Revenue object but saw ' + type(revenue_obj));
}

@@ -1157,3 +1157,3 @@ };

if (noEvents && noIdentifys) {
utils.log('Merging Events and Identifys, less events and identifys than expected');
utils.log.error('Merging Events and Identifys, less events and identifys than expected');
break;

@@ -1160,0 +1160,0 @@ }

@@ -6,3 +6,3 @@ (function(window, document) {

as.async = true;
as.src = 'https://d24n15hnbwhuhn.cloudfront.net/libs/amplitude-3.7.0-min.gz.js';
as.src = 'https://d24n15hnbwhuhn.cloudfront.net/libs/amplitude-3.8.0-min.gz.js';
as.onload = function() {if(window.amplitude.runQueuedFunctions) {window.amplitude.runQueuedFunctions();} else {console.log('[Amplitude] Error: could not load SDK');}};

@@ -9,0 +9,0 @@ var s = document.getElementsByTagName('script')[0];

@@ -49,3 +49,3 @@ import type from './type';

} else {
utils.log('Unsupported type for value: ' + type(value) + ', expecting number or string');
utils.log.error('Unsupported type for value: ' + type(value) + ', expecting number or string');
}

@@ -85,3 +85,3 @@ return this;

if (!this.userPropertiesOperations.hasOwnProperty(AMP_OP_CLEAR_ALL)) {
utils.log('Need to send $clearAll on its own Identify object without any other operations, skipping $clearAll');
utils.log.error('Need to send $clearAll on its own Identify object without any other operations, skipping $clearAll');
}

@@ -169,3 +169,3 @@ return this;

if (this.userPropertiesOperations.hasOwnProperty(AMP_OP_CLEAR_ALL)) {
utils.log('This identify already contains a $clearAll operation, skipping operation ' + operation);
utils.log.error('This identify already contains a $clearAll operation, skipping operation ' + operation);
return;

@@ -176,3 +176,3 @@ }

if (this.properties.indexOf(property) !== -1) {
utils.log('User property "' + property + '" already used in this identify, skipping operation ' + operation);
utils.log.error('User property "' + property + '" already used in this identify, skipping operation ' + operation);
return;

@@ -179,0 +179,0 @@ }

@@ -12,2 +12,3 @@ import language from './language';

language: language.language,
logLevel: 'WARN',
optOut: false,

@@ -14,0 +15,0 @@ platform: 'Web',

@@ -43,5 +43,5 @@ import constants from './constants';

if (type(productId) !== 'string') {
utils.log('Unsupported type for productId: ' + type(productId) + ', expecting string');
utils.log.error('Unsupported type for productId: ' + type(productId) + ', expecting string');
} else if (utils.isEmptyString(productId)) {
utils.log('Invalid empty productId');
utils.log.error('Invalid empty productId');
} else {

@@ -63,3 +63,3 @@ this._productId = productId;

if (type(quantity) !== 'number') {
utils.log('Unsupported type for quantity: ' + type(quantity) + ', expecting number');
utils.log.error('Unsupported type for quantity: ' + type(quantity) + ', expecting number');
} else {

@@ -82,3 +82,3 @@ this._quantity = parseInt(quantity);

if (type(price) !== 'number') {
utils.log('Unsupported type for price: ' + type(price) + ', expecting number');
utils.log.error('Unsupported type for price: ' + type(price) + ', expecting number');
} else {

@@ -100,3 +100,3 @@ this._price = price;

if (type(revenueType) !== 'string') {
utils.log('Unsupported type for revenueType: ' + type(revenueType) + ', expecting string');
utils.log.error('Unsupported type for revenueType: ' + type(revenueType) + ', expecting string');
} else {

@@ -119,3 +119,3 @@ this._revenueType = revenueType;

if (type(eventProperties) !== 'object') {
utils.log('Unsupported type for eventProperties: ' + type(eventProperties) + ', expecting object');
utils.log.error('Unsupported type for eventProperties: ' + type(eventProperties) + ', expecting object');
} else {

@@ -132,3 +132,3 @@ this._properties = utils.validateProperties(eventProperties);

if (type(this._price) !== 'number') {
utils.log('Invalid revenue, need to set price field');
utils.log.error('Invalid revenue, need to set price field');
return false;

@@ -135,0 +135,0 @@ }

import constants from './constants';
import type from './type';
var log = function log(s) {
let logLevel = 'WARN';
var logLevels = {
DISABLE: 0,
ERROR: 1,
WARN: 2,
INFO: 3,
};
const setLogLevel = function setLogLevel(logLevelName) {
logLevel = logLevels[logLevelName] || logLevel;
};
const getLogLevel = function getLogLevel() {
return logLevel;
};
const log = {
error: (s) => {
if (logLevel >= logLevels.ERROR) {
_log(s);
}
},
warn: (s) => {
if (logLevel >= logLevels.WARN) {
_log(s);
}
},
info: (s) => {
if (logLevel >= logLevels.INFO) {
_log(s);
}
},
};
var _log = function _log(s) {
try {

@@ -53,3 +90,3 @@ console.log('[Amplitude] ' + s);

if (type(input) !== expectedType) {
log('Invalid ' + name + ' input type. Expected ' + expectedType + ' but received ' + type(input));
log.error('Invalid ' + name + ' input type. Expected ' + expectedType + ' but received ' + type(input));
return false;

@@ -64,3 +101,3 @@ }

if (propsType !== 'object') {
log('Error: invalid properties format. Expecting Javascript object, received ' + propsType + ', ignoring');
log.error('Error: invalid properties format. Expecting Javascript object, received ' + propsType + ', ignoring');
return {};

@@ -70,3 +107,3 @@ }

if (Object.keys(properties).length > constants.MAX_PROPERTY_KEYS) {
log('Error: too many properties (more than 1000), ignoring');
log.error('Error: too many properties (more than 1000), ignoring');
return {};

@@ -86,3 +123,3 @@ }

key = String(key);
log('WARNING: Non-string property key, received type ' + keyType + ', coercing to string "' + key + '"');
log.warn('WARNING: Non-string property key, received type ' + keyType + ', coercing to string "' + key + '"');
}

@@ -107,7 +144,7 @@

if (invalidValueTypes.indexOf(valueType) !== -1) {
log('WARNING: Property key "' + key + '" with invalid value type ' + valueType + ', ignoring');
log.warn('WARNING: Property key "' + key + '" with invalid value type ' + valueType + ', ignoring');
value = null;
} else if (valueType === 'error') {
value = String(value);
log('WARNING: Property key "' + key + '" with value type error, coercing to ' + value);
log.warn('WARNING: Property key "' + key + '" with value type error, coercing to ' + value);
} else if (valueType === 'array') {

@@ -120,3 +157,3 @@ // check for nested arrays or objects

if (elemType === 'array' || elemType === 'object') {
log('WARNING: Cannot have ' + elemType + ' nested in an array property value, skipping');
log.warn('WARNING: Cannot have ' + elemType + ' nested in an array property value, skipping');
continue;

@@ -136,3 +173,3 @@ }

if (groupsType !== 'object') {
log('Error: invalid groups format. Expecting Javascript object, received ' + groupsType + ', ignoring');
log.error('Error: invalid groups format. Expecting Javascript object, received ' + groupsType + ', ignoring');
return {};

@@ -152,3 +189,3 @@ }

key = String(key);
log('WARNING: Non-string groupType, received type ' + keyType + ', coercing to string "' + key + '"');
log.warn('WARNING: Non-string groupType, received type ' + keyType + ', coercing to string "' + key + '"');
}

@@ -173,3 +210,3 @@

groupName = String(groupName);
log('WARNING: Non-string groupName, received type ' + groupNameType + ', coercing to string "' + groupName + '"');
log.warn('WARNING: Non-string groupName, received type ' + groupNameType + ', coercing to string "' + groupName + '"');
return groupName;

@@ -184,3 +221,3 @@ }

if (elemType === 'array' || elemType === 'object') {
log('WARNING: Skipping nested ' + elemType + ' in array groupName');
log.warn('WARNING: Skipping nested ' + elemType + ' in array groupName');
continue;

@@ -191,3 +228,3 @@ } else if (elemType === 'string') {

element = String(element);
log('WARNING: Non-string groupName, received type ' + elemType + ', coercing to string "' + element + '"');
log.warn('WARNING: Non-string groupName, received type ' + elemType + ', coercing to string "' + element + '"');
arrayCopy.push(element);

@@ -198,3 +235,3 @@ }

}
log('WARNING: Non-string groupName, received type ' + groupNameType +
log.warn('WARNING: Non-string groupName, received type ' + groupNameType +
'. Please use strings or array of strings for groupName');

@@ -212,10 +249,12 @@ };

export default {
log: log,
isEmptyString: isEmptyString,
getQueryParam: getQueryParam,
sessionStorageEnabled: sessionStorageEnabled,
truncate: truncate,
validateGroups: validateGroups,
validateInput: validateInput,
validateProperties: validateProperties
setLogLevel,
getLogLevel,
log,
isEmptyString,
getQueryParam,
sessionStorageEnabled,
truncate,
validateGroups,
validateInput,
validateProperties,
};

@@ -1,1 +0,1 @@

export default '3.7.0';
export default '3.8.0';

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc