import { Module } from '@ringcentral-integration/commons/lib/di' ; import { RcUIModuleV2 , UIFunctions , UIProps , } from '@ringcentral-integration/core' ; import { AlertRenderer } from '../../components/AlertRenderer' ; import { NotificationMessage , NotificationPanelProps , } from '../../components/NotificationPanel/NotificationPanel.interface' ; import { NotificationContainerProps } from '../../containers/NotificationContainer/NotificationContainer.interface' ; import { Deps } from './AlertUI.interface' ; @ Module ( { name : 'AlertUI' , deps : [ 'Brand' , 'Alert' , 'Locale' , 'RouterInteraction' , { dep : 'RateLimiter' , optional : true , } , { dep : 'Softphone' , optional : true , } , { dep : 'CallLogSection' , optional : true , } , ] , } ) export class AlertUI extends RcUIModuleV2 < Deps > { constructor ( deps ) { super ( { deps } ) ; } getUIProps ( { className , classes , size , messageAlign , fullWidth , } ) { return { className , classes , size , messageAlign , fullWidth , currentLocale : this . _deps . locale . currentLocale , messages : this . _deps . alert . messages as NotificationMessage [ ] , brand : this . _deps . brand . name , } ; } getUIFunctions ( { getAdditionalRenderer , regionSettingsUrl , callingSettingsUrl , } ) { return { getRenderer : ( message ) => { if ( getAdditionalRenderer ) { const renderer = getAdditionalRenderer ( ) ( message ) ; if ( renderer ) { return renderer ; } } const { alert , brand , softphone , rateLimiter , routerInteraction , callLogSection , } = this . _deps ; return AlertRenderer ( { alert , brand , softphone , rateLimiter , routerInteraction , callLogSection , regionSettingsUrl , callingSettingsUrl , } ) ( message ) ; } , dismiss : ( id ) => this . _deps . alert . dismiss ( id ) , } ; } }