UNPKG

@optimizely/optimizely-sdk

Version:

JavaScript SDK for Optimizely Feature Experimentation, Optimizely Full Stack (legacy), and Optimizely Rollouts

47 lines (46 loc) 1.99 kB
/** * Copyright 2022-2024, Optimizely * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ import { LoggerFacade } from '../../logging/logger'; import { OdpEvent } from './odp_event'; import { HttpMethod, RequestHandler } from '../../utils/http_request_handler/http'; import { OdpConfig } from '../odp_config'; import { Platform } from '../../platform_support'; export type EventDispatchResponse = { statusCode?: number; }; export interface OdpEventApiManager { sendEvents(odpConfig: OdpConfig, events: OdpEvent[]): Promise<EventDispatchResponse>; setLogger(logger: LoggerFacade): void; } export type EventRequest = { method: HttpMethod; endpoint: string; headers: Record<string, string>; data: string; }; export type EventRequestGenerator = (odpConfig: OdpConfig, events: OdpEvent[]) => EventRequest; export declare const LOGGER_NAME = "OdpEventApiManager"; export declare class DefaultOdpEventApiManager implements OdpEventApiManager { private logger?; private requestHandler; private requestGenerator; constructor(requestHandler: RequestHandler, requestDataGenerator: EventRequestGenerator, logger?: LoggerFacade); setLogger(logger: LoggerFacade): void; sendEvents(odpConfig: OdpConfig, events: OdpEvent[]): Promise<EventDispatchResponse>; } export declare const pixelApiRequestGenerator: EventRequestGenerator; export declare const eventApiRequestGenerator: EventRequestGenerator; export declare const __platforms: Platform[];