@amplitude/analytics-browser
Advanced tools
Comparing version 1.6.6 to 1.6.7
@@ -11,3 +11,3 @@ Object.defineProperty(exports, "__esModule", { value: true }); | ||
var AmplitudeBrowser = /** @class */ (function (_super) { | ||
(0, tslib_1.__extends)(AmplitudeBrowser, _super); | ||
tslib_1.__extends(AmplitudeBrowser, _super); | ||
function AmplitudeBrowser() { | ||
@@ -19,6 +19,6 @@ return _super !== null && _super.apply(this, arguments) || this; | ||
if (apiKey === void 0) { apiKey = ''; } | ||
return (0, tslib_1.__awaiter)(this, void 0, void 0, function () { | ||
return tslib_1.__awaiter(this, void 0, void 0, function () { | ||
var oldCookies, browserOptions, isNewSession, connector; | ||
var _this = this; | ||
return (0, tslib_1.__generator)(this, function (_d) { | ||
return tslib_1.__generator(this, function (_d) { | ||
switch (_d.label) { | ||
@@ -34,3 +34,3 @@ case 0: | ||
oldCookies = _d.sent(); | ||
return [4 /*yield*/, (0, config_1.useBrowserConfig)(apiKey, userId || oldCookies.userId, (0, tslib_1.__assign)((0, tslib_1.__assign)({}, options), { deviceId: (_a = oldCookies.deviceId) !== null && _a !== void 0 ? _a : options === null || options === void 0 ? void 0 : options.deviceId, sessionId: (_b = oldCookies.sessionId) !== null && _b !== void 0 ? _b : options === null || options === void 0 ? void 0 : options.sessionId, optOut: (_c = options === null || options === void 0 ? void 0 : options.optOut) !== null && _c !== void 0 ? _c : oldCookies.optOut, lastEventTime: oldCookies.lastEventTime }))]; | ||
return [4 /*yield*/, (0, config_1.useBrowserConfig)(apiKey, userId || oldCookies.userId, tslib_1.__assign(tslib_1.__assign({}, options), { deviceId: (_a = oldCookies.deviceId) !== null && _a !== void 0 ? _a : options === null || options === void 0 ? void 0 : options.deviceId, sessionId: (_b = oldCookies.sessionId) !== null && _b !== void 0 ? _b : options === null || options === void 0 ? void 0 : options.sessionId, optOut: (_c = options === null || options === void 0 ? void 0 : options.optOut) !== null && _c !== void 0 ? _c : oldCookies.optOut, lastEventTime: oldCookies.lastEventTime }))]; | ||
case 2: | ||
@@ -89,5 +89,5 @@ browserOptions = _d.sent(); | ||
if (isNewSession === void 0) { isNewSession = false; } | ||
return (0, tslib_1.__awaiter)(this, void 0, void 0, function () { | ||
return tslib_1.__awaiter(this, void 0, void 0, function () { | ||
var track, onNewCampaign, storage, campaignTracker; | ||
return (0, tslib_1.__generator)(this, function (_a) { | ||
return tslib_1.__generator(this, function (_a) { | ||
switch (_a.label) { | ||
@@ -100,3 +100,3 @@ case 0: | ||
storage = _a.sent(); | ||
campaignTracker = new analytics_client_common_1.CampaignTracker(this.config.apiKey, (0, tslib_1.__assign)((0, tslib_1.__assign)({}, attributionConfig), { storage: storage, track: track, onNewCampaign: onNewCampaign })); | ||
campaignTracker = new analytics_client_common_1.CampaignTracker(this.config.apiKey, tslib_1.__assign(tslib_1.__assign({}, attributionConfig), { storage: storage, track: track, onNewCampaign: onNewCampaign })); | ||
return [4 /*yield*/, campaignTracker.send(isNewSession)]; | ||
@@ -103,0 +103,0 @@ case 2: |
@@ -44,4 +44,4 @@ import { AttributionOptions, Event, BrowserOptions, BrowserConfig as IBrowserConfig, Storage, TrackingOptions, TransportType, UserSession, SessionManager as ISessionManager } from '@amplitude/analytics-types'; | ||
} | ||
export declare const useBrowserConfig: (apiKey: string, userId?: string | undefined, options?: BrowserOptions | undefined) => Promise<IBrowserConfig>; | ||
export declare const createCookieStorage: (overrides?: BrowserOptions | undefined, baseConfig?: { | ||
export declare const useBrowserConfig: (apiKey: string, userId?: string, options?: BrowserOptions) => Promise<IBrowserConfig>; | ||
export declare const createCookieStorage: (overrides?: BrowserOptions, baseConfig?: { | ||
cookieExpiration: number; | ||
@@ -60,6 +60,6 @@ cookieSameSite: string; | ||
export declare const createFlexibleStorage: <T>(options: BrowserOptions) => Promise<Storage<T>>; | ||
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; | ||
export declare const createTransport: (transport?: TransportType | undefined) => FetchTransport | XHRTransport | SendBeaconTransport; | ||
export declare const getTopLevelDomain: (url?: string | undefined) => Promise<string>; | ||
export declare const createEventsStorage: (overrides?: BrowserOptions) => Promise<Storage<Event[]> | undefined>; | ||
export declare const createDeviceId: (idFromCookies?: string, idFromOptions?: string, idFromQueryParams?: string) => string; | ||
export declare const createTransport: (transport?: TransportType) => FetchTransport | XHRTransport | SendBeaconTransport; | ||
export declare const getTopLevelDomain: (url?: string) => Promise<string>; | ||
//# sourceMappingURL=config.d.ts.map |
@@ -38,8 +38,8 @@ var _this = this; | ||
var BrowserConfig = /** @class */ (function (_super) { | ||
(0, tslib_1.__extends)(BrowserConfig, _super); | ||
tslib_1.__extends(BrowserConfig, _super); | ||
function BrowserConfig(apiKey, userId, options) { | ||
var _this = this; | ||
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m; | ||
var _this = this; | ||
var defaultConfig = (0, exports.getDefaultConfig)(); | ||
_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 = _super.call(this, tslib_1.__assign(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; | ||
@@ -118,7 +118,7 @@ _this.sessionManager = (_d = options === null || options === void 0 ? void 0 : options.sessionManager) !== null && _d !== void 0 ? _d : defaultConfig.sessionManager; | ||
exports.BrowserConfig = BrowserConfig; | ||
var useBrowserConfig = function (apiKey, userId, options) { return (0, tslib_1.__awaiter)(_this, void 0, void 0, function () { | ||
var useBrowserConfig = function (apiKey, userId, options) { return tslib_1.__awaiter(_this, void 0, void 0, function () { | ||
var defaultConfig, domain, _a, cookieStorage, cookieName, cookies, queryParams, sessionManager, _b, _c, _d; | ||
var _e; | ||
var _f, _g, _h, _j, _k; | ||
return (0, tslib_1.__generator)(this, function (_l) { | ||
return tslib_1.__generator(this, function (_l) { | ||
switch (_l.label) { | ||
@@ -136,3 +136,3 @@ case 0: | ||
domain = _a; | ||
return [4 /*yield*/, (0, exports.createCookieStorage)((0, tslib_1.__assign)((0, tslib_1.__assign)({}, options), { domain: domain }))]; | ||
return [4 /*yield*/, (0, exports.createCookieStorage)(tslib_1.__assign(tslib_1.__assign({}, options), { domain: domain }))]; | ||
case 4: | ||
@@ -150,3 +150,3 @@ cookieStorage = _l.sent(); | ||
_c = [void 0, apiKey, userId !== null && userId !== void 0 ? userId : cookies === null || cookies === void 0 ? void 0 : cookies.userId]; | ||
_d = [(0, tslib_1.__assign)({}, options)]; | ||
_d = [tslib_1.__assign({}, options)]; | ||
_e = { cookieStorage: cookieStorage, sessionManager: sessionManager, deviceId: (0, exports.createDeviceId)(cookies === null || cookies === void 0 ? void 0 : cookies.deviceId, options === null || options === void 0 ? void 0 : options.deviceId, queryParams.deviceId), domain: domain, optOut: (_g = options === null || options === void 0 ? void 0 : options.optOut) !== null && _g !== void 0 ? _g : Boolean(cookies === null || cookies === void 0 ? void 0 : cookies.optOut) }; | ||
@@ -157,3 +157,3 @@ return [4 /*yield*/, cookieStorage.get(cookieName)]; | ||
return [4 /*yield*/, (0, exports.createEventsStorage)(options)]; | ||
case 8: return [2 /*return*/, new (_b.apply(BrowserConfig, _c.concat([tslib_1.__assign.apply(void 0, _d.concat([(_e.storageProvider = _l.sent(), _e.trackingOptions = (0, tslib_1.__assign)((0, tslib_1.__assign)({}, defaultConfig.trackingOptions), options === null || options === void 0 ? void 0 : options.trackingOptions), _e.transportProvider = (_k = options === null || options === void 0 ? void 0 : options.transportProvider) !== null && _k !== void 0 ? _k : (0, exports.createTransport)(options === null || options === void 0 ? void 0 : options.transport), _e)]))])))()]; | ||
case 8: return [2 /*return*/, new (_b.apply(BrowserConfig, _c.concat([tslib_1.__assign.apply(void 0, _d.concat([(_e.storageProvider = _l.sent(), _e.trackingOptions = tslib_1.__assign(tslib_1.__assign({}, defaultConfig.trackingOptions), options === null || options === void 0 ? void 0 : options.trackingOptions), _e.transportProvider = (_k = options === null || options === void 0 ? void 0 : options.transportProvider) !== null && _k !== void 0 ? _k : (0, exports.createTransport)(options === null || options === void 0 ? void 0 : options.transport), _e)]))])))()]; | ||
} | ||
@@ -165,8 +165,8 @@ }); | ||
if (baseConfig === void 0) { baseConfig = (0, exports.getDefaultConfig)(); } | ||
return (0, tslib_1.__awaiter)(_this, void 0, void 0, function () { | ||
return tslib_1.__awaiter(_this, void 0, void 0, function () { | ||
var options, cookieStorage, _a; | ||
return (0, tslib_1.__generator)(this, function (_b) { | ||
return tslib_1.__generator(this, function (_b) { | ||
switch (_b.label) { | ||
case 0: | ||
options = (0, tslib_1.__assign)((0, tslib_1.__assign)({}, baseConfig), overrides); | ||
options = tslib_1.__assign(tslib_1.__assign({}, baseConfig), overrides); | ||
cookieStorage = overrides === null || overrides === void 0 ? void 0 : overrides.cookieStorage; | ||
@@ -189,5 +189,5 @@ _a = !cookieStorage; | ||
exports.createCookieStorage = createCookieStorage; | ||
var createFlexibleStorage = function (options) { return (0, tslib_1.__awaiter)(_this, void 0, void 0, function () { | ||
var createFlexibleStorage = function (options) { return tslib_1.__awaiter(_this, void 0, void 0, function () { | ||
var storage, _a; | ||
return (0, tslib_1.__generator)(this, function (_b) { | ||
return tslib_1.__generator(this, function (_b) { | ||
switch (_b.label) { | ||
@@ -221,6 +221,6 @@ case 0: | ||
exports.createFlexibleStorage = createFlexibleStorage; | ||
var createEventsStorage = function (overrides) { return (0, tslib_1.__awaiter)(_this, void 0, void 0, function () { | ||
var createEventsStorage = function (overrides) { return tslib_1.__awaiter(_this, void 0, void 0, function () { | ||
var hasStorageProviderProperty, _a, _b, storage, _c, e_1_1; | ||
var e_1, _d; | ||
return (0, tslib_1.__generator)(this, function (_e) { | ||
return tslib_1.__generator(this, function (_e) { | ||
switch (_e.label) { | ||
@@ -233,3 +233,3 @@ case 0: | ||
_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(); | ||
_a = tslib_1.__values([overrides === null || overrides === void 0 ? void 0 : overrides.storageProvider, new local_storage_1.LocalStorage()]), _b = _a.next(); | ||
_e.label = 2; | ||
@@ -283,5 +283,5 @@ case 2: | ||
exports.createTransport = createTransport; | ||
var getTopLevelDomain = function (url) { return (0, tslib_1.__awaiter)(_this, void 0, void 0, function () { | ||
var getTopLevelDomain = function (url) { return tslib_1.__awaiter(_this, void 0, void 0, function () { | ||
var host, parts, levels, storageKey, i, i, domain, options, storage, value; | ||
return (0, tslib_1.__generator)(this, function (_a) { | ||
return tslib_1.__generator(this, function (_a) { | ||
switch (_a.label) { | ||
@@ -288,0 +288,0 @@ case 0: return [4 /*yield*/, new analytics_client_common_1.CookieStorage().isEnabled()]; |
import { BrowserOptions, UserSession } from '@amplitude/analytics-types'; | ||
export declare const parseOldCookies: (apiKey: string, options?: BrowserOptions | undefined) => Promise<UserSession>; | ||
export declare const parseOldCookies: (apiKey: string, options?: BrowserOptions) => Promise<UserSession>; | ||
export declare const parseTime: (num: string) => number | undefined; | ||
export declare const decode: (value?: string | undefined) => string | undefined; | ||
export declare const decode: (value?: string) => string | undefined; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -7,5 +7,5 @@ var _this = this; | ||
var local_storage_1 = require("../storage/local-storage"); | ||
var parseOldCookies = function (apiKey, options) { return (0, tslib_1.__awaiter)(_this, void 0, void 0, function () { | ||
var parseOldCookies = function (apiKey, options) { return tslib_1.__awaiter(_this, void 0, void 0, function () { | ||
var storage, oldCookieName, cookies, _a, deviceId, userId, optOut, sessionId, lastEventTime; | ||
return (0, tslib_1.__generator)(this, function (_b) { | ||
return tslib_1.__generator(this, function (_b) { | ||
switch (_b.label) { | ||
@@ -38,3 +38,3 @@ case 0: | ||
_b.sent(); | ||
_a = (0, tslib_1.__read)(cookies.split('.'), 5), deviceId = _a[0], userId = _a[1], optOut = _a[2], sessionId = _a[3], lastEventTime = _a[4]; | ||
_a = tslib_1.__read(cookies.split('.'), 5), deviceId = _a[0], userId = _a[1], optOut = _a[2], sessionId = _a[3], lastEventTime = _a[4]; | ||
return [2 /*return*/, { | ||
@@ -41,0 +41,0 @@ deviceId: deviceId, |
@@ -5,3 +5,3 @@ Object.defineProperty(exports, "__esModule", { value: true }); | ||
/* eslint-disable @typescript-eslint/unbound-method */ | ||
var browser_client_1 = (0, tslib_1.__importDefault)(require("./browser-client")); | ||
var browser_client_1 = tslib_1.__importDefault(require("./browser-client")); | ||
var browser_client_2 = require("./browser-client"); | ||
@@ -15,3 +15,3 @@ Object.defineProperty(exports, "createInstance", { enumerable: true, get: function () { return browser_client_2.createInstance; } }); | ||
Object.defineProperty(exports, "Identify", { enumerable: true, get: function () { return analytics_core_1.Identify; } }); | ||
exports.Types = (0, tslib_1.__importStar)(require("@amplitude/analytics-types")); | ||
exports.Types = tslib_1.__importStar(require("@amplitude/analytics-types")); | ||
//# sourceMappingURL=index.js.map |
@@ -5,3 +5,3 @@ Object.defineProperty(exports, "__esModule", { value: true }); | ||
var analytics_types_1 = require("@amplitude/analytics-types"); | ||
var ua_parser_js_1 = (0, tslib_1.__importDefault)(require("@amplitude/ua-parser-js")); | ||
var ua_parser_js_1 = tslib_1.__importDefault(require("@amplitude/ua-parser-js")); | ||
var analytics_core_1 = require("@amplitude/analytics-core"); | ||
@@ -30,5 +30,5 @@ var analytics_client_common_1 = require("@amplitude/analytics-client-common"); | ||
Context.prototype.execute = function (context) { | ||
return (0, tslib_1.__awaiter)(this, void 0, void 0, function () { | ||
return tslib_1.__awaiter(this, void 0, void 0, function () { | ||
var time, osName, osVersion, deviceModel, deviceVendor, event; | ||
return (0, tslib_1.__generator)(this, function (_a) { | ||
return tslib_1.__generator(this, function (_a) { | ||
/** | ||
@@ -48,3 +48,3 @@ * Manages user session triggered by new events | ||
deviceVendor = this.uaResult.device.vendor; | ||
event = (0, tslib_1.__assign)((0, tslib_1.__assign)((0, tslib_1.__assign)((0, tslib_1.__assign)((0, tslib_1.__assign)((0, tslib_1.__assign)((0, tslib_1.__assign)((0, tslib_1.__assign)((0, tslib_1.__assign)((0, tslib_1.__assign)((0, tslib_1.__assign)((0, tslib_1.__assign)({ user_id: this.config.userId, device_id: this.config.deviceId, session_id: this.config.sessionId, time: time }, (this.config.appVersion && { app_version: this.config.appVersion })), (this.config.trackingOptions.platform && { platform: BROWSER_PLATFORM })), (this.config.trackingOptions.osName && { os_name: osName })), (this.config.trackingOptions.osVersion && { os_version: osVersion })), (this.config.trackingOptions.deviceManufacturer && { device_manufacturer: deviceVendor })), (this.config.trackingOptions.deviceModel && { device_model: deviceModel })), (this.config.trackingOptions.language && { language: (0, analytics_client_common_1.getLanguage)() })), (this.config.trackingOptions.ipAddress && { ip: IP_ADDRESS })), { insert_id: (0, analytics_core_1.UUID)(), partner_id: this.config.partnerId, plan: this.config.plan }), (this.config.ingestionMetadata && { | ||
event = tslib_1.__assign(tslib_1.__assign(tslib_1.__assign(tslib_1.__assign(tslib_1.__assign(tslib_1.__assign(tslib_1.__assign(tslib_1.__assign(tslib_1.__assign(tslib_1.__assign(tslib_1.__assign(tslib_1.__assign({ user_id: this.config.userId, device_id: this.config.deviceId, session_id: this.config.sessionId, time: time }, (this.config.appVersion && { app_version: this.config.appVersion })), (this.config.trackingOptions.platform && { platform: BROWSER_PLATFORM })), (this.config.trackingOptions.osName && { os_name: osName })), (this.config.trackingOptions.osVersion && { os_version: osVersion })), (this.config.trackingOptions.deviceManufacturer && { device_manufacturer: deviceVendor })), (this.config.trackingOptions.deviceModel && { device_model: deviceModel })), (this.config.trackingOptions.language && { language: (0, analytics_client_common_1.getLanguage)() })), (this.config.trackingOptions.ipAddress && { ip: IP_ADDRESS })), { insert_id: (0, analytics_core_1.UUID)(), partner_id: this.config.partnerId, plan: this.config.plan }), (this.config.ingestionMetadata && { | ||
ingestion_metadata: { | ||
@@ -51,0 +51,0 @@ source_name: this.config.ingestionMetadata.sourceName, |
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var tslib_1 = require("tslib"); | ||
var analytics_client_common_1 = require("@amplitude/analytics-client-common"); | ||
var amplitude = (0, tslib_1.__importStar)(require("./index")); | ||
var amplitude = tslib_1.__importStar(require("./index")); | ||
var snippet_helper_1 = require("./utils/snippet-helper"); | ||
@@ -6,0 +6,0 @@ // https://developer.mozilla.org/en-US/docs/Glossary/IIFE |
@@ -9,5 +9,5 @@ Object.defineProperty(exports, "__esModule", { value: true }); | ||
LocalStorage.prototype.isEnabled = function () { | ||
return (0, tslib_1.__awaiter)(this, void 0, void 0, function () { | ||
return tslib_1.__awaiter(this, void 0, void 0, function () { | ||
var random, testStorage, testKey, value, _a; | ||
return (0, tslib_1.__generator)(this, function (_b) { | ||
return tslib_1.__generator(this, function (_b) { | ||
switch (_b.label) { | ||
@@ -46,5 +46,5 @@ case 0: | ||
LocalStorage.prototype.get = function (key) { | ||
return (0, tslib_1.__awaiter)(this, void 0, void 0, function () { | ||
return tslib_1.__awaiter(this, void 0, void 0, function () { | ||
var value, _a; | ||
return (0, tslib_1.__generator)(this, function (_b) { | ||
return tslib_1.__generator(this, function (_b) { | ||
switch (_b.label) { | ||
@@ -72,4 +72,4 @@ case 0: | ||
var _a; | ||
return (0, tslib_1.__awaiter)(this, void 0, void 0, function () { | ||
return (0, tslib_1.__generator)(this, function (_b) { | ||
return tslib_1.__awaiter(this, void 0, void 0, function () { | ||
return tslib_1.__generator(this, function (_b) { | ||
return [2 /*return*/, ((_a = (0, analytics_client_common_1.getGlobalScope)()) === null || _a === void 0 ? void 0 : _a.localStorage.getItem(key)) || undefined]; | ||
@@ -81,4 +81,4 @@ }); | ||
var _a; | ||
return (0, tslib_1.__awaiter)(this, void 0, void 0, function () { | ||
return (0, tslib_1.__generator)(this, function (_b) { | ||
return tslib_1.__awaiter(this, void 0, void 0, function () { | ||
return tslib_1.__generator(this, function (_b) { | ||
try { | ||
@@ -96,4 +96,4 @@ (_a = (0, analytics_client_common_1.getGlobalScope)()) === null || _a === void 0 ? void 0 : _a.localStorage.setItem(key, JSON.stringify(value)); | ||
var _a; | ||
return (0, tslib_1.__awaiter)(this, void 0, void 0, function () { | ||
return (0, tslib_1.__generator)(this, function (_b) { | ||
return tslib_1.__awaiter(this, void 0, void 0, function () { | ||
return tslib_1.__generator(this, function (_b) { | ||
try { | ||
@@ -111,4 +111,4 @@ (_a = (0, analytics_client_common_1.getGlobalScope)()) === null || _a === void 0 ? void 0 : _a.localStorage.removeItem(key); | ||
var _a; | ||
return (0, tslib_1.__awaiter)(this, void 0, void 0, function () { | ||
return (0, tslib_1.__generator)(this, function (_b) { | ||
return tslib_1.__awaiter(this, void 0, void 0, function () { | ||
return tslib_1.__generator(this, function (_b) { | ||
try { | ||
@@ -115,0 +115,0 @@ (_a = (0, analytics_client_common_1.getGlobalScope)()) === null || _a === void 0 ? void 0 : _a.localStorage.clear(); |
@@ -7,3 +7,3 @@ Object.defineProperty(exports, "__esModule", { value: true }); | ||
var SendBeaconTransport = /** @class */ (function (_super) { | ||
(0, tslib_1.__extends)(SendBeaconTransport, _super); | ||
tslib_1.__extends(SendBeaconTransport, _super); | ||
function SendBeaconTransport() { | ||
@@ -13,5 +13,5 @@ return _super !== null && _super.apply(this, arguments) || this; | ||
SendBeaconTransport.prototype.send = function (serverUrl, payload) { | ||
return (0, tslib_1.__awaiter)(this, void 0, void 0, function () { | ||
return tslib_1.__awaiter(this, void 0, void 0, function () { | ||
var _this = this; | ||
return (0, tslib_1.__generator)(this, function (_a) { | ||
return tslib_1.__generator(this, function (_a) { | ||
return [2 /*return*/, new Promise(function (resolve, reject) { | ||
@@ -18,0 +18,0 @@ var globalScope = (0, analytics_client_common_1.getGlobalScope)(); |
@@ -6,3 +6,3 @@ Object.defineProperty(exports, "__esModule", { value: true }); | ||
var XHRTransport = /** @class */ (function (_super) { | ||
(0, tslib_1.__extends)(XHRTransport, _super); | ||
tslib_1.__extends(XHRTransport, _super); | ||
function XHRTransport() { | ||
@@ -16,5 +16,5 @@ var _this = _super !== null && _super.apply(this, arguments) || this; | ||
XHRTransport.prototype.send = function (serverUrl, payload) { | ||
return (0, tslib_1.__awaiter)(this, void 0, void 0, function () { | ||
return tslib_1.__awaiter(this, void 0, void 0, function () { | ||
var _this = this; | ||
return (0, tslib_1.__generator)(this, function (_a) { | ||
return tslib_1.__generator(this, function (_a) { | ||
return [2 /*return*/, new Promise(function (resolve, reject) { | ||
@@ -21,0 +21,0 @@ /* istanbul ignore if */ |
@@ -1,2 +0,2 @@ | ||
export declare const VERSION = "1.6.6"; | ||
export declare const VERSION = "1.6.7"; | ||
//# sourceMappingURL=version.d.ts.map |
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.VERSION = void 0; | ||
exports.VERSION = '1.6.6'; | ||
exports.VERSION = '1.6.7'; | ||
//# sourceMappingURL=version.js.map |
@@ -44,4 +44,4 @@ import { AttributionOptions, Event, BrowserOptions, BrowserConfig as IBrowserConfig, Storage, TrackingOptions, TransportType, UserSession, SessionManager as ISessionManager } from '@amplitude/analytics-types'; | ||
} | ||
export declare const useBrowserConfig: (apiKey: string, userId?: string | undefined, options?: BrowserOptions | undefined) => Promise<IBrowserConfig>; | ||
export declare const createCookieStorage: (overrides?: BrowserOptions | undefined, baseConfig?: { | ||
export declare const useBrowserConfig: (apiKey: string, userId?: string, options?: BrowserOptions) => Promise<IBrowserConfig>; | ||
export declare const createCookieStorage: (overrides?: BrowserOptions, baseConfig?: { | ||
cookieExpiration: number; | ||
@@ -60,6 +60,6 @@ cookieSameSite: string; | ||
export declare const createFlexibleStorage: <T>(options: BrowserOptions) => Promise<Storage<T>>; | ||
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; | ||
export declare const createTransport: (transport?: TransportType | undefined) => FetchTransport | XHRTransport | SendBeaconTransport; | ||
export declare const getTopLevelDomain: (url?: string | undefined) => Promise<string>; | ||
export declare const createEventsStorage: (overrides?: BrowserOptions) => Promise<Storage<Event[]> | undefined>; | ||
export declare const createDeviceId: (idFromCookies?: string, idFromOptions?: string, idFromQueryParams?: string) => string; | ||
export declare const createTransport: (transport?: TransportType) => FetchTransport | XHRTransport | SendBeaconTransport; | ||
export declare const getTopLevelDomain: (url?: string) => Promise<string>; | ||
//# sourceMappingURL=config.d.ts.map |
@@ -36,4 +36,4 @@ import { __assign, __awaiter, __extends, __generator, __values } from "tslib"; | ||
function BrowserConfig(apiKey, userId, options) { | ||
var _this = this; | ||
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m; | ||
var _this = this; | ||
var defaultConfig = getDefaultConfig(); | ||
@@ -40,0 +40,0 @@ _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; |
import { BrowserOptions, UserSession } from '@amplitude/analytics-types'; | ||
export declare const parseOldCookies: (apiKey: string, options?: BrowserOptions | undefined) => Promise<UserSession>; | ||
export declare const parseOldCookies: (apiKey: string, options?: BrowserOptions) => Promise<UserSession>; | ||
export declare const parseTime: (num: string) => number | undefined; | ||
export declare const decode: (value?: string | undefined) => string | undefined; | ||
export declare const decode: (value?: string) => string | undefined; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -1,2 +0,2 @@ | ||
export declare const VERSION = "1.6.6"; | ||
export declare const VERSION = "1.6.7"; | ||
//# sourceMappingURL=version.d.ts.map |
@@ -1,2 +0,2 @@ | ||
export var VERSION = '1.6.6'; | ||
export var VERSION = '1.6.7'; | ||
//# sourceMappingURL=version.js.map |
@@ -1,1 +0,1 @@ | ||
!function(){"use strict";!function(e,t){var r=e.amplitude||{_q:[],_iq:[]};if(r.invoked)e.console&&console.error&&console.error("Amplitude snippet has been loaded.");else{var n=function(e,t){e.prototype[t]=function(){return this._q.push({name:t,args:Array.prototype.slice.call(arguments,0)}),this}},s=function(e,t,r){return function(n){e._q.push({name:t,args:Array.prototype.slice.call(r,0),resolve:n})}},o=function(e,t,r){e[t]=function(){if(r)return{promise:new Promise(s(e,t,Array.prototype.slice.call(arguments)))}}},i=function(e){for(var t=0;t<g.length;t++)o(e,g[t],!1);for(var r=0;r<m.length;r++)o(e,m[r],!0)};r.invoked=!0;var u=t.createElement("script");u.type="text/javascript",u.integrity="sha384-GHWzi7MsT/TD3t0f+KUaVeuvPUsuVgdUKegrAWlzO4I83+klmUJna8WTuUunlsg6",u.crossOrigin="anonymous",u.async=!0,u.src="https://cdn.amplitude.com/libs/analytics-browser-1.6.6-min.js.gz",u.onload=function(){e.amplitude.runQueuedFunctions||console.log("[Amplitude] Error: could not load SDK")};var a=t.getElementsByTagName("script")[0];a.parentNode.insertBefore(u,a);for(var c=function(){return this._q=[],this},l=["add","append","clearAll","prepend","set","setOnce","unset","preInsert","postInsert","remove","getUserProperties"],p=0;p<l.length;p++)n(c,l[p]);r.Identify=c;for(var d=function(){return this._q=[],this},v=["getEventProperties","setProductId","setQuantity","setPrice","setRevenue","setRevenueType","setEventProperties"],f=0;f<v.length;f++)n(d,v[f]);r.Revenue=d;var g=["getDeviceId","setDeviceId","getSessionId","setSessionId","getUserId","setUserId","setOptOut","setTransport","reset"],m=["init","add","remove","track","logEvent","identify","groupIdentify","setGroup","revenue","flush"];i(r),r.createInstance=function(){var e=r._iq.push({_q:[]})-1;return i(r._iq[e]),r._iq[e]},e.amplitude=r}}(window,document)}(); | ||
!function(){"use strict";!function(e,t){var n=e.amplitude||{_q:[],_iq:[]};if(n.invoked)e.console&&console.error&&console.error("Amplitude snippet has been loaded.");else{var r=function(e,t){e.prototype[t]=function(){return this._q.push({name:t,args:Array.prototype.slice.call(arguments,0)}),this}},s=function(e,t,n){return function(r){e._q.push({name:t,args:Array.prototype.slice.call(n,0),resolve:r})}},o=function(e,t,n){e[t]=function(){if(n)return{promise:new Promise(s(e,t,Array.prototype.slice.call(arguments)))}}},i=function(e){for(var t=0;t<y.length;t++)o(e,y[t],!1);for(var n=0;n<g.length;n++)o(e,g[n],!0)};n.invoked=!0;var a=t.createElement("script");a.type="text/javascript",a.integrity="sha384-h+4esGA92WhkDzShIebVxPj52fl2uZU/nR4ValEyW6w3lAKnFlQLGZXg2GyH+YHy",a.crossOrigin="anonymous",a.async=!0,a.src="https://cdn.amplitude.com/libs/analytics-browser-1.6.7-min.js.gz",a.onload=function(){e.amplitude.runQueuedFunctions||console.log("[Amplitude] Error: could not load SDK")};var u=t.getElementsByTagName("script")[0];u.parentNode.insertBefore(a,u);for(var c=function(){return this._q=[],this},l=["add","append","clearAll","prepend","set","setOnce","unset","preInsert","postInsert","remove","getUserProperties"],p=0;p<l.length;p++)r(c,l[p]);n.Identify=c;for(var d=function(){return this._q=[],this},f=["getEventProperties","setProductId","setQuantity","setPrice","setRevenue","setRevenueType","setEventProperties"],v=0;v<f.length;v++)r(d,f[v]);n.Revenue=d;var y=["getDeviceId","setDeviceId","getSessionId","setSessionId","getUserId","setUserId","setOptOut","setTransport","reset"],g=["init","add","remove","track","logEvent","identify","groupIdentify","setGroup","revenue","flush"];i(n),n.createInstance=function(){var e=n._iq.push({_q:[]})-1;return i(n._iq[e]),n._iq[e]},e.amplitude=n}}(window,document)}(); |
{ | ||
"name": "@amplitude/analytics-browser", | ||
"version": "1.6.6", | ||
"version": "1.6.7", | ||
"description": "Official Amplitude SDK for Web", | ||
@@ -46,19 +46,19 @@ "keywords": [ | ||
"dependencies": { | ||
"@amplitude/analytics-client-common": "^0.5.0", | ||
"@amplitude/analytics-core": "^0.11.0", | ||
"@amplitude/analytics-client-common": "^0.5.1", | ||
"@amplitude/analytics-core": "^0.11.1", | ||
"@amplitude/analytics-types": "^0.14.0", | ||
"@amplitude/ua-parser-js": "^0.7.31", | ||
"tslib": "^2.3.1" | ||
"tslib": "^2.4.1" | ||
}, | ||
"devDependencies": { | ||
"@aws-sdk/client-s3": "^3.56.0", | ||
"@rollup/plugin-commonjs": "^21.0.2", | ||
"@rollup/plugin-node-resolve": "^13.1.3", | ||
"@rollup/plugin-typescript": "^8.3.1", | ||
"@aws-sdk/client-s3": "^3.229.0", | ||
"@rollup/plugin-commonjs": "^23.0.4", | ||
"@rollup/plugin-node-resolve": "^15.0.1", | ||
"@rollup/plugin-typescript": "^10.0.1", | ||
"@types/ua-parser-js": "^0.7.36", | ||
"http-server": "^14.1.1", | ||
"isomorphic-fetch": "^3.0.0", | ||
"rollup": "^2.69.0", | ||
"rollup": "^2.79.1", | ||
"rollup-plugin-execute": "^1.1.1", | ||
"rollup-plugin-gzip": "^3.0.0", | ||
"rollup-plugin-gzip": "^3.1.0", | ||
"rollup-plugin-terser": "^7.0.2" | ||
@@ -69,3 +69,3 @@ }, | ||
], | ||
"gitHead": "7ea7523f845b1a0dbc5b8e863bc0d2658f8bf38d" | ||
"gitHead": "bb021b75fd1c48cbdb98d8f328eebb74f85c6fb4" | ||
} |
@@ -35,3 +35,3 @@ <p align="center"> | ||
<script type="text/javascript"> | ||
!function(){"use strict";!function(e,t){var r=e.amplitude||{_q:[],_iq:[]};if(r.invoked)e.console&&console.error&&console.error("Amplitude snippet has been loaded.");else{var n=function(e,t){e.prototype[t]=function(){return this._q.push({name:t,args:Array.prototype.slice.call(arguments,0)}),this}},s=function(e,t,r){return function(n){e._q.push({name:t,args:Array.prototype.slice.call(r,0),resolve:n})}},o=function(e,t,r){e[t]=function(){if(r)return{promise:new Promise(s(e,t,Array.prototype.slice.call(arguments)))}}},i=function(e){for(var t=0;t<g.length;t++)o(e,g[t],!1);for(var r=0;r<m.length;r++)o(e,m[r],!0)};r.invoked=!0;var u=t.createElement("script");u.type="text/javascript",u.integrity="sha384-GHWzi7MsT/TD3t0f+KUaVeuvPUsuVgdUKegrAWlzO4I83+klmUJna8WTuUunlsg6",u.crossOrigin="anonymous",u.async=!0,u.src="https://cdn.amplitude.com/libs/analytics-browser-1.6.6-min.js.gz",u.onload=function(){e.amplitude.runQueuedFunctions||console.log("[Amplitude] Error: could not load SDK")};var a=t.getElementsByTagName("script")[0];a.parentNode.insertBefore(u,a);for(var c=function(){return this._q=[],this},l=["add","append","clearAll","prepend","set","setOnce","unset","preInsert","postInsert","remove","getUserProperties"],p=0;p<l.length;p++)n(c,l[p]);r.Identify=c;for(var d=function(){return this._q=[],this},v=["getEventProperties","setProductId","setQuantity","setPrice","setRevenue","setRevenueType","setEventProperties"],f=0;f<v.length;f++)n(d,v[f]);r.Revenue=d;var g=["getDeviceId","setDeviceId","getSessionId","setSessionId","getUserId","setUserId","setOptOut","setTransport","reset"],m=["init","add","remove","track","logEvent","identify","groupIdentify","setGroup","revenue","flush"];i(r),r.createInstance=function(){var e=r._iq.push({_q:[]})-1;return i(r._iq[e]),r._iq[e]},e.amplitude=r}}(window,document)}(); | ||
!function(){"use strict";!function(e,t){var n=e.amplitude||{_q:[],_iq:[]};if(n.invoked)e.console&&console.error&&console.error("Amplitude snippet has been loaded.");else{var r=function(e,t){e.prototype[t]=function(){return this._q.push({name:t,args:Array.prototype.slice.call(arguments,0)}),this}},s=function(e,t,n){return function(r){e._q.push({name:t,args:Array.prototype.slice.call(n,0),resolve:r})}},o=function(e,t,n){e[t]=function(){if(n)return{promise:new Promise(s(e,t,Array.prototype.slice.call(arguments)))}}},i=function(e){for(var t=0;t<y.length;t++)o(e,y[t],!1);for(var n=0;n<g.length;n++)o(e,g[n],!0)};n.invoked=!0;var a=t.createElement("script");a.type="text/javascript",a.integrity="sha384-h+4esGA92WhkDzShIebVxPj52fl2uZU/nR4ValEyW6w3lAKnFlQLGZXg2GyH+YHy",a.crossOrigin="anonymous",a.async=!0,a.src="https://cdn.amplitude.com/libs/analytics-browser-1.6.7-min.js.gz",a.onload=function(){e.amplitude.runQueuedFunctions||console.log("[Amplitude] Error: could not load SDK")};var u=t.getElementsByTagName("script")[0];u.parentNode.insertBefore(a,u);for(var c=function(){return this._q=[],this},l=["add","append","clearAll","prepend","set","setOnce","unset","preInsert","postInsert","remove","getUserProperties"],p=0;p<l.length;p++)r(c,l[p]);n.Identify=c;for(var d=function(){return this._q=[],this},f=["getEventProperties","setProductId","setQuantity","setPrice","setRevenue","setRevenueType","setEventProperties"],v=0;v<f.length;v++)r(d,f[v]);n.Revenue=d;var y=["getDeviceId","setDeviceId","getSessionId","setSessionId","getUserId","setUserId","setOptOut","setTransport","reset"],g=["init","add","remove","track","logEvent","identify","groupIdentify","setGroup","revenue","flush"];i(n),n.createInstance=function(){var e=n._iq.push({_q:[]})-1;return i(n._iq[e]),n._iq[e]},e.amplitude=n}}(window,document)}(); | ||
@@ -38,0 +38,0 @@ amplitude.init("YOUR_API_KEY_HERE"); |
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 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
Sorry, the diff of this file is not supported yet
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
Native code
Supply chain riskContains native code (e.g., compiled binaries or shared libraries). Including native code can obscure malicious behavior.
Found 2 instances in 1 package
463248
119
2865
4