UNPKG

sandai-react

Version:

React components and utilities for the Sandai 3D AI Characters.

57 lines 2 kB
import { InteractionManager } from "./managers/InteractionManager"; /** * A client for interacting with the embedded sandai iframe. * * The `SandaiClient` handles iframe communication, message passing, * and interactions via the `InteractionManager`. * * ## Usage * ```typescript * const client = new SandaiClient("myIframeId"); * ``` * * @param {string} iframeId - The ID of the target iframe element in the DOM. * @throws {Error} Throws an error if the specified element does not exist or is not an iframe. */ export declare class SandaiClient { private _iframe; private _iframeUrl; interactionManager: InteractionManager; /** * Initializes the `SandaiClient` with a given iframe ID. * * @param {string} iframeId - The ID of the target iframe element in the DOM. * @throws {Error} Throws an error if the specified element does not exist or is not an iframe. */ constructor(iframeId: string); /** * Sends a message to the iframe. * * @private * @param {*} data - The data payload to be sent to the iframe. * @throws {Error} Throws an error if the iframe does not have a `contentWindow`. */ _sendMessage(data: any): void; /** * Listens for messages from the iframe. * * @private * @param {(data: any) => void} callback - A function to handle incoming messages. */ _listenForMessage(callback: (data: any) => void): void; /** * Retrieves documentation for the interaction manager. * * @private * @returns {Map<string, Map<string, Map<string, { schema: any[]; func: Function; }> | Map<string, { schema: any[]; func: Function; }>>>} * A `Map` containing nested documentation structures for available managers. */ _getDocs(): Map<string, Map<string, Map<string, { schema: any[]; func: Function; }> | Map<string, { schema: any[]; func: Function; }>>>; } //# sourceMappingURL=index.d.ts.map