Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@amplitude/analytics-browser

Package Overview
Dependencies
Maintainers
19
Versions
163
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@amplitude/analytics-browser - npm Package Compare versions

Comparing version 1.0.2 to 1.0.3

1

lib/cjs/attribution/campaign-tracker.d.ts

@@ -58,3 +58,2 @@ import { Storage, Campaign, CampaignParser as ICampaignParser, CampaignTracker as ICampaignTracker, CampaignTrackFunction, CampaignTrackerOptions } from '@amplitude/analytics-types';

ip?: string | undefined;
uuid?: string | undefined;
price?: number | undefined;

@@ -61,0 +60,0 @@ quantity?: number | undefined;

12

lib/cjs/browser-client.js

@@ -27,3 +27,3 @@ Object.defineProperty(exports, "__esModule", { value: true });

browserOptions = _d.sent();
return [4 /*yield*/, _super.prototype.init.call(this, undefined, undefined, browserOptions)];
return [4 /*yield*/, _super.prototype._init.call(this, browserOptions)];
case 3:

@@ -50,6 +50,12 @@ _d.sent();

_d.sent();
// Step 5: Track attributions
// Step 5: Set timeline ready for processing events
// Send existing events, which might be collected by track before init
this.timeline.isReady = true;
if (!this.config.optOut) {
this.timeline.scheduleApply(0);
}
// Step 6: Track attributions
return [4 /*yield*/, this.runAttributionStrategy(options === null || options === void 0 ? void 0 : options.attribution, isNewSession)];
case 6:
// Step 5: Track attributions
// Step 6: Track attributions
_d.sent();

@@ -56,0 +62,0 @@ return [2 /*return*/];

@@ -87,3 +87,3 @@ import { Event, BrowserOptions, BrowserConfig as IBrowserConfig, Storage, TrackingOptions, TransportType, UserSession, SessionManager as ISessionManager } from '@amplitude/analytics-types';

export declare const createFlexibleStorage: <T>(options: BrowserOptions) => Promise<Storage<T>>;
export declare const createEventsStorage: (overrides?: BrowserOptions | undefined) => Promise<Storage<Event[]>>;
export declare const createEventsStorage: (overrides?: BrowserOptions | undefined) => Promise<Storage<Event[]> | undefined>;
export declare const createDeviceId: (idFromCookies?: string | undefined, idFromOptions?: string | undefined, idFromQueryParams?: string | undefined) => string;

@@ -90,0 +90,0 @@ export declare const createTransport: (transport?: TransportType | undefined) => FetchTransport | XHRTransport | SendBeaconTransport;

@@ -52,3 +52,3 @@ var _this = this;

var defaultConfig = (0, exports.getDefaultConfig)();
_this = _super.call(this, (0, tslib_1.__assign)((0, tslib_1.__assign)({}, options), { apiKey: apiKey, storageProvider: (_a = options === null || options === void 0 ? void 0 : options.storageProvider) !== null && _a !== void 0 ? _a : defaultConfig.storageProvider, transportProvider: (_b = options === null || options === void 0 ? void 0 : options.transportProvider) !== null && _b !== void 0 ? _b : defaultConfig.transportProvider })) || this;
_this = _super.call(this, (0, tslib_1.__assign)((0, tslib_1.__assign)({ flushIntervalMillis: 1000, flushMaxRetries: 5, flushQueueSize: 30 }, options), { apiKey: apiKey, storageProvider: (_a = options === null || options === void 0 ? void 0 : options.storageProvider) !== null && _a !== void 0 ? _a : defaultConfig.storageProvider, transportProvider: (_b = options === null || options === void 0 ? void 0 : options.transportProvider) !== null && _b !== void 0 ? _b : defaultConfig.transportProvider })) || this;
_this.cookieStorage = (_c = options === null || options === void 0 ? void 0 : options.cookieStorage) !== null && _c !== void 0 ? _c : defaultConfig.cookieStorage;

