import { GlobalProps } from '../../shared/global'; import { SizeUnits } from '../../shared/box'; export interface ChatProps extends GlobalProps { /** * The URL to embed within the Chat component iframe. */ src?: string; /** * Adjust the inline size. * * Surfaces may impose sizing restrictions for the component, therefore the size set * may not be the actual size rendered. * * @see https://developer.mozilla.org/en-US/docs/Web/CSS/inline-size */ inlineSize?: SizeUnits; /** * Adjust the block size. * * Surface may impose sizing restrictions for the component, therefore the size set * may not be the actual size rendered. * * @see https://developer.mozilla.org/en-US/docs/Web/CSS/block-size */ blockSize?: SizeUnits; /** * A label that describes the purpose or contents of the component. When set, * it will be announced to users using assistive technologies and will * provide them with more context. */ accessibilityLabel?: string; /** * Callback when the embedded page sends a message. */ onMessage?: (event: MessageEvent) => void; /** * Callback when the embedded page is ready and a message port has been created to * communicate with the host page. */ onReady?: (event: ReadyEvent) => void; } export interface MessageEvent { /** * The data sent by the message emitter (the embedded page). * * @see https://developer.mozilla.org/en-US/docs/Web/API/MessageEvent/data */ data?: any; /** * A string representing the origin of the message emitter (the embedded page). * * @see https://developer.mozilla.org/en-US/docs/Web/API/MessageEvent/origin */ origin: string; } export interface ReadyEvent { /** * A function to send messages to the embedded page. */ postMessage: (message: any, transfer?: Transferable[]) => void; }