@segment/analytics-next
Version:
Analytics Next (aka Analytics 2.0) is the latest version of Segment’s JavaScript SDK - enabling you to send your data to any tool without having to learn, test, or use a new API every time.
36 lines • 1.47 kB
TypeScript
import { Group, Identify, Track, Page, Alias } from '@segment/facade';
import { Analytics } from '../../core/analytics';
import { Emitter } from '@segment/analytics-generic-utils';
import { User } from '../../core/user';
export interface LegacyIntegration extends Emitter {
name: string;
analytics?: Analytics;
initialize: () => void;
loaded: () => boolean;
invoke: (method: string, ...args: any[]) => unknown;
track?: (event: Track) => void | Promise<void>;
identify?: (event: Identify) => void | Promise<void>;
page?: (event: Page) => void | Promise<void>;
alias?: (event: Alias) => void | Promise<void>;
group?: (event: Group) => void | Promise<void>;
ontrack?: (event: Track) => void | Promise<void>;
onidentify?: (event: Identify) => void | Promise<void>;
onpage?: (event: Page) => void | Promise<void>;
onalias?: (event: Alias) => void | Promise<void>;
ongroup?: (event: Group) => void | Promise<void>;
_assumesPageview?: boolean;
options?: object;
}
export interface ClassicIntegrationBuilder {
new (options: object): LegacyIntegration;
prototype: LegacyIntegration;
}
export interface ClassicIntegrationGenerator {
(analytics: {
user: () => User;
addIntegration: () => void;
}): void;
Integration: ClassicIntegrationBuilder;
}
export type ClassicIntegrationSource = ClassicIntegrationGenerator | ClassicIntegrationBuilder;
//# sourceMappingURL=types.d.ts.map