@amplitude-alpha/analytics-browser
Advanced tools
Comparing version 0.0.11 to 0.0.12
@@ -1,8 +0,12 @@ | ||
import { AnalyticsEvent, IAnalyticsClient, AnalyticsPluginConfig as AnalyticsPluginConfigCore } from "@amplitude-alpha/analytics-core"; | ||
import { AnalyticsEvent, IAnalyticsClient } from "@amplitude-alpha/analytics-core"; | ||
import { AmplitudePlugin, AmplitudePluginCategory, BrowserAmplitudePluginBase, BrowserPluginConfig } from "@amplitude-alpha/amplitude-browser"; | ||
export type { AnalyticsEvent, IAnalyticsClient }; | ||
export interface AnalyticsPluginConfig extends BrowserPluginConfig, AnalyticsPluginConfigCore { | ||
} | ||
import { BrowserOptions } from "@amplitude/analytics-types"; | ||
export type { AnalyticsEvent, IAnalyticsClient, BrowserOptions }; | ||
export interface IAnalytics extends AmplitudePlugin, IAnalyticsClient { | ||
} | ||
export interface AnalyticsPluginConfig { | ||
apiKey?: string; | ||
userId?: string; | ||
options?: BrowserOptions; | ||
} | ||
export declare class Analytics extends BrowserAmplitudePluginBase implements IAnalytics { | ||
@@ -14,3 +18,4 @@ category: AmplitudePluginCategory; | ||
private apiKey; | ||
load(config: AnalyticsPluginConfig, pluginConfig: any): void; | ||
private client; | ||
load(config: BrowserPluginConfig, pluginConfig: AnalyticsPluginConfig): void; | ||
track(eventType: string | AnalyticsEvent, eventProperties?: Record<string, any>): Promise<void>; | ||
@@ -17,0 +22,0 @@ protected _track(event: AnalyticsEvent): Promise<import("@amplitude/analytics-types").Result>; |
@@ -30,3 +30,4 @@ "use strict"; | ||
this.apiKey = (pluginConfig === null || pluginConfig === void 0 ? void 0 : pluginConfig.apiKey) || config.apiKey; | ||
(0, analytics_browser_1.init)(this.apiKey); | ||
this.client = (0, analytics_browser_1.createInstance)(); | ||
this.client.init(this.apiKey, pluginConfig === null || pluginConfig === void 0 ? void 0 : pluginConfig.userId, pluginConfig === null || pluginConfig === void 0 ? void 0 : pluginConfig.options); | ||
(_a = config.hub) === null || _a === void 0 ? void 0 : _a.user.subscribe(user_messages_1.userUpdatedMessage, message => { | ||
@@ -37,7 +38,7 @@ this.onAcceptableMessage(message.payload, ({ updateType, user }) => __awaiter(this, void 0, void 0, function* () { | ||
this.config.logger.log(`[Analytics.setUserId] ${user.userId}`); | ||
(0, analytics_browser_1.setUserId)(user.userId); | ||
this.client.setUserId(user.userId); | ||
break; | ||
case "device-id": | ||
this.config.logger.log(`[Analytics.setDeviceId] ${user.deviceId}`); | ||
(0, analytics_browser_1.setDeviceId)(user.deviceId); | ||
this.client.setDeviceId(user.deviceId); | ||
break; | ||
@@ -51,3 +52,3 @@ case "user-properties": | ||
} | ||
void (0, analytics_browser_1.identify)(id); | ||
void this.client.identify(id); | ||
break; | ||
@@ -81,3 +82,3 @@ } | ||
this.config.logger.log(`[Analytics.track] ${(0, util_1.jsons)(event)}`); | ||
return (0, analytics_browser_1.track)(event).promise; | ||
return this.client.track(event).promise; | ||
}); | ||
@@ -88,3 +89,3 @@ } | ||
this.config.logger.log(`[Analytics.flush]`); | ||
return (0, analytics_browser_1.flush)().promise; | ||
return this.client.flush().promise; | ||
}); | ||
@@ -91,0 +92,0 @@ } |
{ | ||
"name": "@amplitude-alpha/analytics-browser", | ||
"version": "0.0.11", | ||
"version": "0.0.12", | ||
"description": "> TODO: description", | ||
@@ -17,7 +17,7 @@ "author": "justin.fiedler <justin.fiedler@amplitude.com>", | ||
"dependencies": { | ||
"@amplitude-alpha/amplitude-browser": "^0.0.11", | ||
"@amplitude-alpha/analytics-core": "^0.0.11", | ||
"@amplitude-alpha/hub": "^0.0.11", | ||
"@amplitude-alpha/user-messages": "^0.0.11", | ||
"@amplitude-alpha/util": "^0.0.11", | ||
"@amplitude-alpha/amplitude-browser": "^0.0.12", | ||
"@amplitude-alpha/analytics-core": "^0.0.12", | ||
"@amplitude-alpha/hub": "^0.0.12", | ||
"@amplitude-alpha/user-messages": "^0.0.12", | ||
"@amplitude-alpha/util": "^0.0.12", | ||
"@amplitude/analytics-browser": "^1.5.1" | ||
@@ -33,3 +33,3 @@ }, | ||
}, | ||
"gitHead": "34f736407c8df02e6432ce46f3e2557e854f175e" | ||
"gitHead": "613909d49e9dabc4af3ed2fb1a9a3debd80a1024" | ||
} |
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
9850
114
+ Added@amplitude-alpha/amplitude-browser@0.0.12(transitive)
+ Added@amplitude-alpha/amplitude-core@0.0.12(transitive)
+ Added@amplitude-alpha/analytics-core@0.0.12(transitive)
+ Added@amplitude-alpha/hub@0.0.12(transitive)
+ Added@amplitude-alpha/user@0.0.12(transitive)
+ Added@amplitude-alpha/user-messages@0.0.12(transitive)
+ Added@amplitude-alpha/util@0.0.12(transitive)
- Removed@amplitude-alpha/amplitude-browser@0.0.11(transitive)
- Removed@amplitude-alpha/amplitude-core@0.0.11(transitive)
- Removed@amplitude-alpha/analytics-core@0.0.11(transitive)
- Removed@amplitude-alpha/hub@0.0.11(transitive)
- Removed@amplitude-alpha/user@0.0.11(transitive)
- Removed@amplitude-alpha/user-messages@0.0.11(transitive)
- Removed@amplitude-alpha/util@0.0.11(transitive)
Updated@amplitude-alpha/hub@^0.0.12