@@ -12,46 +12,78 @@ import {
1212 loadingBannerStyles
1313} from './styles/Captions.style' ;
1414import { OnRenderAvatarCallback } from '../types' ;
15+ import { useLocale } from '../localization' ;
1516
1617/**
17- * @internal
18+ * @public
1819 * information required for each line of caption
1920 */
20- export type _CaptionsInfo = {
21+ export type CaptionsInformation = {
22+ /**
23+ * unique id for each caption
24+ */
2125 id : string ;
26+ /**
27+ * speaker's display name
28+ */
2229 displayName : string ;
30+ /**
31+ * content of the caption
32+ */
2333 captionText : string ;
34+ /**
35+ * id of the speaker
36+ */
2437 userId ?: string ;
2538} ;
2639
2740/**
28- * @internal
41+ * @public
2942 * strings for captions banner
3043 */
31- export interface _CaptionsBannerStrings {
44+ export interface CaptionsBannerStrings {
45+ /**
46+ * Spinner text for captions banner
47+ */
3248 captionsBannerSpinnerText ?: string ;
3349}
3450
3551/**
36- * @internal
37- * _CaptionsBanner Component Props.
52+ * @public
53+ * CaptionsBanner Component Props.
3854 */
39- export interface _CaptionsBannerProps {
40- captions : _CaptionsInfo [ ] ;
55+ export interface CaptionsBannerProps {
56+ /**
57+ * Array of captions to be displayed
58+ */
59+ captions : CaptionsInformation [ ] ;
60+ /**
61+ * Flag to indicate if captions are on
62+ */
4163 isCaptionsOn ?: boolean ;
64+ /**
65+ * Flag to indicate if captions are being started
66+ * This is used to show spinner while captions are being started
67+ */
4268 startCaptionsInProgress ?: boolean ;
4369 /**
4470 * Optional callback to override render of the avatar.
4571 *
4672 * @param userId - user Id
4773 */
4874 onRenderAvatar ?: OnRenderAvatarCallback ;
49- strings ?: _CaptionsBannerStrings ;
75+ /**
76+ * Optional strings for the component
77+ */
78+ strings ?: CaptionsBannerStrings ;
5079 /**
5180 * Optional form factor for the component.
5281 * @defaultValue 'default'
5382 */
5483 formFactor ?: 'default' | 'compact' ;
84+ /**
85+ * Optional options for the component.
86+ */
5587 captionsOptions ?: {
5688 height : 'full' | 'default' ;
5789 } ;
@@ -60,19 +92,20 @@ export interface _CaptionsBannerProps {
6092const SCROLL_OFFSET_ALLOWANCE = 20 ;
6193
6294/**
63- * @internal
95+ * @public
6496 * A component for displaying a CaptionsBanner with user icon, displayName and captions text.
6597 */
66- export const _CaptionsBanner = ( props : _CaptionsBannerProps ) : JSX . Element => {
98+ export const CaptionsBanner = ( props : CaptionsBannerProps ) : JSX . Element => {
6799 const {
68100 captions,
69101 isCaptionsOn,
70102 startCaptionsInProgress,
71103 onRenderAvatar,
72- strings,
73104 formFactor = 'default' ,
74105 captionsOptions
75106 } = props ;
107+ const localeStrings = useLocale ( ) . strings . captionsBanner ;
108+ const strings = { ...localeStrings , ...props . strings } ;
76109 const captionsScrollDivRef = useRef < HTMLUListElement > ( null ) ;
77110 const [ isAtBottomOfScroll , setIsAtBottomOfScroll ] = useState < boolean > ( true ) ;
78111 const theme = useTheme ( ) ;
0 commit comments