import { EngineAIWebComponentElement } from './component'; import { EngineAIWebComponentRemoteEventAction } from './remote-manager'; export interface EngineAIWebComponentEventMap { 'state-change': EngineAIWebComponentStateChangeEvent; [key: string]: Event; } type ContentHeightChangeEventAction = { type: 'content-height-change'; data: { height: number; }; }; type LocationChangeEventAction = { type: 'location-change'; /** * path is the new path - can be relative (e.g. /dashboards/insights-homepage) or absolute (e.g. https://localhost:3000/workspaces/invest/apps/invest-dev/dashboards/insights-homepage) * target is the target attribute of the anchor element */ data: { path: string; target?: HTMLAnchorElement['target']; }; }; type LoginRequestEventAction = { type: 'login-request'; data?: never; }; type EmbeddedAppUrlRequest = { type: 'embedded-app-url-request'; data: { href: string; }; }; export type EngineAIWebComponentStateChangeEventAction = ContentHeightChangeEventAction | LocationChangeEventAction | LoginRequestEventAction | EmbeddedAppUrlRequest; type ObserveEventAction = { type: `@internal:observe`; data: { event: EngineAIWebComponentRemoteEventAction['type']; }; }; type UnobserveEventAction = { type: `@internal:unobserve`; data: { event: EngineAIWebComponentRemoteEventAction['type']; }; }; export type InternalEngineAIWebComponentStateChangeEventAction = ObserveEventAction | UnobserveEventAction; /** * if you want to support custom actions, at the `onStateChange` handler, you can cast the action to the custom action type, augmenting the type with the custom actions * * @example * ```typescript * type AugmentedStateChangeEventAction = EngineAIWebComponentStateChangeEventAction | { * type: 'custom-action'; * data: { * customData: string; * }; * }; * * onStateChange(ev: EngineAIWebComponentStateChangeEvent) { * const action = ev.action as AugmentedStateChangeEventAction; * if (action.type === 'custom-action') { * // handle custom action * } * } * ``` */ export declare class EngineAIWebComponentStateChangeEvent extends Event { readonly action: EngineAIWebComponentStateChangeEventAction; constructor(action: EngineAIWebComponentStateChangeEventAction); /** * Overrides the standard Event.target property to provide a more specific type. * In this context, `target` always refers to the EngineAIWebComponentElement * that dispatched the event, ensuring type safety and clarity. */ readonly target: EngineAIWebComponentElement; } export interface EngineAIWebComponentEventHandlers { onStateChange: ((this: EngineAIWebComponentElement, ev: EngineAIWebComponentStateChangeEvent) => void) | null; } export {};