import type { MessageTarget } from '../protocol/types.js'; import type { ColorScheme, PageContext, PluginBrand, PluginContext, ViewportUpdatePayload } from '../public/types.js'; /** * Plugin context as a test supplies it. `page.subPath` is optional because the * SDK derives it from `page.route`; a supplied value is ignored, so the * handle's `context` always matches what `sdk.getContext()` resolves to. */ export type MockPluginContext = Omit & { page: Omit & Partial>; }; interface MockSourceWindow { dispatchEvent(event: Event): boolean; } export interface MockSdkContextOptions { context?: MockPluginContext; token?: string; targetOrigin?: string; protocolVersion?: string; now?: () => number; parentWindow?: MessageTarget; sourceWindow?: MockSourceWindow; osColorScheme?: ColorScheme; appShellColorScheme?: ColorScheme; brand?: PluginBrand; } export interface MockOutboundMessage { message: unknown; targetOrigin: string; } export interface MockSdkContextHandle { readonly context: PluginContext; readonly messages: readonly MockOutboundMessage[]; readonly targetOrigin: string; /** `subPath` values the SDK sent via `navigation.setRoute`, in order, after SDK normalization. */ readonly routeChanges: readonly string[]; emitTokenUpdate(token: string): void; emitViewportChange(dimensions: ViewportUpdatePayload): void; emitOsColorSchemeChange(colorScheme: ColorScheme): void; emitThemeChange(colorScheme: ColorScheme): void; restore(): void; } /** * Installs a lightweight App Shell mock around the SDK's parent-window transport. * The returned handle can emit host events and must be restored after each test. */ export declare const mockSdkContext: (options?: MockSdkContextOptions) => MockSdkContextHandle; export {}; //# sourceMappingURL=mock-sdk-context.d.ts.map