UNPKG

@ninetailed/experience.js-plugin-insights

Version:

Ninetailed SDK plugin for Ninetailed Insights

43 lines (42 loc) 1.57 kB
import { type NinetailedApiClientOptions } from '@ninetailed/experience.js-shared'; import { type ComponentViewEventBatch } from '../types/Event/ComponentViewEventBatch'; export type NinetailedInsightsApiClientOptions = { clientId: string; environment?: string; preview?: boolean; url?: string; }; type RequestOptions = { /** * A timeout after which a request will get cancelled - use this especially on browser implementations */ timeout?: number; /** * The maximum amount of retries for a request. * Only 503 errors will be retried. The Ninetailed API is aware of which requests are retryable and send a 503 error. * * @default 1 */ retries?: number; /** * The maximum amount of time in ms to wait between retries. * By default the retry will be sent immediately as the Ninetailed API is serverless and sends a 503 errors when it could not recover a request internally. * It won't be overloaded. * * @default 0 (no delay) */ minRetryTimeout?: number; useBeacon?: boolean; }; export declare class NinetailedInsightsApiClient { private readonly clientId; private readonly environment; private readonly url; constructor({ clientId, environment, url, }: NinetailedApiClientOptions); private logRequestError; private makeRequest; sendEventBatches(batches: ComponentViewEventBatch[], options?: RequestOptions): Promise<void>; private constructUrl; private constructHeaders; } export {};