/** * Interceptors let an installed extension gate a host flow at a named point. * Registration mirrors hooks: the callback is serialized and reconstructed on the host, * so it must be self-contained (use only its payload arg and the injected host commands). */ export type InterceptorPoint = "refund_start"; /** false = stop the flow; true = continue, no data; object = continue and merge into the flow payload. */ export type InterceptorReturn = Record> = boolean | T; export interface InterceptorHostCommands { openExtensionOverlay: (params: { point: InterceptorPoint; payload?: any; }) => Promise; [command: string]: (params?: any) => Promise; } export type InterceptorFunction = (payload: any, cmds: InterceptorHostCommands, callCommand: (action: string, params?: any) => Promise) => InterceptorReturn | Promise; export interface InterceptorRegisterOptions { /** Stable id; re-registering with the same id replaces the previous one. */ interceptorId: string; /** Per-interceptor timeout override (ms). */ timeoutMs?: number; } export interface InterceptorOverlayContext { point: InterceptorPoint; payload: any; }