@twilio/flex-ui
Version:
Twilio Flex UI
60 lines (59 loc) • 1.93 kB
TypeScript
import { ReservationStatuses } from "../TaskChannels";
type ReservationSound = {
reservationStatus: ReservationStatuses;
url?: string;
repeatable?: boolean;
};
export type SoundConfig = {
taskChannelName?: string;
reservationSounds: Array<ReservationSound>;
};
/**
* Configures sound settings for different task channels in Flex,
* enabling customization of sounds based on reservation statuses.
* Supports defining sound behavior for individual task channels or setting a global fallback.
*
* @public
* @param {Array<SoundConfig>} soundConfigs - An array of sound configurations for one or more task channels.
*
* @example
* // Example 1: Customize sounds per task channel
* SoundManager.configure([
* {
* taskChannelName: Flex.DefaultTaskChannels.Call.name,
* reservationSounds: [
* { reservationStatus: ReservationStatuses.Pending },
* { reservationStatus: ReservationStatuses.Accepted, url: 'https://example.com/call.mp3', repeatable: false }
* ]
* },
* {
* taskChannelName: Flex.DefaultTaskChannels.ChatWeb.name,
* reservationSounds: [
* { reservationStatus: ReservationStatuses.Pending, url: 'https://example.com/pending.mp3', repeatable: false }
* ]
* }
* ]);
*
* @example
* // Example 2: Global fallback configuration (applies if no channel-specific override exists)
* SoundManager.configure([
* {
* reservationSounds: [
* { reservationStatus: ReservationStatuses.Pending, url: 'https://example.com/global.mp3' }
* ]
* }
* ]);
*
* @since 2.13.0
*/
declare class SoundManagerImplementation {
configure(soundConfigs?: SoundConfig[]): void;
}
/**
* Singleton instance of the SoundManager used for configuring custom sounds
* @constant {SoundManagerImplementation} SoundManager
* @category Framework
* @since 2.13.0
*/
export declare const SoundManager: SoundManagerImplementation;
export {};