@amplitude/analytics-core
Advanced tools
Comparing version
@@ -14,3 +14,3 @@ import { CoreClient, Config, Event, BaseEvent, EventOptions, Identify, Plugin, Revenue } from '@amplitude/analytics-types'; | ||
groupIdentify(groupType: string, groupName: string | string[], identify: Identify, eventOptions?: EventOptions): Promise<import("@amplitude/analytics-types").Result>; | ||
setGroup(groupType: string, groupName: string | string[]): Promise<import("@amplitude/analytics-types").Result>; | ||
setGroup(groupType: string, groupName: string | string[], eventOptions?: EventOptions): Promise<import("@amplitude/analytics-types").Result>; | ||
revenue(revenue: Revenue, eventOptions?: EventOptions): Promise<import("@amplitude/analytics-types").Result>; | ||
@@ -17,0 +17,0 @@ add(plugin: Plugin): Promise<void>; |
@@ -70,4 +70,4 @@ Object.defineProperty(exports, "__esModule", { value: true }); | ||
}; | ||
AmplitudeCore.prototype.setGroup = function (groupType, groupName) { | ||
var event = (0, event_builder_1.createGroupEvent)(groupType, groupName); | ||
AmplitudeCore.prototype.setGroup = function (groupType, groupName, eventOptions) { | ||
var event = (0, event_builder_1.createGroupEvent)(groupType, groupName, eventOptions); | ||
return this.dispatch(event); | ||
@@ -74,0 +74,0 @@ }; |
@@ -128,3 +128,7 @@ Object.defineProperty(exports, "__esModule", { value: true }); | ||
api_key: this.config.apiKey, | ||
events: list.map(function (context) { return context.event; }), | ||
events: list.map(function (context) { | ||
// eslint-disable-next-line @typescript-eslint/no-unused-vars | ||
var _a = context.event, extra = _a.extra, eventWithoutExtra = (0, tslib_1.__rest)(_a, ["extra"]); | ||
return eventWithoutExtra; | ||
}), | ||
options: { | ||
@@ -131,0 +135,0 @@ min_id_length: this.config.minIdLength, |
@@ -5,4 +5,4 @@ import { BaseEvent, TrackEvent, IdentifyEvent, GroupIdentifyEvent, Identify as IIdentify, Revenue, RevenueEvent, EventOptions } from '@amplitude/analytics-types'; | ||
export declare const createGroupIdentifyEvent: (groupType: string, groupName: string | string[], identify: IIdentify, eventOptions?: EventOptions | undefined) => GroupIdentifyEvent; | ||
export declare const createGroupEvent: (groupType: string, groupName: string | string[]) => IdentifyEvent; | ||
export declare const createGroupEvent: (groupType: string, groupName: string | string[], eventOptions?: EventOptions | undefined) => IdentifyEvent; | ||
export declare const createRevenueEvent: (revenue: Revenue, eventOptions?: EventOptions | undefined) => RevenueEvent; | ||
//# sourceMappingURL=event-builder.d.ts.map |
@@ -24,13 +24,9 @@ Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.createGroupIdentifyEvent = createGroupIdentifyEvent; | ||
var createGroupEvent = function (groupType, groupName) { | ||
var createGroupEvent = function (groupType, groupName, eventOptions) { | ||
var _a; | ||
var identify = new identify_1.Identify(); | ||
identify.set(groupType, groupName); | ||
var groupEvent = { | ||
event_type: analytics_types_1.SpecialEventType.IDENTIFY, | ||
user_properties: identify.getUserProperties(), | ||
groups: (_a = {}, | ||
var groupEvent = (0, tslib_1.__assign)((0, tslib_1.__assign)({}, eventOptions), { event_type: analytics_types_1.SpecialEventType.IDENTIFY, user_properties: identify.getUserProperties(), groups: (_a = {}, | ||
_a[groupType] = groupName, | ||
_a), | ||
}; | ||
_a) }); | ||
return groupEvent; | ||
@@ -37,0 +33,0 @@ }; |
@@ -14,3 +14,3 @@ import { CoreClient, Config, Event, BaseEvent, EventOptions, Identify, Plugin, Revenue } from '@amplitude/analytics-types'; | ||
groupIdentify(groupType: string, groupName: string | string[], identify: Identify, eventOptions?: EventOptions): Promise<import("@amplitude/analytics-types").Result>; | ||
setGroup(groupType: string, groupName: string | string[]): Promise<import("@amplitude/analytics-types").Result>; | ||
setGroup(groupType: string, groupName: string | string[], eventOptions?: EventOptions): Promise<import("@amplitude/analytics-types").Result>; | ||
revenue(revenue: Revenue, eventOptions?: EventOptions): Promise<import("@amplitude/analytics-types").Result>; | ||
@@ -17,0 +17,0 @@ add(plugin: Plugin): Promise<void>; |
@@ -68,4 +68,4 @@ import { __awaiter, __generator, __values } from "tslib"; | ||
}; | ||
AmplitudeCore.prototype.setGroup = function (groupType, groupName) { | ||
var event = createGroupEvent(groupType, groupName); | ||
AmplitudeCore.prototype.setGroup = function (groupType, groupName, eventOptions) { | ||
var event = createGroupEvent(groupType, groupName, eventOptions); | ||
return this.dispatch(event); | ||
@@ -72,0 +72,0 @@ }; |
@@ -1,2 +0,2 @@ | ||
import { __awaiter, __generator, __read, __spreadArray } from "tslib"; | ||
import { __awaiter, __generator, __read, __rest, __spreadArray } from "tslib"; | ||
import { PluginType, Status, } from '@amplitude/analytics-types'; | ||
@@ -126,3 +126,7 @@ import { INVALID_API_KEY, MAX_RETRIES_EXCEEDED_MESSAGE, MISSING_API_KEY_MESSAGE, SUCCESS_MESSAGE, UNEXPECTED_ERROR_MESSAGE, } from '../messages'; | ||
api_key: this.config.apiKey, | ||
events: list.map(function (context) { return context.event; }), | ||
events: list.map(function (context) { | ||
// eslint-disable-next-line @typescript-eslint/no-unused-vars | ||
var _a = context.event, extra = _a.extra, eventWithoutExtra = __rest(_a, ["extra"]); | ||
return eventWithoutExtra; | ||
}), | ||
options: { | ||
@@ -129,0 +133,0 @@ min_id_length: this.config.minIdLength, |
@@ -5,4 +5,4 @@ import { BaseEvent, TrackEvent, IdentifyEvent, GroupIdentifyEvent, Identify as IIdentify, Revenue, RevenueEvent, EventOptions } from '@amplitude/analytics-types'; | ||
export declare const createGroupIdentifyEvent: (groupType: string, groupName: string | string[], identify: IIdentify, eventOptions?: EventOptions | undefined) => GroupIdentifyEvent; | ||
export declare const createGroupEvent: (groupType: string, groupName: string | string[]) => IdentifyEvent; | ||
export declare const createGroupEvent: (groupType: string, groupName: string | string[], eventOptions?: EventOptions | undefined) => IdentifyEvent; | ||
export declare const createRevenueEvent: (revenue: Revenue, eventOptions?: EventOptions | undefined) => RevenueEvent; | ||
//# sourceMappingURL=event-builder.d.ts.map |
@@ -19,13 +19,9 @@ import { __assign } from "tslib"; | ||
}; | ||
export var createGroupEvent = function (groupType, groupName) { | ||
export var createGroupEvent = function (groupType, groupName, eventOptions) { | ||
var _a; | ||
var identify = new Identify(); | ||
identify.set(groupType, groupName); | ||
var groupEvent = { | ||
event_type: SpecialEventType.IDENTIFY, | ||
user_properties: identify.getUserProperties(), | ||
groups: (_a = {}, | ||
var groupEvent = __assign(__assign({}, eventOptions), { event_type: SpecialEventType.IDENTIFY, user_properties: identify.getUserProperties(), groups: (_a = {}, | ||
_a[groupType] = groupName, | ||
_a), | ||
}; | ||
_a) }); | ||
return groupEvent; | ||
@@ -32,0 +28,0 @@ }; |
{ | ||
"name": "@amplitude/analytics-core", | ||
"version": "0.6.6", | ||
"version": "0.7.0", | ||
"description": "", | ||
@@ -36,3 +36,3 @@ "author": "Amplitude Inc", | ||
"dependencies": { | ||
"@amplitude/analytics-types": "^0.6.2", | ||
"@amplitude/analytics-types": "^0.7.0", | ||
"tslib": "^2.3.1" | ||
@@ -43,3 +43,3 @@ }, | ||
], | ||
"gitHead": "39c6658dd10b735e38651aedb04f8eeea7e6372e" | ||
"gitHead": "d71a39cd63930ee604f0df293767692c09ab54f5" | ||
} |
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
319953
0.53%+ Added
- Removed