UNPKG

adam-sdk

Version:

A JavaScript SDK for integrating A.D.A.M. 3D avatars into web applications.

66 lines (65 loc) 2.44 kB
/** * Configuration options for the AvatarSDK. * These options are provided during the SDK's instantiation. */ export interface AvatarSDKOptions { /** * The target origin for postMessage communication. * If not provided, it will be inferred from the iframe's src attribute. * @default new URL(iframeElement.src).origin */ targetOrigin?: string; /** * The desired level of logging for the SDK. * - `none`: No logs will be shown. * - `error`: Only error messages will be displayed. * - `warn`: Warnings and errors will be displayed. * - `info`: Informational messages, warnings, and errors will be displayed. * @default 'info' */ logLevel?: 'none' | 'error' | 'warn' | 'info'; } /** * Options for the `speak` command. * These options allow for customization of the avatar's speech. */ export interface SpeakOptions { /** * The voice to be used for the speech. * This should correspond to a voice available in the avatar's configuration. */ voice?: string; /** * The rate at which the avatar speaks. * This is a number that modifies the default speech rate. * A value of 1 is the default rate. Values less than 1 are slower, and values greater than 1 are faster. */ rate?: number; /** * The pitch of the avatar's voice. * This is a number that modifies the default pitch. * A value of 1 is the default pitch. Values less than 1 are lower, and values greater than 1 are higher. */ pitch?: number; /** * An optional animation to be played while the avatar is speaking. * This should correspond to an animation available in the avatar's configuration. */ animation?: string; /** * An optional expression to be set on the avatar while it is speaking. * This should correspond to an expression available in the avatar's configuration. */ expression?: string; } /** * A map of events that the SDK can emit. * These events can be listened to using the `on` method. */ export type AvatarEvent = 'ready' | 'speech:start' | 'speech:end' | 'command:success' | 'command:error'; /** * A generic callback function for event listeners. * This function is called when an event is emitted, and it receives a payload with event-specific data. * @param payload - The data associated with the event. */ export type EventCallback = (payload: any) => void;