import { Analytics, AnalyticsSettings, InitOptions } from '../core/analytics'; import { Plan } from '../core/events'; import { MetricsOptions } from '../core/stats/remote-metrics'; import { RemotePlugin } from '../plugins/remote-loader'; import type { RoutingRule } from '../plugins/routing-middleware'; import { AnalyticsBuffered } from '../core/buffer'; export interface LegacyIntegrationConfiguration { type?: string; versionSettings?: { version?: string; override?: string; componentTypes?: Array<'browser' | 'android' | 'ios' | 'server'>; }; bundlingStatus?: string; /** * Consent settings for the integration */ consentSettings?: { /** * Consent categories for the integration * @example ["Analytics", "Advertising", "CAT001"] */ categories: string[]; }; retryQueue?: boolean; [key: string]: any; } export interface LegacySettings { integrations: { [name: string]: LegacyIntegrationConfiguration; }; middlewareSettings?: { routingRules: RoutingRule[]; }; enabledMiddleware?: Record; metrics?: MetricsOptions; plan?: Plan; legacyVideoPluginsEnabled?: boolean; remotePlugins?: RemotePlugin[]; /** * Top level consent settings */ consentSettings?: { /** * All unique consent categories for enabled destinations. * There can be categories in this array that are important for consent that are not included in any integration (e.g. 2 cloud mode categories). * @example ["Analytics", "Advertising", "CAT001"] */ allCategories: string[]; /** * Whether or not there are any unmapped destinations for enabled destinations. */ hasUnmappedDestinations: boolean; }; } export interface AnalyticsBrowserSettings extends AnalyticsSettings { /** * The settings for the Segment Source. * If provided, `AnalyticsBrowser` will not fetch remote settings * for the source. */ cdnSettings?: LegacySettings & Record; /** * If provided, will override the default Segment CDN (https://cdn.segment.com) for this application. */ cdnURL?: string; } /** In Segment analytics-next script, settings are fetched from their server * with configurations on e.g. which destinations are enabled. However, in our * case we have no stored settings and always want to send data to the same destination */ export declare function loadLegacySettings(writeKey: string, _?: string, apiHost?: string): Promise; /** * The public browser interface for Segment Analytics * * @example * ```ts * export const analytics = new AnalyticsBrowser() * analytics.load({ writeKey: 'foo' }) * ``` * @link https://github.com/segmentio/analytics-next/#readme */ export declare class AnalyticsBrowser extends AnalyticsBuffered { private _resolveLoadStart; constructor(); /** * Fully initialize an analytics instance, including: * * * Fetching settings from the segment CDN (by default). * * Fetching all remote destinations configured by the user (if applicable). * * Flushing buffered analytics events. * * Loading all middleware. * * Note:️ This method should only be called *once* in your application. * * @example * ```ts * export const analytics = new AnalyticsBrowser() * analytics.load({ writeKey: 'foo' }) * ``` */ load(settings: AnalyticsBrowserSettings, options?: InitOptions): AnalyticsBrowser; /** * Instantiates an object exposing Analytics methods. * * @example * ```ts * const ajs = AnalyticsBrowser.load({ writeKey: '' }) * * ajs.track("foo") * ... * ``` */ static load(settings: AnalyticsBrowserSettings, options?: InitOptions): AnalyticsBrowser; static standalone(writeKey: string, options?: InitOptions): Promise; } //# sourceMappingURL=index.d.ts.map