interface RequestConfig { headers?: Record; timeout?: number; responseType?: XMLHttpRequestResponseType; retry?: number; renewSession?: boolean; } export interface ApiResponse { meta: { requestId: string; httpStatus: number; errorCode?: string; message?: string; }; result: Record; } export declare function isPageUnloading(): boolean; /** * A request that got no response (network error, timeout or abort). * The message stays stable for Sentry grouping; the details are fields, * which Sentry records through extraErrorDataIntegration and tags in Logger. */ export declare class ApiRequestError extends Error { type: 'network' | 'timeout' | 'abort'; method: string; endpoint: string; status: number; elapsedMs: number; timeout: number; attempt: number; clientRequestId: string; unloading: boolean; online: boolean; visibility: string; sinceLoadMs: number; constructor(details: Pick); get cancelledByNavigation(): boolean; get retryable(): boolean; } export declare const SESSION_EXPIRES_AT_HEADER = "Session-Expires-At"; export declare const CLIENT_REQUEST_ID_HEADER = "X-Client-Request-Id"; /** * API utility class for making HTTP requests using XMLHttpRequest */ export declare class API { baseUrl: any; defaultBaseUrl: string; defaultHeaders: Record; defaultTimeout: number; retryDelay: number; useCookie: boolean; sessionKey: string | undefined; sessionTimeout: number; constructor(payload?: { baseUrl?: string; defaultHeaders?: Record; defaultTimeout?: number; useCookie?: boolean; sessionKey?: string; sessionTimeout?: number; }); setUseCookie(value: boolean): void; /** * Points the requests to a custom API url. * Without a url, it falls back to the url the instance was created with. */ setBaseUrl(url?: string): void; sessionRenewer: (() => Promise) | null; private renewing; setSessionRenewer(renewer: (() => Promise) | null): void; private ensureSession; get(endpoint: string, config?: RequestConfig): Promise; post(endpoint: string, payload?: Record, config?: RequestConfig): Promise; put(endpoint: string, payload?: Record, config?: RequestConfig): Promise; delete(endpoint: string, payload?: Record, config?: RequestConfig): Promise; patch(endpoint: string, payload?: Record, config?: RequestConfig): Promise; request(method: string, endpoint: string, data?: any, config?: RequestConfig): Promise; send(method: string, endpoint: string, data: any, config: RequestConfig | undefined, attempt: number): Promise; addBreadcrumb(method: string, endpoint: string, data: Record, level: 'info' | 'warning' | 'error'): void; /** * Keeps the local session expiry in sync with the backend. Every response carries the * session end time in SESSION_EXPIRES_AT_HEADER; a backend without it only restarts * the timeout on successful responses, which the fallback mirrors. */ handleSessionRefresh(sentUuid: string | undefined, responseData: ApiResponse, xhr: XMLHttpRequest): void; /** * Build the full URL by combining baseUrl and endpoint */ buildUrl(endpoint: string): string; /** * Prepare data by response type */ getResponseData(xhr: XMLHttpRequest, headers: Record): ApiResponse; } export declare const CheckoutAPI: API; export declare const CardAPI: API; export {};