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 // eslint-disable-next-line @typescript-eslint/no-explicit-any invoke: (method: string, ...args: any[]) => unknown track?: (event: Track) => void | Promise identify?: (event: Identify) => void | Promise page?: (event: Page) => void | Promise alias?: (event: Alias) => void | Promise group?: (event: Group) => void | Promise // Segment.io specific ontrack?: (event: Track) => void | Promise onidentify?: (event: Identify) => void | Promise onpage?: (event: Page) => void | Promise onalias?: (event: Alias) => void | Promise ongroup?: (event: Group) => void | Promise _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