import { AnyAction } from "@reduxjs/toolkit"; import FlexTelemetry from "@twilio/flex-ui-telemetry"; import { SegmentOptions } from "@twilio/flex-ui-telemetry/src/types/telemetry"; import { FlexError } from "../../FlexError"; import { Config } from "../../state/AppConfig"; import { ProgrammabilityEvent } from "./ProgrammabilityEvents.definitions"; import { SessionStartEvent } from "./SessionStartEventDelegate"; import { UIInteractionEvent, UIInteractionTraceEvent } from "./UIInteractionEventsDelegate.definitions"; interface TelemetryContext { currentPluginName: string | undefined; currentPluginVersion: string | undefined; currentOptions?: Record; } type ParticipantType = "" | "worker" | "customer" | "transfer" | "supervisor" | "agent" | "external" | "unknown"; export interface TelemetryEvent { eventName: string; eventSource?: string; } export interface TelemetryErrorEvent extends TelemetryEvent { error: { code: number; debugger: boolean; description?: string; message: string; module?: string; plugin?: string; pluginVersion?: string; reporter: string; resourceSid?: string; severity: "fatal" | "error" | "warning" | "info"; source: string; stackTrace?: string; unhandled?: boolean; wrappedErrorMessage?: string; wrappedErrorCode?: number; }; } declare class TelemetryManagerImpl { private readonly sentSDKTelemetryClients; private initialTaskChannels; private readonly uiInteractionEventsDelegate; private readonly programmabilityEventsDelegate; private readonly sessionStartEventDelegate; private readonly errorEventDelegate; private readonly openTelemetryManager; private twilsockClient?; private storage; private sessionToken; private isTelemetryDisabled; readySegmentAnalytics: boolean; private unsendSegmentRequest; analytics: FlexTelemetry | null; initialize: (config: Config) => Promise; updateTelemetryToken: (token: string) => void; private onReportMediaMessageSent; private onReportMediaMessageReceived; reportPluginInteraction: (payload: Record) => void; private onAddProgrammabilityEvent; private onUiInteractionEvent; private onFlexCoreErrorEvent; private compareTaskChannelDefinitions; setContext(context: TelemetryContext): void; resetContext(): void; private getCorrelation; private getUniqueKeyByJourney; reportSLOJourneyEvent: (event: UIInteractionTraceEvent) => void; endTelemetryFlow: (flowName: string) => void; reportProgrammabilityEvent: (event: ProgrammabilityEvent) => void; reportUIInteractionEvent: (event: UIInteractionEvent) => void; reportErrorEvent: (error: FlexError) => void; stopProgrammabilityGrouping: () => void; reportSessionStartEvent: (event: SessionStartEvent) => void; reportChatAutoJoinRetryStart: (taskSid: string) => void; reportChatAutoJoinRetryComplete: (taskSid: string, count: number) => void; reportSecondIncomingVoiceCall: (taskSid?: string) => void; reportFlexEventListeners: (name: string, command: string) => void; reportSDKUsage: (name: string, optionalParams?: Partial) => void; reportNotificationEvent: (name: string, command: string, options?: {}) => void; reportKeyboardShortcutEvent: (name: string, command: string, options?: object) => void; reportCustomTaskChannelRegistration: (name: string, command: string, options?: object) => void; reportTokenLifecycleEvent: (name: string, command: string, options?: object) => void; reportVoiceCallWithWrongSecret: (issue: "missing" | "mismatch", details: Record) => void; reportTransferPanelOpen: () => void; reportTransferPanelClose: () => void; reportDirectoryTabClick: (tab: string) => void; reportExternalWarmTransferStart: () => void; reportCallParticipantHold: ({ type }: { type: ParticipantType; }) => void; reportCallParticipantUnhold: ({ type }: { type: ParticipantType; }) => void; reportCallParticipantKicked: ({ type }: { type: ParticipantType; }) => void; /** * Reports the use of the flex selector. * @since 2.0.0 * @param {Record} details - Details of the selector. * @example * // Example usage: * TelemetryManager.reportUseFlexSelector({ selector: func.toString() }); * @deprecated * @deprecatedSince 2.8.3 * @altRecommendation It is not recommended to use this telemetry as it will result in a lot of telemetry events being sent. * @altRecommendationExample N/A * @private */ reportUseFlexSelector: (details: Record) => void; /** * Reports the use of the flex dispatch action. * @since 2.0.0 * @param {AnyAction} action - The Redux action object. * @param {string} action.type - The type of the action. * @example * TelemetryManager.reportUseFlexDispatch({ type: 'ACTION_TYPE' }); * @deprecated * @deprecatedSince 2.8.3 * @altRecommendation It is not recommended to use this telemetry as it will result in a lot of telemetry events being sent. * @altRecommendationExample N/A * @private */ reportUseFlexDispatch: ({ type }: AnyAction) => void; reportOutboundCallCanceledEvent: (reasonCode: number, sid: string) => void; reportUseExternalSubscribeToWorkersMethod: () => void; track: (event: string, properties?: Record, options?: SegmentOptions) => void; page: (event: string, properties?: Record, options?: SegmentOptions) => void; initSegmentTracker(): void; private onUIInteractionEventForTelemetry; private onDisableTelemetryReceived; private onDisableErrorTelemetryReceived; } export declare const TelemetryManager: TelemetryManagerImpl; export {};