@@ -224,23 +224,43 @@ _this.sessionManager = (_d = options === null || options === void 0 ? void 0 : options.sessionManager) !== null && _d !== void 0 ? _d : defaultConfig.sessionManager;

var createEventsStorage = function (overrides) { return (0, tslib_1.__awaiter)(_this, void 0, void 0, function () {
var eventsStorage, _a;
return (0, tslib_1.__generator)(this, function (_b) {
switch (_b.label) {
var hasStorageProviderProperty, _a, _b, storage, _c, e_1_1;
var e_1, _d;
return (0, tslib_1.__generator)(this, function (_e) {
switch (_e.label) {
case 0:
eventsStorage = overrides === null || overrides === void 0 ? void 0 : overrides.storageProvider;
_a = !eventsStorage;
if (_a) return [3 /*break*/, 2];
return [4 /*yield*/, eventsStorage.isEnabled()];
hasStorageProviderProperty = overrides && Object.prototype.hasOwnProperty.call(overrides, 'storageProvider');
if (!(!hasStorageProviderProperty || overrides.storageProvider)) return [3 /*break*/, 9];
_e.label = 1;
case 1:
_a = !(_b.sent());
_b.label = 2;
_e.trys.push([1, 7, 8, 9]);
_a = (0, tslib_1.__values)([overrides === null || overrides === void 0 ? void 0 : overrides.storageProvider, new local_storage_1.LocalStorage()]), _b = _a.next();
_e.label = 2;
case 2:
if (!_a) return [3 /*break*/, 4];
eventsStorage = new local_storage_1.LocalStorage();
return [4 /*yield*/, eventsStorage.isEnabled()];
if (!!_b.done) return [3 /*break*/, 6];
storage = _b.value;
_c = storage;
if (!_c) return [3 /*break*/, 4];
return [4 /*yield*/, storage.isEnabled()];
case 3:
if (!(_b.sent())) {
eventsStorage = new analytics_core_1.MemoryStorage();
_c = (_e.sent());
_e.label = 4;
case 4:
if (_c) {
return [2 /*return*/, storage];
}
_b.label = 4;
case 4: return [2 /*return*/, eventsStorage];
_e.label = 5;
case 5:
_b = _a.next();
return [3 /*break*/, 2];
case 6: return [3 /*break*/, 9];
case 7:
e_1_1 = _e.sent();
e_1 = { error: e_1_1 };
return [3 /*break*/, 9];
case 8:
try {
if (_b && !_b.done && (_d = _a.return)) _d.call(_a);
}
finally { if (e_1) throw e_1.error; }
return [7 /*endfinally*/];
case 9: return [2 /*return*/, undefined];
}

@@ -247,0 +267,0 @@ });

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

export declare const VERSION = "1.0.2";
export declare const VERSION = "1.0.3";
//# sourceMappingURL=version.d.ts.map
Object.defineProperty(exports, "__esModule", { value: true });
exports.VERSION = void 0;
exports.VERSION = '1.0.2';
exports.VERSION = '1.0.3';
//# sourceMappingURL=version.js.map

@@ -58,3 +58,2 @@ import { Storage, Campaign, CampaignParser as ICampaignParser, CampaignTracker as ICampaignTracker, CampaignTrackFunction, CampaignTrackerOptions } from '@amplitude/analytics-types';

ip?: string | undefined;
uuid?: string | undefined;
price?: number | undefined;

@@ -61,0 +60,0 @@ quantity?: number | undefined;

@@ -25,3 +25,3 @@ import { __assign, __awaiter, __extends, __generator } from "tslib";

browserOptions = _d.sent();
return [4 /*yield*/, _super.prototype.init.call(this, undefined, undefined, browserOptions)];
return [4 /*yield*/, _super.prototype._init.call(this, browserOptions)];
case 3:

@@ -48,6 +48,12 @@ _d.sent();

_d.sent();
// Step 5: Track attributions
// Step 5: Set timeline ready for processing events
// Send existing events, which might be collected by track before init
this.timeline.isReady = true;
if (!this.config.optOut) {
this.timeline.scheduleApply(0);
}
// Step 6: Track attributions
return [4 /*yield*/, this.runAttributionStrategy(options === null || options === void 0 ? void 0 : options.attribution, isNewSession)];
case 6:
// Step 5: Track attributions
// Step 6: Track attributions
_d.sent();

@@ -54,0 +60,0 @@ return [2 /*return*/];

@@ -87,3 +87,3 @@ import { Event, BrowserOptions, BrowserConfig as IBrowserConfig, Storage, TrackingOptions, TransportType, UserSession, SessionManager as ISessionManager } from '@amplitude/analytics-types';

export declare const createFlexibleStorage: <T>(options: BrowserOptions) => Promise<Storage<T>>;
export declare const createEventsStorage: (overrides?: BrowserOptions | undefined) => Promise<Storage<Event[]>>;
export declare const createEventsStorage: (overrides?: BrowserOptions | undefined) => Promise<Storage<Event[]> | undefined>;
export declare const createDeviceId: (idFromCookies?: string | undefined, idFromOptions?: string | undefined, idFromQueryParams?: string | undefined) => string;

@@ -90,0 +90,0 @@ export declare const createTransport: (transport?: TransportType | undefined) => FetchTransport | XHRTransport | SendBeaconTransport;

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

import { __assign, __awaiter, __extends, __generator } from "tslib";
import { __assign, __awaiter, __extends, __generator, __values } from "tslib";
import { TransportType, } from '@amplitude/analytics-types';

@@ -48,3 +48,3 @@ import { Config, MemoryStorage, UUID } from '@amplitude/analytics-core';

var defaultConfig = getDefaultConfig();
_this = _super.call(this, __assign(__assign({}, options), { apiKey: apiKey, storageProvider: (_a = options === null || options === void 0 ? void 0 : options.storageProvider) !== null && _a !== void 0 ? _a : defaultConfig.storageProvider, transportProvider: (_b = options === null || options === void 0 ? void 0 : options.transportProvider) !== null && _b !== void 0 ? _b : defaultConfig.transportProvider })) || this;
_this = _super.call(this, __assign(__assign({ flushIntervalMillis: 1000, flushMaxRetries: 5, flushQueueSize: 30 }, options), { apiKey: apiKey, storageProvider: (_a = options === null || options === void 0 ? void 0 : options.storageProvider) !== null && _a !== void 0 ? _a : defaultConfig.storageProvider, transportProvider: (_b = options === null || options === void 0 ? void 0 : options.transportProvider) !== null && _b !== void 0 ? _b : defaultConfig.transportProvider })) || this;
_this.cookieStorage = (_c = options === null || options === void 0 ? void 0 : options.cookieStorage) !== null && _c !== void 0 ? _c : defaultConfig.cookieStorage;

@@ -217,23 +217,43 @@ _this.sessionManager = (_d = options === null || options === void 0 ? void 0 : options.sessionManager) !== null && _d !== void 0 ? _d : defaultConfig.sessionManager;

export var createEventsStorage = function (overrides) { return __awaiter(void 0, void 0, void 0, function () {
var eventsStorage, _a;
return __generator(this, function (_b) {
switch (_b.label) {
var hasStorageProviderProperty, _a, _b, storage, _c, e_1_1;
var e_1, _d;
return __generator(this, function (_e) {
switch (_e.label) {
case 0:
eventsStorage = overrides === null || overrides === void 0 ? void 0 : overrides.storageProvider;
_a = !eventsStorage;
if (_a) return [3 /*break*/, 2];
return [4 /*yield*/, eventsStorage.isEnabled()];
hasStorageProviderProperty = overrides && Object.prototype.hasOwnProperty.call(overrides, 'storageProvider');
if (!(!hasStorageProviderProperty || overrides.storageProvider)) return [3 /*break*/, 9];
_e.label = 1;
case 1:
_a = !(_b.sent());
_b.label = 2;
_e.trys.push([1, 7, 8, 9]);
_a = __values([overrides === null || overrides === void 0 ? void 0 : overrides.storageProvider, new LocalStorage()]), _b = _a.next();
_e.label = 2;
case 2:
if (!_a) return [3 /*break*/, 4];
eventsStorage = new LocalStorage();
return [4 /*yield*/, eventsStorage.isEnabled()];
if (!!_b.done) return [3 /*break*/, 6];
storage = _b.value;
_c = storage;
if (!_c) return [3 /*break*/, 4];
return [4 /*yield*/, storage.isEnabled()];
case 3:
if (!(_b.sent())) {
eventsStorage = new MemoryStorage();
_c = (_e.sent());
_e.label = 4;
case 4:
if (_c) {
return [2 /*return*/, storage];
}
_b.label = 4;
case 4: return [2 /*return*/, eventsStorage];
_e.label = 5;
case 5:
_b = _a.next();
return [3 /*break*/, 2];
case 6: return [3 /*break*/, 9];
case 7:
e_1_1 = _e.sent();
e_1 = { error: e_1_1 };
return [3 /*break*/, 9];
case 8:
try {
if (_b && !_b.done && (_d = _a.return)) _d.call(_a);
}
finally { if (e_1) throw e_1.error; }
return [7 /*endfinally*/];
case 9: return [2 /*return*/, undefined];
}

@@ -240,0 +260,0 @@ });

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

export declare const VERSION = "1.0.2";
export declare const VERSION = "1.0.3";
//# sourceMappingURL=version.d.ts.map

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

export var VERSION = '1.0.2';
export var VERSION = '1.0.3';
//# sourceMappingURL=version.js.map
{
"name": "@amplitude/analytics-browser",
"version": "1.0.2",
"version": "1.0.3",
"description": "Official Amplitude SDK for Web",

@@ -23,6 +23,7 @@ "keywords": [

"scripts": {
"build": "yarn vesion-file && yarn bundle && yarn build:es5 && yarn build:esm",
"build": "yarn bundle && yarn build:es5 && yarn build:esm",
"bundle": "rollup --config rollup.config.js",
"build:es5": "tsc -p ./tsconfig.es5.json",
"build:esm": "tsc -p ./tsconfig.esm.json",
"clean": "rimraf node_modules lib coverage",
"fix": "yarn fix:eslint & yarn fix:prettier",

@@ -37,4 +38,4 @@ "fix:eslint": "eslint '{src,test}/**/*.ts' --fix",

"typecheck": "tsc -p ./tsconfig.json",
"version": "GENERATE_SNIPPET=true yarn build",
"vesion-file": "node -p \"'export const VERSION = \\'' + require('./package.json').version + '\\';'\" > src/version.ts"
"version": "GENERATE_SNIPPET=true yarn version-file && yarn build",
"version-file": "node -p \"'export const VERSION = \\'' + require('./package.json').version + '\\';'\" > src/version.ts"
},

@@ -45,4 +46,4 @@ "bugs": {

"dependencies": {
"@amplitude/analytics-core": "^0.6.3",
"@amplitude/analytics-types": "^0.6.0",
"@amplitude/analytics-core": "^0.6.4",
"@amplitude/analytics-types": "^0.6.1",
"@amplitude/ua-parser-js": "^0.7.31",

@@ -66,3 +67,3 @@ "tslib": "^2.3.1"

],
"gitHead": "ccece5d22caa0ae00b64cece3165ebc0a81dfc93"
"gitHead": "321002ef9a539959373204c3d7b15322b0936752"
}

@@ -49,3 +49,3 @@ <p align="center">

```typescript
amplitude.init(API_KEY)
amplitude.init(API_KEY);
```

@@ -55,3 +55,3 @@

Events represent how users interact with your application. For example, “Button Clicked” may be an action you want to note.
Events represent how users interact with your application. For example, "Button Clicked" may be an action you want to note.

@@ -109,3 +109,3 @@ ```typescript

```
```typescript
import { setGroup } from '@amplitude/analytics-browser';

@@ -112,0 +112,0 @@

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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

Sorry, the diff of this file is not supported yet

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

Sorry, the diff of this file is not supported yet

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