UNPKG

@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.

52 lines 2.38 kB
import type { Integrations } from '../../core/events/interfaces'; import { CDNSettings } from '../../browser'; import { JSONObject, JSONValue } from '../../core/events'; import { Plugin, InternalPluginWithAddMiddleware } from '../../core/plugin'; import { DestinationMiddlewareFunction } from '../middleware'; import { Context } from '../../core/context'; import { Analytics, InitOptions } from '../../core/analytics'; export interface RemotePlugin { /** The name of the remote plugin */ name: string; /** The creation name of the remote plugin */ creationName: string; /** The url of the javascript file to load */ url: string; /** The UMD/global name the plugin uses. Plugins are expected to exist here with the `PluginFactory` method signature */ libraryName: string; /** The settings related to this plugin. */ settings: JSONObject; } export declare class ActionDestination implements InternalPluginWithAddMiddleware { name: string; version: string; /** * The lifecycle name of the wrapped plugin. * This does not need to be 'destination', and can be 'enrichment', etc. */ type: Plugin['type']; alternativeNames: string[]; private loadPromise; middleware: DestinationMiddlewareFunction[]; action: Plugin; constructor(name: string, action: Plugin); addMiddleware(...fn: DestinationMiddlewareFunction[]): void; private transform; private _createMethod; alias: (ctx: Context) => Promise<Context>; group: (ctx: Context) => Promise<Context>; identify: (ctx: Context) => Promise<Context>; page: (ctx: Context) => Promise<Context>; screen: (ctx: Context) => Promise<Context>; track: (ctx: Context) => Promise<Context>; isLoaded(): boolean; ready(): Promise<boolean>; load(ctx: Context, analytics: Analytics): Promise<unknown>; unload(ctx: Context, analytics: Analytics): Promise<unknown> | unknown; } export type PluginFactory = { (settings: JSONValue): Plugin | Plugin[] | Promise<Plugin | Plugin[]>; pluginName: string; }; export declare function remoteLoader(settings: CDNSettings, userIntegrations: Integrations, mergedIntegrations: Record<string, JSONObject>, options?: InitOptions, routingMiddleware?: DestinationMiddlewareFunction, pluginSources?: PluginFactory[]): Promise<Plugin[]>; //# sourceMappingURL=index.d.ts.map