/** * Configuration for alert closure behavior by status type */ declare interface AlertClosureConfig { /** * Duration in milliseconds before an alert reappears after being closed * Set to 0 to never show again until status changes * @default 300000 (5 minutes) */ closeDurationMs: number; /** * Minimum time interval in milliseconds between status checks when alert is closed * @default 60000 (1 minute) */ checkIntervalMs: number; } export { AlertClosureConfig } export { AlertClosureConfig as AlertClosureConfig_alias_1 } export declare class AlertManager { private deps; private alertElement; private boundInternalAlertClosedHandler; constructor(dependencies: AlertManagerDependencies); private get logger(); private get config(); private get i18nProvider(); private getStatusDetails; private _internalAlertClosedHandler; /** * Called by OopsWidget when the TimerManager signals its onTimerStart callback. * This will dispatch the 'oops-widget-timer-start' event on the alert element. * @param duration The duration of the timer. */ notifyTimerStarted(duration: number): void; /** * Called by OopsWidget when the TimerManager signals its onTimerCancel callback. * This will dispatch the 'oops-widget-timer-cancel' event on the alert element. */ notifyTimerCancelled(): void; showAlert(status: SystemStatus, statusResponse?: SystemStatusResponse): Promise; private updateExistingAlertElement; private createNewAlertElement; private configureAlertElement; private setAlertAttributes; private updateAlertTimerProgress; updateTimerProgressOnAlert(): void; private dispatchInitialTimerEvent; hideAlert(): void; refreshTimerProgressDisplay(): void; } export declare interface AlertManagerDependencies { config: OopsWidgetConfig; logger: Logger_2; i18nProvider: I18nProvider; timerManager: TimerManager; internalCheckStatusFn: () => Promise; notifyAlertClosedFn: () => void; } /** * Arabic (Saudi Arabia) translations */ export declare const arSA: TranslationDictionary; /** * Available languages in the i18n system */ declare type AvailableLanguage = 'en-US' | 'es-ES' | 'es-MX' | 'pl-PL' | 'de-DE' | 'it-IT' | 'pt-BR' | 'en-GB' | 'uk-UA' | 'pt-PT' | 'es-AR' | 'es-PE' | 'es-CO' | 'es-CL' | 'cs-CZ' | 'tr-TR' | 'fr-FR' | 'fr-CA' | 'zh-CN' | 'zh-TW' | 'zh-HK' | 'zh-SG' | 'ja-JP' | 'ko-KR' | 'nl-NL' | 'nl-BE' | 'sv-SE' | 'nb-NO' | 'ar-SA' | 'hi-IN'; export { AvailableLanguage } export { AvailableLanguage as AvailableLanguage_alias_1 } /** * Clear all stored alert data */ declare function clearAlertStorage(): void; export { clearAlertStorage } export { clearAlertStorage as clearAlertStorage_alias_1 } declare interface CloseAlertPayload { status: SystemStatus; state: WidgetState; } export { CloseAlertPayload } export { CloseAlertPayload as CloseAlertPayload_alias_1 } /** * Data stored for a closed alert */ declare interface ClosedAlertData { /** * Status of the alert that was closed */ status: SystemStatus; /** * Timestamp when the alert was closed */ closedAt: number; } export { ClosedAlertData } export { ClosedAlertData as ClosedAlertData_alias_1 } /** * Create an I18nProvider that auto-detects the user's browser language. */ declare function createAutoDetectI18nProvider(): I18nProvider; export { createAutoDetectI18nProvider } export { createAutoDetectI18nProvider as createAutoDetectI18nProvider_alias_1 } /** * Create an I18nProvider with a fixed language. * @param language - language code */ declare function createI18nProvider(language: AvailableLanguage): I18nProvider; export { createI18nProvider } export { createI18nProvider as createI18nProvider_alias_1 } /** * Creates a pre-configured URL matcher with enterprise-level error handling */ declare function createMonitoredServiceChecker(defaultPatterns?: (string | RegExp)[], defaultOptions?: UrlMatchOptions): (url: string | URL, additionalPatterns?: (string | RegExp)[], overrideOptions?: Partial) => boolean; export { createMonitoredServiceChecker } export { createMonitoredServiceChecker as createMonitoredServiceChecker_alias_1 } export { createMonitoredServiceChecker as createMonitoredServiceChecker_alias_2 } /** * Creates a network error with additional metadata * @param message - Error message * @param url - URL that was being accessed * @param isMonitored - Whether the URL is a monitored service * @param originalError - Original error if this is a wrapped error * @returns Network error with metadata */ declare function createNetworkError(message: string, url: string, isMonitored?: boolean, originalError?: Error): NetworkError; export { createNetworkError } export { createNetworkError as createNetworkError_alias_1 } /** * Factory function to create a new OopsWidget instance */ declare function createOopsWidget(config: OopsWidgetConfig): OopsWidgetInstance; export { createOopsWidget } export { createOopsWidget as createOopsWidget_alias_1 } /** * Returns an unmodified instance of fetch from a sandboxed iframe, * so that any interceptors applied to window.fetch are bypassed. * The iframe is kept in the DOM to prevent its global scope from shutting down. * * This implementation ensures complete isolation from any interceptors * like those defined in fetchInterceptor.ts and xhrInterceptor.ts. * * @returns The original fetch function. */ declare function createSandboxedFetch(): typeof window.fetch; export { createSandboxedFetch } export { createSandboxedFetch as createSandboxedFetch_alias_1 } /** * Creates a slow request warning with additional metadata * @param message - Warning message * @param url - URL that was being accessed * @param isMonitored - Whether the URL is a monitored service * @param timeoutMs - Timeout in milliseconds * @returns Network error with metadata */ declare function createSlowRequestWarning(message: string, url: string, isMonitored?: boolean, timeoutMs?: number): NetworkError; export { createSlowRequestWarning } export { createSlowRequestWarning as createSlowRequestWarning_alias_1 } /** * Czech (Czech Republic) translations */ export declare const csCZ: TranslationDictionary; /** * German (Germany) translations */ export declare const deDE: TranslationDictionary; /** * Default configuration values */ declare const DEFAULT_CONFIG: Partial; export { DEFAULT_CONFIG } export { DEFAULT_CONFIG as DEFAULT_CONFIG_alias_1 } /** * Default language to use if no match is found */ declare const DEFAULT_LANGUAGE = "en-US"; export { DEFAULT_LANGUAGE } export { DEFAULT_LANGUAGE as DEFAULT_LANGUAGE_alias_1 } /** * Detects the user's preferred language from the browser settings * and maps it to one of our supported languages. * * @returns The detected language code that matches our supported languages. */ declare function detectBrowserLanguage(): AvailableLanguage; export { detectBrowserLanguage } export { detectBrowserLanguage as detectBrowserLanguage_alias_1 } /** * English (UK) translations */ export declare const enGB: TranslationDictionary; /** * English (US) translations */ export declare const enUS: TranslationDictionary; /** * Manages triggering status checks based on network errors. * Features: * - Triggers checks for specific error types on monitored URLs. * - Throttles status checks to prevent rapid firing during incidents. */ export declare class ErrorManager { private static instance; private logger; private statusCheckTrigger?; private lastStatusTrigger; private statusTriggerThrottle; private constructor(); static getInstance(): ErrorManager; /** * Set the function that will be called to trigger a status check. * @param trigger - The function to call to initiate a status check (after throttling). */ setStatusCheckTrigger(trigger: () => void): void; /** * Handle an error received from an interceptor or other source. */ handleError(error: NetworkError, source: string): void; /** * Evaluates if an error warrants a status check, applies throttling, and triggers if appropriate. */ private _evaluateAndTriggerStatusCheck; /** * Set the status check throttle time. */ setStatusTriggerThrottle(throttleMs: number): void; } /** * Spanish (Argentina) translations */ export declare const esAR: TranslationDictionary; /** * Spanish (Chile) translations */ export declare const esCL: TranslationDictionary; /** * Spanish (Colombia) translations */ export declare const esCO: TranslationDictionary; /** * Spanish (Spain) translations */ export declare const esES: TranslationDictionary; /** * Spanish (Mexico) translations */ export declare const esMX: TranslationDictionary; /** * Spanish (Peru) translations */ export declare const esPE: TranslationDictionary; declare enum EventType { STATE_CHANGED = "stateChanged", STATUS_CHECK_REQUESTED = "statusCheckRequested", STATUS_CHECK_COMPLETED = "statusCheckCompleted", SHOW_ALERT = "showAlert", HIDE_ALERT = "hideAlert", CLOSE_ALERT = "closeAlert" } export { EventType } export { EventType as EventType_alias_1 } declare class FetchInterceptor implements Interceptor { readonly name = "fetch"; readonly config: InterceptorConfig; private cleanup; private logger; constructor(config?: InterceptorConfig); setup(): () => void; private setupInternal; } export { FetchInterceptor } export { FetchInterceptor as FetchInterceptor_alias_1 } /** * French (Canada) translations */ export declare const frCA: TranslationDictionary; /** * French (France) translations */ export declare const frFR: TranslationDictionary; /** * Get the last closed alert data */ declare function getClosedAlertData(): ClosedAlertData | null; export { getClosedAlertData } export { getClosedAlertData as getClosedAlertData_alias_1 } /** * Gets the configured close duration for a given status, applying defaults. * @param config The widget configuration object. * @param status The system status. * @returns The close duration in milliseconds. */ export declare function getCloseDurationMs(config: OopsWidgetConfig, status: SystemStatus): number; /** * Get the shared error manager instance. */ export declare function getErrorManager(): ErrorManager; /** * Get item from localStorage with prefix * @param key Storage key * @param prefix Prefix to use for the key * @returns The stored value or null if not found */ declare function getItem(key: string, prefix?: string): T | null; export { getItem } export { getItem as getItem_alias_1 } /** * Convenience function to get the logger instance * @returns Logger instance */ declare const getLogger: () => Logger; export { getLogger } export { getLogger as getLogger_alias_1 } /** * Get the shared request monitor instance */ declare function getRequestMonitor(config?: Partial): RequestMonitor; export { getRequestMonitor } export { getRequestMonitor as getRequestMonitor_alias_1 } export { getRequestMonitor as getRequestMonitor_alias_2 } /** * Get status details text for a given system status and language. * @param status - system status enum * @param language - language code */ export declare function getStatusDetails(status: SystemStatus, language: string): Promise; /** * Retrieve supported languages. */ export declare function getSupportedLanguages(): AvailableLanguage[]; /** * Get UI string for a specific key and language. * @param key - UI string key * @param language - language code */ export declare function getUIString(key: keyof TranslationDictionary['ui'], language: string): Promise; /** * Gets the configured check interval for a given status, applying defaults and enforcing a minimum. * @param config The widget configuration object. * @param status The system status. * @param logger A logger instance for warnings. * @returns The validated check interval in milliseconds. */ export declare function getValidatedCheckIntervalMs(config: OopsWidgetConfig, status: SystemStatus, logger: Logger): number; /** * Hindi (India) translations */ export declare const hiIN: TranslationDictionary; /** * Interface for the i18n provider * This allows customers to provide their own translations */ declare interface I18nProvider { /** * Get status details for a specific system status and language */ getStatusDetails(status: SystemStatus): Promise; /** * Get UI string for a specific key and language */ getUIString(key: keyof TranslationDictionary['ui']): Promise; /** * Get list of all supported languages */ getSupportedLanguages(): AvailableLanguage[]; } export { I18nProvider } export { I18nProvider as I18nProvider_alias_1 } /** * Incident information from the status endpoint */ declare interface IncidentInfo { /** * The names of the incidents */ names?: string[]; /** * The statuses of the incidents */ statuses?: string[]; /** * URLs to more information about the incidents */ links?: string[]; } export { IncidentInfo } export { IncidentInfo as IncidentInfo_alias_1 } /** * Interface for implementing network request interceptors * This allows for custom implementation of different interceptors * that can be loaded separately from the main bundle */ declare interface Interceptor { /** * Setup the interceptor * @param handleError Function to call when an error occurs * @returns A cleanup function that restores original behavior when called */ setup(): () => void; /** * Name of the interceptor for identification purposes */ readonly name: string; /** * Optional configuration specific to this interceptor type * Will be merged with global configuration */ config?: InterceptorConfig; } export { Interceptor } export { Interceptor as Interceptor_alias_1 } export { Interceptor as Interceptor_alias_2 } /** * Configuration options for a specific interceptor */ declare interface InterceptorConfig { /** * Timeout in milliseconds for this interceptor * @default 30000 */ timeoutMs?: number; /** * Whether to show alerts for slow requests * @default true */ showSlowRequestAlerts?: boolean; /** * Whether to show alerts for errors * @default true */ showErrorAlerts?: boolean; /** * Patterns to identify internal services that should be monitored * Can be: * - Absolute URLs (e.g., 'https://api.example.com') * - Relative paths (e.g., '/api/users') * - Glob patterns (e.g., '/api/*') * - String patterns that match with "contains" logic (e.g., 'example.com') * - RegExp patterns (e.g., /api\.example\.com/) * * String patterns will match if the URL contains the pattern. * RegExp patterns will match if the URL matches the regular expression. * * If not provided, only URLs matching the current origin and relative URLs will be monitored, * based on the monitoredServiceOptions configuration. * @default [] * * Note: This setting provides global patterns. For interceptor-specific patterns, * configure them in the interceptor's config property. */ monitoredServicePatterns?: (string | RegExp)[]; /** * Options for monitored service URL detection * These options control how URLs are determined to be monitored services * * Available options: * - includeCurrentOrigin: Whether to automatically monitor URLs matching the current origin (default: true) * - treatRelativeAsInternal: Whether to automatically monitor all relative URLs (default: true) * - currentOrigin: Explicitly set the current origin (useful in SSR environments) * - requireExplicitPatterns: When true, only URLs explicitly matching monitoredServicePatterns will be monitored, * ignoring the default behavior of monitoring relative and same-origin URLs (default: false) * * Note: This setting provides global options. For interceptor-specific options, * configure them in the interceptor's config property. */ monitoredServiceOptions?: UrlMatchOptions; } export { InterceptorConfig } export { InterceptorConfig as InterceptorConfig_alias_1 } export { InterceptorConfig as InterceptorConfig_alias_2 } /** * Checks if the provided URL is absolute using the URL constructor. * If the URL is relative (or invalid), the constructor will throw. * * @param url - The URL to check. * @returns True if the URL is absolute, false otherwise. */ declare function isAbsoluteUrl(url: string): boolean; export { isAbsoluteUrl } export { isAbsoluteUrl as isAbsoluteUrl_alias_1 } export { isAbsoluteUrl as isAbsoluteUrl_alias_2 } /** * Checks if a URL matches any of the provided patterns with complete error isolation * * @param url - The URL to check (string or URL object) * @param patterns - Optional patterns to match against * @param options - Configuration options * @returns True if the URL matches, false otherwise (never throws) */ declare function isMonitoredService(url: string | URL, patterns?: (string | RegExp)[], options?: UrlMatchOptions): boolean; export { isMonitoredService } export { isMonitoredService as isMonitoredService_alias_1 } export { isMonitoredService as isMonitoredService_alias_2 } /** * Type guard to check if an error is a SlowRequestWarning * * @param error - The error to check * @returns True if the error is a SlowRequestWarning */ declare function isSlowRequestWarning(error: Error): error is SlowRequestWarning; export { isSlowRequestWarning } export { isSlowRequestWarning as isSlowRequestWarning_alias_1 } /** * Italian (Italy) translations */ export declare const itIT: TranslationDictionary; /** * Japanese (Japan) translations */ export declare const jaJP: TranslationDictionary; /** * Korean (South Korea) translations */ export declare const koKR: TranslationDictionary; /** * Logger utility that controls logging based on log level * This prevents unnecessary logs from appearing in production environments */ declare class Logger { private static instance; private logLevel; private prefix; private constructor(); /** * Get the singleton instance of the logger */ static getInstance(): Logger; /** * Configure the logger * @param config Configuration options */ configure(config: Partial): void; /** * Log a message (only if log level allows) * @param args Arguments to log */ log(...args: unknown[]): void; /** * Log an info message (only if log level allows) * @param args Arguments to log */ info(...args: unknown[]): void; /** * Log a warning message (only if log level allows) * @param args Arguments to log */ warn(...args: unknown[]): void; /** * Log an error message (only if log level allows) * @param args Arguments to log */ error(...args: unknown[]): void; /** * Log a debug message (only if log level allows) * @param args Arguments to log */ debug(...args: unknown[]): void; } export { Logger } export { Logger as Logger_alias_1 } declare type Logger_2 = ReturnType; /** * Log levels for the logger * - DEBUG: Show all logs (debug, info, warn, error) * - INFO: Show info, warn, and error logs * - WARN: Show warn and error logs * - ERROR: Show only error logs * - NONE: Don't show any logs */ declare enum LogLevel { DEBUG = 0, INFO = 1, WARN = 2, ERROR = 3, NONE = 4 } export { LogLevel } export { LogLevel as LogLevel_alias_1 } export { LogLevel as LogLevel_alias_2 } /** * Check if URL matches any pattern */ declare function matchPatterns(patterns: (string | RegExp)[], urlInfo: UrlInfo): boolean; export { matchPatterns } export { matchPatterns as matchPatterns_alias_1 } export { matchPatterns as matchPatterns_alias_2 } /** * Internal configuration type used after merging user config with DEFAULT_CONFIG * All optional properties become required after the merge */ declare type MergedOopsWidgetConfig = Required> & Omit; export { MergedOopsWidgetConfig } export { MergedOopsWidgetConfig as MergedOopsWidgetConfig_alias_1 } /** * Norwegian Bokmål (Norway) translations */ export declare const nbNO: TranslationDictionary; /** * Extended error interface with URL information */ declare interface NetworkError extends Error { /** * URL that was being accessed when the error occurred */ url: string; /** * Whether the URL is a monitored service based on configuration */ isMonitored?: boolean; /** * Original error if this is a wrapped error */ originalError?: Error; /** * Timeout in milliseconds for slow request warnings */ timeoutMs?: number; } export { NetworkError } export { NetworkError as NetworkError_alias_1 } /** * Dutch (Belgium) translations */ export declare const nlBE: TranslationDictionary; /** * Dutch (Netherlands) translations */ export declare const nlNL: TranslationDictionary; /** * OopsWidget class that handles the main functionality of the library */ export declare class OopsWidget implements OopsWidgetInstance { private config; private _fetch; private cleanupFunctions; private logger; private i18nProvider; private errorManager; private stateMachine?; private timerManager?; private alertManager?; private stateEventUnsub?; private lastKnownStatus?; /** * Create a new OopsWidget instance * @param config Configuration options */ constructor(config: OopsWidgetConfig); /** Setup core dependencies like i18nProvider */ private _setupDependencies; /** Setup the sandboxed fetch instance */ private _setupFetch; /** Register the custom element for the alert */ private _setupDOM; /** Setup interceptors if enabled */ private _setupInterceptors; /** Instantiate and connect Managers and State Machine */ private _setupManagersAndStateMachine; private _setupAlertManager; /** * Handle events from the state machine */ private handleStateMachineEvent; /** * Internal implementation of status check with AbortController */ private _internalCheckStatus; /** * Destroy the widget and clean up all resources */ destroy(): void; /** * Notify the state machine that the user has closed the alert. * This method is called by AlertManager via the notifyAlertClosedFn callback. */ private _handleAlertClosedByUIManager; /** * Start the widget: performs an initial status check and starts the internal state machine. */ start(): Promise; } /** * Configuration options for the OopsWidget */ declare interface OopsWidgetConfig { /** * URL to fetch system status from */ statusUrl: string; /** * Custom i18n provider for internationalization * If provided, this provider will be used instead of the default i18n implementation * This allows customers to provide their own translations */ i18nProvider?: I18nProvider; /** * Custom web component class for the status alert * If provided, this class will be used instead of the default StatusAlert component * The component must extend HTMLElement. */ alertComponent: CustomElementConstructor; /** * Whether to display incident details (names, statuses, links) when available * If false, incident details will not be shown even if they are available * @default false */ displayIncidentDetails?: boolean; /** * Placement of the alert on desktop devices * @default 'top-right' */ placement?: 'top-right' | 'top-left' | 'bottom-right' | 'bottom-left'; /** * Custom interceptors to use instead of the built-in ones * If provided, these will be used instead of the default interceptors * This allows customers to provide their own interceptors implementation * or load them from a separate bundle * * Each interceptor can have its own configuration options via the config property. */ interceptors?: Interceptor[]; /** * Log level to control which types of logs are shown * - DEBUG: Show all logs (debug, info, warn, error) * - INFO: Show info, warn, and error logs * - WARN: Show warn and error logs * - ERROR: Show only error logs * - NONE: Don't show any logs * @default LogLevel.NONE */ logLevel?: LogLevel; /** * Mobile configuration options * Controls how the alert is displayed on mobile devices */ mobile?: { /** * Whether to enable mobile-specific styling * @default false */ enabled?: boolean; /** * Placement of the alert on mobile devices * @default 'top' */ placement?: 'top' | 'bottom'; /** * Custom media query to determine when to apply mobile styling * If not provided, a default media query will be used * @default '(max-width: 768px)' */ mediaQuery?: string; }; /** * Configuration for alert closure behavior * Controls how alerts behave when closed by the user */ alertClosureBehavior?: { /** * Configuration for alert closure behavior by status type * If not provided for a status, default values will be used */ [SystemStatus.Operational]?: AlertClosureConfig; [SystemStatus.UnderMaintenance]?: AlertClosureConfig; [SystemStatus.DegradedPerformance]?: AlertClosureConfig; [SystemStatus.PartialOutage]?: AlertClosureConfig; [SystemStatus.MajorOutage]?: AlertClosureConfig; }; /** * Optional HTML element to append the alert widget to. * If not provided, the widget will be appended to `document.body`. * @default document.body */ containerElement?: HTMLElement; /** * Timeout duration in milliseconds for status check requests * @default 10000 (10 seconds) */ statusCheckTimeoutMs?: number; } export { OopsWidgetConfig } export { OopsWidgetConfig as OopsWidgetConfig_alias_1 } export { OopsWidgetConfig as OopsWidgetConfig_alias_2 } declare interface OopsWidgetInstance { /** * Start the widget * @returns Promise that resolves when the widget is started */ start(): Promise; /** * Destroy the widget and clean up all resources */ destroy: () => void; } export { OopsWidgetInstance } export { OopsWidgetInstance as OopsWidgetInstance_alias_1 } export { OopsWidgetInstance as OopsWidgetInstance_alias_2 } /** * Parse URL parameters from a string, supporting array parameters with [] notation * @param text URL parameters as a string * @returns Parsed parameters as a Record with support for array values */ declare function parseAdvancedUrlParams(text: string): ParsedUrlParams; export { parseAdvancedUrlParams } export { parseAdvancedUrlParams as parseAdvancedUrlParams_alias_1 } declare interface ParsedUrlParams { [key: string]: string | string[]; } export { ParsedUrlParams } export { ParsedUrlParams as ParsedUrlParams_alias_1 } /** * Parse and normalize a URL */ declare function parseUrl(url: string | URL, currentOrigin: string): UrlInfo | null; export { parseUrl } export { parseUrl as parseUrl_alias_1 } export { parseUrl as parseUrl_alias_2 } declare function parseUrlParams(text: string): Record; export { parseUrlParams } export { parseUrlParams as parseUrlParams_alias_1 } /** * Polish (Poland) translations */ export declare const plPL: TranslationDictionary; /** * Portuguese (Brazil) translations */ export declare const ptBR: TranslationDictionary; /** * Portuguese (Portugal) translations */ export declare const ptPT: TranslationDictionary; /** * Record that an alert has been closed by the user */ declare function recordClosedAlert(status: SystemStatus): void; export { recordClosedAlert } export { recordClosedAlert as recordClosedAlert_alias_1 } /** * Remove item from localStorage with prefix * @param key Storage key * @param prefix Prefix to use for the key * @returns Whether the operation was successful */ declare function removeItem(key: string, prefix?: string): boolean; export { removeItem } export { removeItem as removeItem_alias_1 } /** * Singleton service that centralizes request monitoring logic * Enterprise-level implementation with complete error isolation */ declare class RequestMonitor { private static instance; private config; private isMonitoredFn; private logger; private errorManager; private isInitialized; private constructor(); /** * Initialize configuration with safe defaults */ private initializeConfig; /** * Validate and sanitize timeout value */ private validateTimeout; /** * Validate and sanitize patterns array */ private validatePatterns; /** * Initialize URL checker with error handling */ private initializeUrlChecker; /** * Initialize error manager with error handling */ private initializeErrorManager; /** * Get the singleton instance of RequestMonitor */ static getInstance(config?: Partial): RequestMonitor; /** * Update the configuration safely */ updateConfig(config: Partial): void; /** * Check if a URL should be monitored - completely safe method */ isMonitored(url: string): boolean; /** * Handle slow request warning with complete error isolation */ handleSlowRequest(url: string, source: string): void; /** * Execute slow request handler in isolated context */ private executeSlowRequestHandler; /** * Handle HTTP error with complete error isolation */ handleHttpError(status: number, statusText: string, url: string, source: string): void; /** * Execute HTTP error handler in isolated context */ private executeHttpErrorHandler; /** * Handle network error with complete error isolation */ handleNetworkError(message: string, url: string, source: string, originalError?: Error): void; /** * Execute network error handler in isolated context */ private executeNetworkErrorHandler; /** * Validate common inputs */ private validateInputs; /** * Validate status code */ private isValidStatusCode; /** * Sanitize status text */ private sanitizeStatusText; /** * Sanitize message */ private sanitizeMessage; /** * Get the current timeout configuration */ getTimeoutMs(): number; } export { RequestMonitor } export { RequestMonitor as RequestMonitor_alias_1 } export { RequestMonitor as RequestMonitor_alias_2 } declare interface RequestMonitorConfig { /** * Timeout in milliseconds for requests * @default 30000 */ timeoutMs: number; /** * Whether to show alerts for slow requests * @default true */ showSlowRequestAlerts: boolean; /** * Whether to show alerts for errors * @default true */ showErrorAlerts: boolean; /** * Patterns to identify internal services that should be monitored * @default [] */ monitoredServicePatterns: (string | RegExp)[]; /** * Options for monitored service URL detection * @default {} */ monitoredServiceOptions: UrlMatchOptions; } export { RequestMonitorConfig } export { RequestMonitorConfig as RequestMonitorConfig_alias_1 } export { RequestMonitorConfig as RequestMonitorConfig_alias_2 } /** * Force rebuilding of language maps (useful if supported languages change) */ declare function resetLanguageMaps(): void; export { resetLanguageMaps } export { resetLanguageMaps as resetLanguageMaps_alias_1 } /** * Set item in localStorage with prefix * @param key Storage key * @param value Value to store * @param prefix Prefix to use for the key * @returns Whether the operation was successful */ declare function setItem(key: string, value: T, prefix?: string): boolean; export { setItem } export { setItem as setItem_alias_1 } /** * Factory function to create and setup a fetch interceptor. * * @param config - Configuration options for the interceptor * @returns Cleanup function to restore original fetch behavior */ declare function setupFetchInterceptor(config?: InterceptorConfig): () => void; export { setupFetchInterceptor } export { setupFetchInterceptor as setupFetchInterceptor_alias_1 } /** * Sets up an XHR interceptor that monitors network requests without interfering * with customer business logic. Uses event listeners and microtasks to ensure * complete isolation from existing code. * * @param config - Configuration options for the interceptor. * @returns A cleanup function that restores the original XHR behavior. */ declare function setupXHRInterceptor(config?: InterceptorConfig): () => void; export { setupXHRInterceptor } export { setupXHRInterceptor as setupXHRInterceptor_alias_1 } /** * Check if an alert with the given status should be shown, based on closure settings * * @param status Current system status * @param closeDurationMs How long to suppress alerts after closing (0 = forever until status changes) * @returns Whether the alert should be shown */ declare function shouldShowAlert(status: SystemStatus, closeDurationMs: number): boolean; export { shouldShowAlert } export { shouldShowAlert as shouldShowAlert_alias_1 } declare type ShouldShowAlertFn = (status: SystemStatus, closeDurationMs: number) => boolean; export { ShouldShowAlertFn } export { ShouldShowAlertFn as ShouldShowAlertFn_alias_1 } declare interface ShowAlertPayload { status: SystemStatus; response?: SystemStatusResponse; degraded?: boolean; } export { ShowAlertPayload } export { ShowAlertPayload as ShowAlertPayload_alias_1 } /** * Error for slow requests that haven't failed yet */ declare interface SlowRequestWarning extends NetworkError { /** * Name of the error, always 'SlowRequestWarning' for this type */ name: 'SlowRequestWarning'; /** * Time in milliseconds after which the request was considered slow */ timeoutMs?: number; } export { SlowRequestWarning } export { SlowRequestWarning as SlowRequestWarning_alias_1 } declare interface StateChangedPayload { state: WidgetState; status: SystemStatus; response?: SystemStatusResponse; degraded?: boolean; } export { StateChangedPayload } export { StateChangedPayload as StateChangedPayload_alias_1 } export declare class StatusAlert extends HTMLElement { private shadow; private closeButtonListener?; constructor(); static get observedAttributes(): string[]; connectedCallback(): void; disconnectedCallback(): void; attributeChangedCallback(name: string, oldValue: string | null, newValue: string | null): void; private get statusType(); private get alertTitle(); private get message(); private get mobileEnabled(); private get mobilePlacement(); private get placement(); private get customMediaQuery(); private get config(); private get incidentNames(); private get incidentStatuses(); private get incidentLinks(); private get displayIncidentDetails(); private get closeButtonLabel(); private escapeHtml; private getIncidentDetailsHtml; private attachEventListeners; private detachEventListeners; private updateProgressAnimation; private render; private handleTimerStart; private handleTimerCancel; } declare interface StatusCheckCompletedPayload { status: SystemStatus; response: SystemStatusResponse; degraded?: boolean; } export { StatusCheckCompletedPayload } export { StatusCheckCompletedPayload as StatusCheckCompletedPayload_alias_1 } /** * Status details for the alert component */ declare interface StatusDetails { /** * Title of the alert */ title: string; /** * Message to display in the alert */ message: string; /** * Incident information * This will be populated from the status response when available */ incidents?: { /** * Names of active incidents */ names?: string[]; /** * Statuses of active incidents */ statuses?: string[]; /** * Links to more information about active incidents */ links?: string[]; }; } export { StatusDetails } export { StatusDetails as StatusDetails_alias_1 } export { StatusDetails as StatusDetails_alias_2 } export declare const supportedLanguages: AvailableLanguage[]; /** * Swedish (Sweden) translations */ export declare const svSE: TranslationDictionary; declare enum SystemStatus { Operational = "operational", DegradedPerformance = "degraded_performance", PartialOutage = "partial_outage", MajorOutage = "major_outage", UnderMaintenance = "under_maintenance" } export { SystemStatus } export { SystemStatus as SystemStatus_alias_1 } export { SystemStatus as SystemStatus_alias_2 } /** * Response from the status endpoint */ declare interface SystemStatusResponse { /** * Current system status */ status: SystemStatus; /** * Incident information if available */ incident?: IncidentInfo; /** * Raw response data from the status endpoint * Contains all parameters returned by the endpoint */ rawData: Record; /** * Indicates whether the status is operating in degraded mode * due to a failed request. When true, status may be using cached data. */ degraded?: boolean; /** * Error details when operating in degraded mode */ errorDetails?: string; } export { SystemStatusResponse } export { SystemStatusResponse as SystemStatusResponse_alias_1 } export { SystemStatusResponse as SystemStatusResponse_alias_2 } /** * Manages periodic execution of an async task (onTick) with dynamically determined intervals. */ export declare class TimerManager { private currentState; private pendingCheckTimeoutId; private currentTimeoutInterval; private onTick; private getInterval; private onTimerStart?; private onTimerCancel?; private logger; constructor(options: TimerManagerOptions); /** Transition to a new state, logging the change */ private transitionState; /** Clear any scheduled timeout */ private clearPendingCheck; /** * Starts the periodic execution. Gets the initial interval and schedules the first tick. * If already running, it will effectively reschedule based on the current interval. */ start(): void; /** Schedules the next execution of _runTick */ private scheduleNextTick; /** Internal method that runs the tick and schedules the next one */ private _runTick; /** Get the duration of the currently scheduled timer, if any */ getCurrentTimerDuration(): number | null; /** Cancels any pending check timer and transitions to IDLE state. */ cancelCheck(): void; /** Cleans up resources. */ destroy(): void; } export declare interface TimerManagerOptions { /** Function to execute periodically */ onTick: () => Promise; /** Function to get the interval duration (ms) for the *next* tick */ getInterval: () => number; /** Optional: Called when a periodic timer starts with its duration */ onTimerStart?: (duration: number) => void; /** Optional: Called when any active timer is cancelled or stops (e.g., interval becomes 0) */ onTimerCancel?: () => void; } /** * Translation dictionaries for all supported languages */ export declare type TranslationDictionaries = { [key in AvailableLanguage]?: TranslationDictionary; }; /** * Translation dictionary for a specific language */ declare interface TranslationDictionary { /** * Status details for each system status */ statusDetails: Record; /** * Common UI strings */ ui: { close: string; }; } export { TranslationDictionary } export { TranslationDictionary as TranslationDictionary_alias_1 } /** * Turkish (Turkey) translations */ export declare const trTR: TranslationDictionary; /** * Ukrainian (Ukraine) translations */ export declare const ukUA: TranslationDictionary; declare interface UrlInfo { urlString: string; urlObj: URL | null; isRelative: boolean; urlPath: string; urlHost: string; } /** * Options for URL matching with enterprise-level validation */ declare interface UrlMatchOptions { /** Current origin (defaults to window.location.origin) */ currentOrigin?: string; /** Whether to consider URLs matching the current origin as matching */ includeCurrentOrigin?: boolean; /** Whether to treat all relative URLs as matching by default */ treatRelativeAsInternal?: boolean; /** Whether to require explicit pattern matches */ requireExplicitPatterns?: boolean; } export { UrlMatchOptions } export { UrlMatchOptions as UrlMatchOptions_alias_1 } export { UrlMatchOptions as UrlMatchOptions_alias_2 } export { UrlMatchOptions as UrlMatchOptions_alias_3 } declare enum WidgetState { VISIBLE = "VISIBLE", CLOSED = "CLOSED", IDLE = "IDLE" } export { WidgetState } export { WidgetState as WidgetState_alias_1 } declare interface WidgetStateEvent { type: EventType; payload?: (EventType.STATE_CHANGED extends EventType ? StateChangedPayload : never) | (EventType.STATUS_CHECK_COMPLETED extends EventType ? StatusCheckCompletedPayload : never) | (EventType.SHOW_ALERT extends EventType ? ShowAlertPayload : never) | (EventType.CLOSE_ALERT extends EventType ? CloseAlertPayload : never); } export { WidgetStateEvent } export { WidgetStateEvent as WidgetStateEvent_alias_1 } declare type WidgetStateListener = (event: WidgetStateEvent) => void; export { WidgetStateListener } export { WidgetStateListener as WidgetStateListener_alias_1 } export declare class WidgetStateMachine { private state; private status; private closeTimeoutId; private config; private logger; private shouldShowAlert; private statusCheckFn; private listeners; constructor(options: WidgetStateMachineOptions); /** * Subscribe to state machine events * @returns Unsubscribe function */ subscribe(listener: WidgetStateListener): () => void; /** * Emit an event to all listeners */ private emit; /** * Start the state machine with the initial status */ start(initialStatus: SystemStatus, response?: SystemStatusResponse): void; /** * Handle a new status update */ updateStatus(newStatus: SystemStatus, response?: SystemStatusResponse): void; /** * Handle user closing the widget */ closeAlert(): void; /** * Internal: transition logic */ private transitionTo; /** * Determine initial state based on status and closed alert data */ private getInitialState; /** * Determine next state based on status and current state */ private getNextState; /** * Schedule close timeout (for CLOSED state) */ private scheduleCloseTimeout; /** * Get close duration for current status */ private getCloseDuration; /** * Helper to get close duration for a specific status */ private getCloseDurationForStatus; /** * Get check interval for current status, enforcing a minimum of 30 seconds. */ getCheckInterval(): number; /** * Public method to trigger a status check */ triggerCheck(): Promise; /** * Clear all timers */ private clearTimers; /** * Destroy the state machine and clear timers */ destroy(): void; /** * Get the current status maintained by the state machine. */ get currentStatus(): SystemStatus; /** * Get the current state of the widget. */ get currentState(): WidgetState; /** * Trigger a status check in response to an interceptor error. * This is separate from the regular triggerCheck to properly handle * the special case of interceptor-detected errors. * * @returns Promise that resolves to the system status response */ triggerErrorCheck(): Promise; } declare interface WidgetStateMachineOptions { /** Full widget configuration object */ config: OopsWidgetConfig; /** Status check function */ statusCheckFn?: () => Promise; /** Function to check if an alert should be shown for a given status */ shouldShowAlert?: ShouldShowAlertFn; } export { WidgetStateMachineOptions } export { WidgetStateMachineOptions as WidgetStateMachineOptions_alias_1 } /** * XHRInterceptor class that implements the Interceptor interface */ declare class XHRInterceptor implements Interceptor { readonly name = "xhr"; readonly config: InterceptorConfig; private logger; private cleanupFn; constructor(config?: InterceptorConfig); setup(): () => void; } export { XHRInterceptor } export { XHRInterceptor as XHRInterceptor_alias_1 } /** * Chinese (Simplified) - China */ export declare const zhCN: TranslationDictionary; /** * Chinese (Hong Kong) */ export declare const zhHK: TranslationDictionary; /** * Chinese (Singapore) */ export declare const zhSG: TranslationDictionary; /** * Chinese (Traditional) - Taiwan */ export declare const zhTW: TranslationDictionary; export { }