@@ -15,11 +15,17 @@ import { buttonFlyoutIncreasedSizeStyles } from '../../CallComposite/styles/Butt
1515import { MoreButton } from '../../common/MoreButton' ;
1616/*@conditional -compile-remove(PSTN-calls) */ /* @conditional -compile-remove(one-to-n-calling) */
1717import { useLocale } from '../../localization' ;
18+ /* @conditional -compile-remove(control-bar-button-injection) */
19+ import { CallWithChatControlOptions } from '../CallWithChatComposite' ;
20+ /* @conditional -compile-remove(control-bar-button-injection) */
21+ import { generateCustomCallWithChatDrawerButtons , onFetchCustomButtonPropsTrampoline } from '../CustomButton' ;
1822
1923/** @private */
2024export interface DesktopMoreButtonProps extends ControlBarButtonProps {
2125 disableButtonsForHoldScreen ?: boolean ;
2226 onClickShowDialpad ?: ( ) => void ;
27+ /* @conditional -compile-remove(control-bar-button-injection) */
28+ callControls ?: boolean | CallWithChatControlOptions ;
2329}
2430
2531/**
@@ -41,41 +47,57 @@ export const DesktopMoreButton = (props: DesktopMoreButtonProps): JSX.Element =>
4147 [ localeStrings ]
4248 ) ;
4349
44- const moreButtonContextualMenuItems = ( ) : IContextualMenuItem [ ] => {
45- const items : IContextualMenuItem [ ] = [ ] ;
50+ const moreButtonContextualMenuItems : IContextualMenuItem [ ] = [ ] ;
4651
47- /*@conditional -compile-remove(PSTN-calls) */ /* @conditional -compile-remove(one-to-n-calling) */
48- items . push ( {
49- key : 'holdButtonKey' ,
50- text : localeStrings . component . strings . holdButton . tooltipOffContent ,
52+ /*@conditional -compile-remove(PSTN-calls) */ /* @conditional -compile-remove(one-to-n-calling) */
53+ moreButtonContextualMenuItems . push ( {
54+ key : 'holdButtonKey' ,
55+ text : localeStrings . component . strings . holdButton . tooltipOffContent ,
56+ onClick : ( ) => {
57+ holdButtonProps . onToggleHold ( ) ;
58+ } ,
59+ iconProps : { iconName : 'HoldCallContextualMenuItem' , styles : { root : { lineHeight : 0 } } } ,
60+ itemProps : {
61+ styles : buttonFlyoutIncreasedSizeStyles
62+ } ,
63+ disabled : props . disableButtonsForHoldScreen
64+ } ) ;
65+
66+ /*@conditional -compile-remove(PSTN-calls) */
67+ if ( props . onClickShowDialpad ) {
68+ moreButtonContextualMenuItems . push ( {
69+ key : 'showDialpadKey' ,
70+ text : localeStrings . strings . callWithChat . openDtmfDialpadLabel ,
5171 onClick : ( ) => {
52- holdButtonProps . onToggleHold ( ) ;
72+ props . onClickShowDialpad && props . onClickShowDialpad ( ) ;
5373 } ,
54- iconProps : { iconName : 'HoldCallContextualMenuItem ' , styles : { root : { lineHeight : 0 } } } ,
74+ iconProps : { iconName : 'Dialpad ' , styles : { root : { lineHeight : 0 } } } ,
5575 itemProps : {
5676 styles : buttonFlyoutIncreasedSizeStyles
5777 } ,
5878 disabled : props . disableButtonsForHoldScreen
5979 } ) ;
80+ }
6081
61- /*@conditional -compile-remove(PSTN-calls) */
62- if ( props . onClickShowDialpad ) {
63- items . push ( {
64- key : 'showDialpadKey' ,
65- text : localeStrings . strings . callWithChat . openDtmfDialpadLabel ,
66- onClick : ( ) => {
67- props . onClickShowDialpad && props . onClickShowDialpad ( ) ;
68- } ,
69- iconProps : { iconName : 'Dialpad' , styles : { root : { lineHeight : 0 } } } ,
70- itemProps : {
71- styles : buttonFlyoutIncreasedSizeStyles
72- } ,
73- disabled : props . disableButtonsForHoldScreen
74- } ) ;
75- }
82+ /* @conditional -compile-remove(control-bar-button-injection) */
83+ const customDrawerButtons = useMemo (
84+ ( ) =>
85+ generateCustomCallWithChatDrawerButtons (
86+ onFetchCustomButtonPropsTrampoline ( typeof props . callControls === 'object' ? props . callControls : undefined ) ,
87+ typeof props . callControls === 'object' ? props . callControls . displayType : undefined
88+ ) ,
89+ [ props . callControls ]
90+ ) ;
7691
77- return items ;
78- } ;
92+ /* @conditional -compile-remove(control-bar-button-injection) */
93+ customDrawerButtons [ 'overflow' ] ?. props . children . forEach ( ( element ) => {
94+ moreButtonContextualMenuItems . push ( {
95+ itemProps : {
96+ styles : buttonFlyoutIncreasedSizeStyles
97+ } ,
98+ ...element
99+ } ) ;
100+ } ) ;
79101
80102 return (
81103 < MoreButton
@@ -84,7 +106,7 @@ export const DesktopMoreButton = (props: DesktopMoreButtonProps): JSX.Element =>
84106 /*@conditional -compile-remove(PSTN-calls) */ /* @conditional -compile-remove(one-to-n-calling) */
85107 strings = { moreButtonStrings }
86108 menuIconProps = { { hidden : true } }
87- menuProps = { { items : moreButtonContextualMenuItems ( ) } }
109+ menuProps = { { items : moreButtonContextualMenuItems } }
88110 />
89111 ) ;
90112} ;
0 commit comments